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
Mathematica? Actually I have two other terms! – Perfect Fluid Oct 19 '19 at 13:18term2). Would you plz see it too? tnx. – Perfect Fluid Oct 19 '19 at 14:08term2is not very different fromtermand can also be expressed with the same functionf[z]. – Roman Oct 19 '19 at 14:55