5
$\begingroup$

Bug introduced in 5.0 or earlier and fixed in 11.1.1


Define variable z with the following assumptions

$Assumptions = 0 < z < 1

I put in the following two codes in Mathematica

t1 = Simplify[Series[ArcTanh[(1 - Sqrt[z])^2], {z, 0, 3}]]

t2 = Simplify[Series[ArcTanh[(1 - Sqrt[z])^2] // TrigToExp, {z, 0, 3}]]

The codes are identical to each other except for the extra TrigToExp. Yet, the outputs are completely different

$$t_1 = -\frac{\log (z)}{4}-\frac{\sqrt{z}}{4}+\frac{z}{16}+\frac{5 z^{3/2}}{48}+\frac{z^2}{16}+\frac{z^{5/2}}{40}+O\left(z^{7/2}\right) ~~~~~~~~~~~~~~~\\ t_2 = -\frac{\log (z)}{4}-\frac{\sqrt{z}}{4}+\frac{z}{16}+\frac{5 z^{3/2}}{48}+\frac{9 z^2}{128}+\frac{9 z^{5/2}}{320}+\frac{z^3}{768}+O\left(z^{7/2}\right) $$

Why are the two results different and which result should I trust?

$\endgroup$
  • 1
    $\begingroup$ Just add a few more terms Series[... {z,0,7}] you will see that the two Series will diverge only for the higher order terms. The first expression without TrigToExp seems to converge faster to the correct values. $\endgroup$ – grbl Dec 2 '16 at 23:59
  • $\begingroup$ You can wrap Assuming around those series Assuming[0 < z < 1, t1 = Simplify[Series[ArcTanh[(1 - Sqrt[z])^2], {z, 0, 3}]]] instead of setting a global variable like $Assumptions. $\endgroup$ – bobbym Dec 3 '16 at 1:11
  • $\begingroup$ @grbl - if you write that up i'll choose it as the answer. Thanks! $\endgroup$ – Prahar Dec 3 '16 at 17:16
  • 3
    $\begingroup$ There is indeed a problem with the direct (as opposed to TrigToExp'ed) version. Looking into it. $\endgroup$ – Daniel Lichtblau Dec 5 '16 at 20:34
4
$\begingroup$

The which one can you trust, can be answered by plotting the error,

$$\left |\tanh ^{-1}\left(\left(1-\sqrt{z}\right)^2\right)-\text{t1} \right | \text{ and } \left |\tanh ^{-1}\left(\left(1-\sqrt{z}\right)^2\right)-\text{t2} \right |$$

t1 = Simplify[Series[ArcTanh[(1 - Sqrt[z])^2], {z, 0, 3}]] //Normal;

t2 = Simplify[Series[ArcTanh[(1 - Sqrt[z])^2] // TrigToExp, {z, 0, 3}]] //Normal;

Plot[{Abs[ArcTanh[(1 - Sqrt[z])^2] - t1], 
  Abs[ArcTanh[(1 - Sqrt[z])^2] - t2]}, {z, 0, 1}, 
 PlotStyle -> {Blue, Green}, PlotLabels -> {"f(z)-t1", "f(z)-t2"}]

enter image description here

Looks like t2 would be my choice for 0 < z < 1 / 2 and t1 for the rest.

$\endgroup$
  • $\begingroup$ You are welcome. $\endgroup$ – bobbym Dec 3 '16 at 17:30

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.