# InverseFunction: Precision problem

I define a function SS[t] as an inverse function:

tt[S_] := 10(2Sqrt[(1-S)S] +14/5 ArcTan[Sqrt[S], Sqrt[1-S]] +
2/5 ArcTanh[1/2 Sqrt[(1-S)/S]]);
SS = InverseFunction[tt];
N[SS[53], 60]
(* 0.200580902656825260833989366151287711207279221292307930697890 *)


SS[t] works great up to t=53: it's fast, I get a precision of 60, and I can plug it back into the original (forward) function.

PROBLEM:

Starting at t=54, it's very slow, and the output is way wrong, complex and wrong magnitude. (It should be real and in [0.2, 0.2006]).

STUFF I TRIED:

• The forward function works well for inputs S=0.2+$$\epsilon$$ ($$\epsilon$$ very small, like $$10^{-10}$$), giving tt[$$\cdot$$] up to 500, no problem.

• $MinPrecision=0,$MaxPrecision=$$\infty$$ (defaults).

• Increasing N[$$\cdot$$,60] to N[$$\cdot$$,100] makes no difference.

I use Mathematica 8.0.4 on MacOS, installed... 5 years ago?

LATER EDIT:

I ended up implementing my own iterative inverse, which is easy in this case, as the forward function is well behaved and monotonic. It's very fast, and I can get any precision I like.

Still, I find disturbing the lack of control over InverseFunction, and I get that sense of unease when I cannot fully trust a component. Perhaps there is a way to take control that I'm aware of, so I am still interested in an answer.

• Version 12.1 Windows 10. Works up to t=60. But from t=61 on it is as you describe. Mar 2, 2021 at 16:20
• A series-expansion of tt[S] around $S=1/5$ can be inverted in a more stable manner. Mar 2, 2021 at 16:23

Workaround using: FindRoot.

mm[t_, P_] := (S /.
FindRoot[(10 (2 Sqrt[(1 - S) S] +
14/5 ArcTan[Sqrt[S], Sqrt[1 - S]] +
2/5 ArcTanh[1/2 Sqrt[(1 - S)/S]])) == 500, {S, 211/1000},
WorkingPrecision -> P, MaxIterations -> 1000]) // Re

mm[500, 110](*For t=500 and WorkingPrecision= 110*)

(*0.20000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000005027331563*)