Series expansion gives incorrect result - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-09-22T05:20:15Z https://mathematica.stackexchange.com/feeds/question/163423 https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/163423 6 Series expansion gives incorrect result Carlo Beenakker https://mathematica.stackexchange.com/users/19575 2018-01-10T09:35:28Z 2018-03-15T00:56:33Z <p><strong>Bug introduced after 10.4 and persisting through 11.3.0</strong></p> <hr> <p>Mathematica 11.1.1.0 tells me that</p> <pre><code>In: Series[(x - Sqrt[1 + x^2*a*Conjugate[a]])/ (x + Sqrt[1 + x^2*a*Conjugate[a]]), {x, Infinity, 0}] Out: 1 + O[1/x]^1 </code></pre> <p>instead of the correct answer $$\lim_{x\rightarrow\infty}\frac{x-\sqrt{1+x^2|a|^2}}{x+\sqrt{1+x^2|a|^2}}=\frac{1-|a|}{1+|a|}.$$</p> <p>I can get the right answer if I replace <code>a*Conjugate[a]</code> by <code>Abs[a]^2</code> but that should not make a difference. Replacing <code>a*Conjugate[a]</code> by <code>a^2</code> still gives the wrong answer.</p> <p>Q: Is this a known/predictable issue with <code>Series</code> and how can I avoid this? (Using <code>Limit</code> instead of <code>Series</code> is one suggested work around.)</p> https://mathematica.stackexchange.com/questions/163423/-/163429#163429 1 Answer by Mariusz Iwaniuk for Series expansion gives incorrect result Mariusz Iwaniuk https://mathematica.stackexchange.com/users/26828 2018-01-10T10:41:46Z 2018-01-10T12:35:34Z <pre><code>$Version (* 11.2.0 for Microsoft Windows (64-bit) (September 11, 2017)*) </code></pre> <p>.</p> <pre><code>Series[(x - Sqrt[1 + x^2*a*Conjugate[a]])/(x + Sqrt[1 + x^2*a*Conjugate[a]]), {x, Infinity, 0}]//Normal (* 1 + a Conjugate[a] *) ? </code></pre> <p>Adding assumptions:</p> <pre><code>Series[(x - Sqrt[1 + x^2*a*Conjugate[a]])/(x + Sqrt[1 + x^2*a*Conjugate[a]]), {x, Infinity, 0}, Assumptions -&gt; {a != 0}] (* 1 + a Conjugate[a] *) ? </code></pre> <p>.</p> <p>Adding <code>Assumptions -&gt; {a != 0}</code> solved the problem in case if I replace <code>a*Conjugate[a]</code> by <code>Abs[a]^2</code>.</p> <pre><code>Series[(x - Sqrt[1 + x^2*Abs[a]^2])/(x + Sqrt[1 + x^2*Abs[a]^2]), {x, Infinity, 0}, Assumptions -&gt; {a != 0}] </code></pre> <blockquote> <p>$$\frac{1-\left| a\right| }{1+\left| a\right| }+O\left(\left(\frac{1}{x}\right)^1\right)$$</p> </blockquote> <p>In Mathematica 10.2 gives:</p> <pre><code>Series[(x - Sqrt[1 + x^2*a*Conjugate[a]])/(x + Sqrt[1 + x^2*a*Conjugate[a]]), {x, Infinity, 0}] // Normal // FullSimplify // Together </code></pre> <blockquote> <p>$\frac{1-\left| a\right| }{1+\left| a\right| }$</p> </blockquote> <p>With Assumptions:</p> <pre><code>Series[(x - Sqrt[1 + x^2*a*Conjugate[a]])/(x + Sqrt[1 + x^2*a*Conjugate[a]]), {x, Infinity, 0}, Assumptions -&gt; a != 0] // Normal // FullSimplify // Together </code></pre> <blockquote> <p>$\frac{1-\left| a\right| }{1+\left| a\right| }$</p> </blockquote> https://mathematica.stackexchange.com/questions/163423/-/163443#163443 2 Answer by Michael E2 for Series expansion gives incorrect result Michael E2 https://mathematica.stackexchange.com/users/4999 2018-01-10T13:45:06Z 2018-01-10T13:45:06Z <p>At first I thought the issue was that there wasn't an assumption built in that says$a\,\bar a\$ is a nonnegative real. </p> <pre><code>Series[(x - Sqrt[1 + x^2*a*Conjugate[a]])/(x + Sqrt[1 + x^2*a*Conjugate[a]]), {x, ∞, 0}, Assumptions -&gt; a*Conjugate[a] &gt;= 0] (* SeriesData[x, DirectedInfinity, {(1 - Abs[a])/(1 + Abs[a])}, 0, 1, 1] *) </code></pre> <p>But after further investigation, it seems the proper way to view the issue is that the assumption that <code>x</code> is positive is probably not made at some critical point: </p> <pre><code>Series[ (x - Sqrt[1 + x^2*a*Conjugate[a]])/(x + Sqrt[1 + x^2*a*Conjugate[a]]), {x, Infinity, 0}, Assumptions -&gt; x &gt; 0] (* SeriesData[x, DirectedInfinity, {(1 - (a Conjugate[a])^Rational[1, 2])/(1 + (a Conjugate[a])^Rational[1, 2])}, 0, 1, 1] *) </code></pre> <p>Note that the following is a simpler example with the same bug:</p> <pre><code>Series[(x - Sqrt[1 + x^2*z])/(x + Sqrt[1 + x^2*z]), {x, Infinity, 0}] (* SeriesData[x, DirectedInfinity, {1 + z}, 0, 1, 1] (wrong) *) Limit[(x - Sqrt[1 + x^2*z])/(x + Sqrt[1 + x^2*z]), x -&gt; Infinity] (* (1 - Sqrt[z])/(1 + Sqrt[z]) *) </code></pre>