# How to convert this term to a Hypergeometric function?

term=8*(-1)^(1/4)*Sqrt[b]*q0^(3/2)*\[Kappa]*
EllipticF[I*ArcSinh[((-1)^(1/4)*Sqrt[b]*r)/Sqrt[q0]], -1]

1. This is a physical term and it is not convenient to appear $$I$$ (complex number) in the solutions. How can I convert this term to a more familiar function (in my field) like $$Hypergeometric$$ one, without any imaginary number? Is it possible?

2. Moreover, how can I expand this term using Series[term,{b,Infinity,0}]? The assumptions are: $$q0$$ and $$b$$ are real parameters, $$r>0$$, and $$\kappa>0$$.

3. As the final question, how about these terms (in the form of Hypergeometric and its expansion series about $$\infty$$.):

term2=((4/3 + (4*I)/3)*Sqrt[b]*G*Pi^(1/4)*Q^(5/2)*
Sqrt[1 + (4*b^2*Pi*r^4)/Q^2]*
EllipticF[I*ArcSinh[((1 + I)*Sqrt[b]*Pi^(1/4)*r)/Sqrt[Q]],
-1])/(r*Sqrt[Q^2 + 4*b^2*Pi*r^4])

term3=- (I*b*E^(b^2*C[1])*Sqrt[1 - r^4/E^(2*b^2*C[1])]*
EllipticF[I*ArcSinh[Sqrt[-E^(-(b^2*C[1]))]*r], -1])/
(Sqrt[-E^(-(b^2*C[1]))]*Sqrt[E^(2*b^2*C[1]) - r^4])


For your first question, if we gather the factors into a single variable z, there's a simple hypergeometric function:

f[z_] = (-1)^(1/4) EllipticF[I ArcSinh[(-1)^(1/4) z], -1];
g[z_] = -z Hypergeometric2F1[1/4, 1/2, 5/4, -z^4];


These two functions are the same, even though FullSimplify cannot prove it:

Series[f[z] - g[z], {z, 0, 100}]
(* O[z]^101 *)

Plot[Abs[f[z] - g[z]], {z, -1, 1}]


term == 8 Sqrt[b] q0^(3/2) κ f[(Sqrt[b] r)/Sqrt[q0]]
(* True *)


The series expansion follows from the hypergeometric function:

