Mathematics Asked on December 13, 2021
I need to simplify the following expression in a way that introduces minimal floating point cancellation errors.
$$(1+x^2 )^{frac{1}{2}}-(1-x^2 )^{frac{1}{2}}$$
The errors accumulate when numbers close together are subtracted from each other. I get
$$sqrt{2}left[1-left(1-x^4 right)^{1/2} right]^{1/2}$$
But don’t see how this helps, perhaps there is a better formula?
I will give you another possible simplification for this expression. Let $x=sqrt{cos 2theta}.$ There is a such real $theta$ for all $0le xle 1$ and, for other values of $x$ you can use a suitable complex $theta$ value with some care. Then $$(1+x^2 )^{1/2}-(1-x^2)^{1/2}=sqrt2 (costheta-sintheta)=2sinleft(theta-dfrac{pi}{4}right)$$ (with an appropriate branch of square root).
Answered by Bumblebee on December 13, 2021
I would try this: $$begin{align}(1+x^2 )^{frac{1}{2}}-(1-x^2 )^{frac{1}{2}}&=[(1+x^2 )^{frac{1}{2}}-(1-x^2 )^{frac{1}{2}}]frac{(1+x^2 )^{frac{1}{2}}+(1-x^2 )^{frac{1}{2}}}{(1+x^2 )^{frac{1}{2}}+(1-x^2 )^{frac{1}{2}}}\&=frac{(1+x^2 )-(1-x^2 )}{(1+x^2 )^{frac{1}{2}}+(1-x^2 )^{frac{1}{2}}}\&=frac{2x^2}{(1+x^2 )^{frac{1}{2}}+(1-x^2 )^{frac{1}{2}}}end{align}$$
Answered by Andrei on December 13, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP