2
$\begingroup$

Update

This bug has been fixed in v11.3.0. And as @Carl Woll has pointed out, the imaginary part of Sin and negative sign of Cos are due to the selections of different branch cuts.

Original Post

v11.2.0.0 on Windows 10, 64bit, check this:

InverseFunction /@ {f[#] &, f[2 #] &, f[#/2] &, f[# + 1] &} 
/. {{f -> Sinh}, {f -> Cosh}, {f -> Tanh}, {f -> Coth}} // TableForm

The result is only correct for Coth case; Sinh picks up an imaginary part, Cosh adds an negative sign, Tanh entangles with ArcCoth instead of ArcTanh.

enter image description here

This is really a disturbing error. Can someone explain this behavior?

$\endgroup$
3
$\begingroup$

The results for Sinh and Cosh are not incorrect. All of your functions have multi-valued inverses, so you're seeing Mathematica choose different branches than you were expecting. For example:

x = Sinh[2 3.]
y = 1/2 (I Pi - ArcSinh[#])&[x]
Sinh[2 y]

201.713

-3. + 1.5708 I

201.713 + 2.4703*10^-14 I

If you want to restrict to real inverses, you could use ConditionalExpression:

if = InverseFunction[ConditionalExpression[Sinh[2 #], # ∈ Reals]&];

Then:

if[Sinh[2 3.]]

3.

On the other hand, I do think the results for Tanh are incorrect. It would be worth reporting the issue to support. In particular, I think the following demonstrates the issue:

if = InverseFunction[Tanh[2#]&]

x = Tanh[2 .1`30]
y = if[x]
Tanh[2 y]

InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses.

ArcCoth[#1]/2 &

0.197375320224904000738157318811

0.100000000000000000000000000000 - 0.785398163397448309615660845820 I

5.0664895634394727136317877883 + 0.*10^-30 I

The output of Tanh[2 y] should be the same as x. Again, you can work around the issue by including a ConditionalExpression wrapper:

if = InverseFunction[ConditionalExpression[Tanh[2#], # ∈ Reals]&]

x = Tanh[2 .1`30]
y = if[x]
Tanh[2 y]

ConditionalExpression[ArcTanh[#1]/2, -1 < #1 < 1] &

0.197375320224904000738157318811

0.100000000000000000000000000000

0.197375320224904000738157318811

$\endgroup$
  • $\begingroup$ Thanks. But what about Tanh etc? $\endgroup$ – luyuwuli Jan 8 '18 at 18:29
  • $\begingroup$ @luyuwuli See update. I do think you found an issue with Tanh. $\endgroup$ – Carl Woll Jan 8 '18 at 18:48
  • $\begingroup$ Thank you very much. I've already report this issue to the official feedback. $\endgroup$ – luyuwuli Jan 8 '18 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.