The Owen T function is used for statistics, but has applications like the following definition:
$$2\pi \cdot\text T(x,a)\mathop=^\text{def} \int_0^a\frac{e^{-\frac{x^2}2\left(t^2+1\right)}}{t^2+1}dt$$
We can easily use a series expansion for the exponential function with index $n$, but that would case a hypergeometric function with a negative argument index of $-n$ which cannot really be converted into $n$ in the function. This problem is due to the positive exponent in the $e^y$, it is better to do the following substitution to shape make it easier to turn into a Kampé de Feriét function. We just need an identity, so keep in mind possible restrictions:
$$\int_0^a\frac{e^{-x^2\left(t^2+1\right)}}{t^2+1}dt\ \mathop=^{t^2+1=\frac1{u^2+1}\implies t=\pm \sqrt{\frac1{u^2+1}-1}}_{dt=\frac i{(u^2+1)^\frac32}du,u>0}\ i\int_0^{\sqrt{-\frac{a^2}{a^2+1}}} (u^2+1)\frac{e^{-\frac{x^2}{u^2+1}}}{(u^2+1)^\frac32}du=i\int_0^{\sqrt{-\frac{a^2}{a^2+1}}} \frac{e^{-\frac{x^2}{u^2+1}}}{(u^2+1)^\frac12}du=i\int_0^{\sqrt{-\frac{a^2}{a^2+1}}} \sum_{m=0}^\infty\frac{(-1)^mx^{2m}}{m!(u^2+1)^m(u^2+1)^\frac12}du=i \sum_{m=0}^\infty\frac{(-1)^mx^{2m}}{m!}\int_0^{b} (u^2+1)^{-m-\frac12}du$$
The upper bound will be called $b$ by definition. Let there be an integration using a Gauss hypergeometric series and Pochhammer symbol:
$$i \sum_{m=0}^\infty\frac{(-1)^mx^{2m}}{m!}\int_0^b (u^2+1)^{-m-\frac12}du=i \sum_{m=0}^\infty\frac{(-1)^mx^{2m}}{m!}b\sum_{n=0}^\infty \frac{\left(\frac12\right)_n \left(m+\frac12\right)_n(-b^2)^n}{\left(\frac32\right)_n n!}$$
Notice the similar coefficients to the original problem. We can change the pochhammer symbol by:
$$\left(m+\frac12\right)_n =\frac{\Gamma\left(m+n+\frac12\right)\Gamma\left(\frac12\right)}{\Gamma\left(m+\frac12\right)\Gamma\left(\frac12\right)}=\frac{\left(\frac12\right)_{m+n}}{\left(\frac12\right)_m}$$
Therefore we can use the question’s Kampé de Feriét function link:
$$i \sum_{m=0}^\infty\frac{(-1)^mx^{2m}}{m!}b\sum_{n=0}^\infty \frac{\left(\frac12\right)_n \left(m+\frac12\right)_n(-b^2)^n}{\left(\frac32\right)_n n!}=ib \sum_{m=0}^\infty\sum_{n=0}^\infty \frac{\left(\frac12\right)_{m+n}\left(\frac12\right)_n \left(-x^2\right)^m\left(-b^2\right)^n}{\left(\frac12\right)_m\left(\frac32\right)_n m!n!}=i b\,\text F^{1,0,1}_{0,1,1}\left(^{\frac12;;\frac12}_{;\frac12;\frac32}\ -x^2,-b^2\right)$$
which we now need to form into:
$$\int e^{i\csc^2(x)}dx=\int \cos\left(\csc^2(x) \right)dx+i\int \sin\left(\csc^2(x) \right)dx= C-\sqrt{\sin^2(x)}\cot(x)\text F^{1,0,1}_{0,1,1}\left(^{\frac12;;\frac12}_{;\frac12;\frac32}\ i\csc^2(x)\sin^2(x),\cos^2(x)\right)=$$
To finish the answer, let’s calculate $b$:
$$b={\sqrt{-\frac{a^2}{a^2+1}}}\implies -b^2=\frac{a^2}{a^2+1}$$
Therefore:
$$\text T(x,a)=-\frac{{\sqrt{\frac{a^2}{a^2+1}}}}{2\pi}\,\text F^{1,0,1}_{0,1,1}\left(^{\frac12;;\frac12}_{;\frac12;\frac32}\ -x^2,\frac{a^2}{a^2+1}\right)$$
Solving for $a,x$ and taking the positive square root branch gives the final answer as:
$$\int e^{i\csc^2(x)}dx=\int \cos\left(\csc^2(x) \right)dx+i\int \sin\left(\csc^2(x) \right)dx= -2\pi \sqrt{\cot^2(x)}\tan(x)\text T\left(1-i,\sqrt{\cot^2(x)}\right)+C\mathop=^{x\in\Bbb R} -2\pi\text{sgn}(\cot(x))\text T\left(1-i,|\cot(x)|\right)+C$$
Here is proof of the result with this computation
Therefore one special case is with the Imaginary Error function and Fresnel Integrals:
$$\int_0^\frac\pi4 e^{i\csc^2(x)}dx= \int_0^\frac\pi2 e^{i\csc^2(x)}dx -\int_\frac\pi4^\frac\pi2 e^{i\csc^2(x)}dx =\int_0^1 \frac{e^{i(x^2+1)}}{x^2+1}dx=2\pi(\text T(1-i,\infty)-\text T(1-i,1))=\frac\pi2+\frac\pi2\left((i-1)\text C\left(\sqrt{\frac2\pi}\right)-(1+i) \text S\left(\sqrt{\frac2\pi}\right)\right)+\frac\pi 4\left(\text{erfi}^2\left(\sqrt[4]{-1}\right)+1\right) $$
Note that the following code also applies with the Complementery Error function:
π/2 + 1/2 ((-1 + i) π C(sqrt(2/π)) - (1 + i) π S(sqrt(2/π))) = π/2 + 1/2 (-(1 + i) π (1/2 + 1/4 (1 + i) (i erfc(1/2 (1 - i) sqrt(π) sqrt(2/π)) - erfc(1/2 (1 + i) sqrt(π) sqrt(2/π)))) + (-1 + i) π (1/2 - 1/4 (1 - i) (i erfc(1/2 (1 - i) sqrt(π) sqrt(2/π)) + erfc(1/2 (1 + i) sqrt(π) sqrt(2/π)))))
Here is a plot of the real, cosine, part:
Here is a plot of the imaginary, sine, part:
Please correct me and give me feedback!
It is hard to separate real and imaginary parts of the OwenT function unless you use Complex Components
Best Answer
It's simply not possible to write the integral in terms of a closed-form solution because $ \int (a^{t})^{(a^{t})} \textrm{d}t $ is non-elementary. All elementary functions can be expressed using a finite number of elementary functions and operations, like addition, subtraction, multiplication, fractions, exponentiation, logarithms, trig functions, inverse trig functions, hyperbolic trig functions, and inverse hyperbolic trig functions. Since the integral you're interested in has no elementary solutions, it cannot be written in closed form. So as unfortunate as it sounds, this is probably the best solution to it you're gonna get.
Edit 1: It appears as though I was a bit too hasty in my judgement; yes, this integral is indeed non-elementary, but it actually has a nice solution if you have an open mind!
Observe:
$$ \int (a^{t})^{(a^{t})} \textrm{d}t = \int (e^{t\ln(a)})^{(e^{t\ln(a)})} \textrm{d}t $$ $$ \int (e^{t\ln(a)})^{(e^{t\ln(a)})} \textrm{d}t = \int e^{t\ln(a)e^{t\ln(a)}} \textrm{d}t $$ $$ u = t\ln(a) \implies \textrm{d}t = \dfrac{\textrm{d}u}{\ln(a)} $$ $$ \int e^{t\ln(a)e^{t\ln(a)}} \textrm{d}t = \dfrac{1}{\ln(a)}\int e^{ue^{u}} \textrm{d}u $$
Alrighty then. I was pretty excited when I got to this point, because what nice function conveniently eliminates expressions of the form $xe^{x}$? Let us see:
$$ u = W(v) \implies \textrm{d}u = W'(v)\textrm{d}v $$ $$ \dfrac{1}{\ln(a)}\int e^{ue^{u}} \textrm{d}u = \dfrac{1}{\ln(a)}\int e^{W(v)e^{W(v)}} W'(v) \textrm{d}v $$ $$ \dfrac{1}{\ln(a)}\int e^{W(v)e^{W(v)}} W'(v) \textrm{d}v = \dfrac{1}{\ln(a)}\int e^{v} W'(v) \textrm{d}v $$
And for the finale...
$$ \int e^{v} W'(v) \textrm{d}v = W(v)e^{v} - \int W(v)e^{v} \textrm{d}v $$ $$ v = \ln(z) \implies \textrm{d}v = \dfrac{\textrm{d}z}{z} $$ $$ \int W(v)e^{v} \textrm{d}v = \int W(\ln(z))e^{\ln(z)} \dfrac{\textrm{d}z}{z} $$ $$ \int W(\ln(z))e^{\ln(z)} \dfrac{\textrm{d}z}{z} = \int W(\ln(z))z \dfrac{\textrm{d}z}{z} $$ $$ \int W(\ln(z))z \dfrac{\textrm{d}z}{z} = \int W(\ln(z)) \textrm{d}z $$
Unfortunately, this is where our journey ends. However, you could always define a special function, so that's exactly what I'm gonna do!
$$ \textrm{Wi}(x) := \int_{1}^{x} W(\ln(\xi)) \textrm{d}\xi $$
And now, we can finally clean things up:
$$ \int e^{v} W'(v) \textrm{d}v = W(v)e^{v} - \textrm{Wi}(z) $$ $$ W(v)e^{v} - \textrm{Wi}(z) = W(v)e^{v} - \textrm{Wi}(e^{v}) $$ $$ W(v)e^{v} - \textrm{Wi}(e^{v}) = ue^{ue^{u}} - \textrm{Wi}(e^{ue^{u}}) $$ $$ ue^{ue^{u}} - \textrm{Wi}(e^{ue^{u}}) = (t\ln(a))e^{(t\ln(a))e^{t\ln(a)}} - \textrm{Wi}(e^{(t\ln(a))e^{t\ln(a)}}) $$
And as always, never forget your constant multiples and +C!
$$ \dfrac{1}{\ln(a)}\left((t\ln(a))e^{(t\ln(a))e^{t\ln(a)}} - \textrm{Wi}(e^{(t\ln(a))e^{t\ln(a)}})\right) + C $$
Edit 2: This needs a bit more tidying up...
$$ ta^{ta^{t}} - \dfrac{1}{\ln(a)}\textrm{Wi}(a^{ta^{t}}) + C $$
Edit 3: I made a slight error when doing IBP; I added the integral part instead of subtracting it. Oops.