Assuming[r > 0 && Element[q0, Reals],
Series[8 Sqrt[b] q0^(3/2) κ g[(Sqrt[b] r)/Sqrt[q0]], {b, ∞, 0}] //FullSimplify]
(* the series expansion *)


The second term can be expressed in terms of the same function $$f(z)$$:

Assuming[Q > 0,
term2 == (4 Sqrt[2] Sqrt[b] G π^(1/4) Q^(3/2))/(3 r) *
f[(Sqrt[2] Sqrt[b] π^(1/4) r)/Sqrt[Q]] // FullSimplify]
(* True *)


The third term too:

Assuming[Element[{b, C[1]}, Reals],
term3 == -b E^((b^2 C[1])/2) (-1)^(-1/4) *
f[(-1)^(1/4) Sqrt[E^(-b^2 C[1])] r] // FullSimplify]
(* True *)


## update: derivation

This is how I found the hypergeometric expression. Start with a series expansion around $$z=0$$,

f[z_] = (-1)^(1/4) EllipticF[I ArcSinh[(-1)^(1/4) z], -1];
Series[f[z], {z, 0, 50}]
(* -z  + z^5/10 - z^9/24 + 5*z^13/208 - ... *)


We see that all terms are of the form $$z^{1+4n}$$ with integer $$n$$. The series coefficients are

Table[{n, SeriesCoefficient[f[z], {z, 0, 1 + 4 n}]}, {n, 0, 10}]
(* {{0, -1}, {1, 1/10}, {2, -1/24}, {3, 5/208}, {4, -35/2176},
{5, 3/256}, {6, -231/25600}, {7, 429/59392}, {8, -195/32768},
{9, 12155/2424832}, {10, -46189/10747904}} *)


Find a closed-form expression for these coefficients:

FindSequenceFunction[%, n]
(* ((-1)^(1 + n) Pochhammer[1/2, n])/((-3 + 4 (1 + n)) Pochhammer[1, n]) *)


Sum them to infinity to find a hypergeometric expression:

Sum[% z^(1 + 4 n), {n, 0, ∞}]
(* -z Hypergeometric2F1[1/4, 1/2, 5/4, -z^4] *)

• Dear @Roman, would you please introduce a reference or maybe a convert command in Mathematica? Actually I have two other terms! – Perfect Fluid Oct 19 '19 at 13:18
• @PerfectFluid yes, see update. – Roman Oct 19 '19 at 13:47
• Amazing derivation! – yarchik Oct 19 '19 at 13:59
• @Roman: I added another term (term2). Would you plz see it too? tnx. – Perfect Fluid Oct 19 '19 at 14:08
• @PerfectFluid see above: term2 is not very different from term and can also be expressed with the same function f[z]. – Roman Oct 19 '19 at 14:55

Match up power series and solve for parameters for Hypergeometric2F1[a, b, c, d x]:

ClearAll[reduce2F1, iReduce2F1];
Options[reduce2F1] = {"ExtraTerms" -> 2};
reduce2F1[expr_, x_, opts : OptionsPattern[]] :=
reduce2F1[expr, x, True, OptionsPattern[]];
reduce2F1[expr_, x_, assum_: True, OptionsPattern[]] :=
With[{res = iReduce2F1[expr, x, assum, OptionValue["ExtraTerms"]]},
res /; FreeQ[res, $$Failed]]; reduce2F1[expr_, __] := expr; iReduce2F1[expr_, x_, assum_, xtra_] := Module[{deg, coeffs, redcoeffs, varcoeff, power, commonfactor, ni, nn, den, h2f1, res, a, b, c, d}, deg = 4; While[ Total@ Replace[ Series[expr, {x, 0, deg}][[3]], {0 -> 0, _ -> 1}, 1] < 5 + xtra && deg < 100, deg++]; {coeffs, ni, nn, den} = (List @@ Series[expr, {x, 0, deg}, Assumptions -> assum])[[3 ;; 6]]; coeffs = Simplify[coeffs, assum]; Quiet@ Check[ {{power}} = DeleteDuplicates@ Differences@ SparseArray[coeffs]["NonzeroPositions"], Return[$$Failed, Module]];
redcoeffs = DeleteCases[coeffs, 0];
varcoeff = Times @@ Intersection @@
Replace[
Replace[Ratios@redcoeffs, {p_Times :> List @@ p, n_ :> {n}}, 1],
z_?NumericQ /; Negative[z] :> Sequence[-1, -z], 2];
redcoeffs = redcoeffs/varcoeff^(Range[0, Length@coeffs, power]/power) //
Simplify[#, assum] &;
commonfactor = redcoeffs[[1]];
redcoeffs = redcoeffs/commonfactor;
h2f1 = Solve[redcoeffs[[2 ;; 5 + xtra]] ==
Series[Hypergeometric2F1[a, b, c, d x], {x, 0, 5 + xtra - 1}][[3, 2 ;; 5 + xtra]]
{a, b, c, d}];
If[ListQ[h2f1] && FreeQ[{a, b, c, d} /. h2f1, a | b | c | d],
commonfactor * x^(ni/den) *
(Hypergeometric2F1[a, b, c, d*varcoeff*x^(power/den)] /. First@h2f1),
\$Failed
]
];


Update 3: A simpler approach

It is perhaps simpler to compute a general substitution for the particular replacement of EllipticF[I*ArcSinh[..], -1] with a hypergeometric function, which seems to be common to all the OP's examples:

ClearAll[ellFTo2F1];
ellFTo2F1[EllipticF[I ArcSinh[z_], -1]] =
reduce2F1[EllipticF[I ArcSinh[z], -1], z, True]
ellFTo2F1[e_] := e;

(*  I z Hypergeometric2F1[1/4, 1/2, 5/4, z^4]  *)


Then the following will convert the OP's examples:

expr /. e_EllipticF :> ellFASinh[e] // Simplify[#, <assum>] &


Example:

term3 /. e_EllipticF :> ellFASinh[e] //
Simplify[#, {b, r, C[1]} \[Element] Reals] &

(*  b r Hypergeometric2F1[1/4, 1/2, 5/4, E^(-2 b^2 C[1]) r^4]  *)


Older examples

OP's examples:

hyper = reduce2F1[term, b, q0 > 0 && r > 0]
(*  -8 b q0 r κ Hypergeometric2F1[1/4, 1/2, 5/4, -((b^2 r^4)/q0^2)]  *)

Series[term - hyper, {b, 0, 25}, Assumptions -> q0 > 0 && r > 0]
(*  O[b]^26  *)

hyper2 = reduce2F1[term2, b, Q > 0 && G > 0 && r > 0,
"ExtraTerms" -> 0]
(*  -(8/3) b G Sqrt[π] Q Hypergeometric2F1[1/4, 1/2, 5/4, -((4 b^2 π r^4)/Q^2)]  *)

Series[term2 - hyper2, {b, 0, 25}, Assumptions -> Q > 0 && G > 0 && r > 0]
(*  O[b]^26  *)


The option "ExtraTerms" sets how many terms of the power series beyond the necessary degree 4 for determining a, b, c, d are used to "verify" the reduced expression is a Hypergeometric2F1[a, b, c, d x] function. In other words, there is no guarantee that if reduce2F1 returns a hypergeometric function, it is correct.

Update: The Solve command in reduce2F1 may be replaced by the form

Solve[redcoeffs[[;; 5 + xtra]] ==
Series[e Hypergeometric2F1[a, b, c, d x], {x, 0, 5 + xtra - 1}][[3]],
{e, a, b, c, d}]


Here the parameters d and e replace the need for varcoeff and commonfactor, so the lines from varcoeff =... to ...= redcoeffs/commonfactor may be omitted. This makes the code simpler and easier to understand, imo; however, it runs about about 10% to 60% slower on the OP's examples. (Note: timing is made difficult because Series and Simplify cache results. ClearSystemCache[] is needed to get reliable timings.)

Update 2: The new term31:

Here the argument is E^(-2 b^2 C[1]), which takes a substitution to convert to a variable z. There is an extra factor of b that should not be included in the transformation. In fact, in the substitution bsub, b might be plus or minus the square root, and algebraically it works in this case except for the factor b. One way to handle it is to do the reverse substitution Reverse[bsub] before the inverse substitution zsub:

bsub = b -> Sqrt[Log[1/z]/C[1]];
zsub = z -> E^(-(b^2*C[1]));

hyper3 = term3 /. bsub /. Sqrt[-z] -> I*Sqrt[z] /.
e_EllipticF :> reduce2F1[e, z, r > 0] /. Reverse[bsub] /.
zsub // Simplify[#, {b, r, C[1]} \[Element] Reals] &

(*  b r Hypergeometric2F1[1/4, 1/2, 5/4, E^(-2 b^2 C[1]) r^4]  *)


Alternatively, manually get rid of the b factor, convert, and then multiply by b:

hyper3 = term3/b /. bsub /. Sqrt[-z] -> I*Sqrt[z] /.
e_EllipticF :> reduce2F1[e, z, r > 0] /. zsub //
Simplify[#, {b, r, C[1]} \[Element] Reals] &;
hyper3 = b*hyper3

• Dear @Michael, thank you so much. Your answer was very useful too. However, I couldn't choose both of them :( – Perfect Fluid Oct 20 '19 at 17:35
• @PerfectFluid You're welcome. – Michael E2 Oct 20 '19 at 18:04

This is a slightly simpler version of what Michael and Roman did, through leveraging some knowledge about elliptic integrals. First, some observations (using Roman's simplification):

D[{(-1)^(1/4) EllipticF[I ArcSinh[(-1)^(1/4) z], -1],
-z Hypergeometric2F1[1/4, 1/2, 5/4, -z^4]}, z] // Simplify
{-(1/Sqrt[1 + z^4]), -(1/Sqrt[1 + z^4])}

{(-1)^(1/4) EllipticF[I ArcSinh[(-1)^(1/4) z], -1],
-z Hypergeometric2F1[1/4, 1/2, 5/4, -z^4]} /. z -> 0
{0, 0}


Effectively, we are considering the integral

$$\int_z^0\frac{\mathrm dt}{\sqrt{1+t^4}}$$

I have always complained that Mathematica often needlessly inserts complex numbers in its elliptic integral results even when it can be avoided, and this case is no exception. Using formula 263.50 from Byrd and Friedman instead, we obtain the equivalent result

InverseJacobiCN[(z^2 - 1)/(z^2 + 1), 1/2]/2 - EllipticK[1/2]


As for obtaining a hypergeometric representation, recall the binomial series:

Simplify[SeriesCoefficient[1/Sqrt[1 + z^4], {z, 0, 4 k}], k ∈ Integers && k >= 0]
((-1)^k (-1/2 + k)!)/(Sqrt[π] k!)


Check:

Sum[((-1)^k (-(1/2) + k)!)/(Sqrt[π] k!) z^(4 k), {k, 0, ∞}]
1/Sqrt[1 + z^4]


Integrate termwise:

Sum[((-1)^k (-(1/2) + k)!)/(Sqrt[π] k!) Integrate[t^(4 k), {t, z, 0}], {k, 0, ∞}]
-z Hypergeometric2F1[1/4, 1/2, 5/4, -z^4]


et voilà!

• There is even a simpler analytic answer to your integral (see my post). No need for the theta-function. I do agree with you that MA could have handle elliptic integrals differently. – yarchik Nov 13 '19 at 8:32

Many excellent answers has already been given. They do generate the hypergeometric function. I guess the motivation to know it is computational convenience. But let me represent the final result in even simpler form. Maybe it will be useful for you

$$\int_z^0\frac{1}{\sqrt{1+x^4}}dx=-\frac{1}{2}F\!\left(2 \arctan(z)\,\big|\frac{1}{2}\right).$$

The integral form is taken from the solution of J.M. and is computed with the rubi package

Get["Rubi"]
Int[1/Sqrt[1+t^4],{t,z,0}]
Out[3]= -(((1+z^2) Sqrt[(1+z^4)/(1+z^2)^2] EllipticF[2 ArcTan[z],1/2])/(2 Sqrt[1+z^4]))


Now one can compare this result and the function defined by Roman.

f[z_]=(-1)^(1/4) EllipticF[I ArcSinh[(-1)^(1/4) z],-1]
g[z_]:=-(1/2) EllipticF[2 ArcTan[z],1/2]


The result looks quite simple.

• Indeed, your simpler solution can in fact be derived from mine (modulo a constant term), since FullSimplify[Tan[ArcCos[(z^2 - 1)/(z^2 + 1)]] == Tan[-2 ArcTan[z]] // TrigExpand, 0 < z < 1] yields True`. – J. M.'s technical difficulties Nov 13 '19 at 8:39