Intereting Posts

Positive Integers Equation
Is there an exact term for $\sqrt{2+\sqrt{4+\sqrt{8+\dots}}}$
Combinatorial interpretation of Fermat's Last Theorem
The complex structure of a complex torus
On what interval does a Taylor series approximate (or equal?) its function?
How can I find an upper bound for the radius of an arc, given arc length and chord length?
How to prove convex+concave=affine?
Is every finitely generated module Noetherian?
Geometric interpretation of the multiplication of complex numbers?
What is the definition of tensor contraction?
How to integrate $ \int_0^\infty \sin x \cdot x ^{-1/3} dx$ (using Gamma function)
I need help to advance in the resolution of that limit: $ \lim_{n \to \infty}{\sqrt{\frac{n!}{n^n}}} $
Where is the topology hiding in this theorem on entire functions?
What would be the shortest path between 2 points when there are objects obstructing the straight path?
A variation of the urn-ball model

If $ x $ and $ y $ have $ n $ significant places, how many significant places do $ x + y $, $ x – y $, $ x \times y $, $ x / y $, $ \sqrt{x} $ have?

I want to evaluate expressions like $ \frac{ \sqrt{ \left( a – b \right) + c } – \sqrt{ c } }{ a – b } $ to $ n $ significant places, where $ a $, $ b $, $ c $ are nonnegative integers. I was thinking about doing it recursively, i.e., if want to evaluate $ x / y $ to $ n $ places, I need to evaluate $ x $, $ y $ to $ m $ places, if want to evaluate $ x – y $ to $ n $ places, I need to evaluate $ x $, $ y $ to $ m $ places…

What book should I be reading?

- Elliptic integrals with parameter outside $0<m<1$
- What is a nice way to compute $f(x) = x / (\exp(x) - 1)$?
- how to solve $aX+bX^2=e^{cX}$
- Given the Cauchy's problem: $y'' = 1, y(0) = 0, y'(0) = 0$. Why finite difference method doesn't agree with recurrence equation?
- Discretization of an integral
- Fast Matlab Code for hypergeometric function $_2F_1$

- Show $p$ prime s.t. $p \not\equiv 1 \mod 3$ is represented by the binary quadratic equation.
- Simple numerical methods for calculating the digits of $\pi$
- Consider a symmetric positive definite $n \times n$ matrix $A$?How to show then entry $u_{kk}$ of $U$ has $u_{kk}=\frac{det(A_k)}{det(A_{k-1})}$?
- If $n^2+4n+10$ is a perfect square, then find the possible integer values of $n$.
- Show that the LU decomposition of matrices of the form $\begin{bmatrix}0& x\\0 & y\end{bmatrix}$ is not unique
- What is a nice way to compute $f(x) = x / (\exp(x) - 1)$?
- resources to study PDE from
- What is the difference between Hensel lifting and the Newton-Raphson method?
- Iterated means $a_{n+1}=\sqrt{a_n \frac{b_n+c_n}{2}}$, $b_{n+1}$ and $c_{n+1}$ similar, closed form for general initial conditions?
- Closed form for the limit of the iterated sequence $a_{n+1}=\frac{\sqrt{(a_n+b_n)(a_n+c_n)}}{2}$

Let us look at your specific example, because it is very interesting. We want to evaluate

$$\frac{\sqrt{(a-b)+c}-\sqrt{c}}{a-b},$$

where $a$, $b$, and $c$ are integers. There can be serious loss of precision if $c$ is huge and $a$ and $b$ are very close to each other.

However, there is a straightforward workaround. Suppose that $c$ is very large and $|a-b|$ is small, the kind of situation that can lead to catastrophic loss of precision.

Imagine multiplying “top” and “bottom” by $\sqrt{(a-b)+c} +\sqrt{c}.$

After a small amount of algebra, we obtain

$$\frac{1}{\sqrt{(a-b)+c}+\sqrt{c}}.$$

Our new expression no longer involves subtracting nearly equal very large numbers. There is no longer any substantial loss of precision issue.

**Comment**: The expression you mentioned is very close to the kind of expression we obtain when solving the quadratic equation $ax^2+bx+c=0$. (Of course $a$, $b$, and $c$ no longer have the same meaning as in your example.)

The familiar **Quadratic Formula**

$$\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$

can give numerical evaluation issues when $|4ac|$ is very small in comparison with $|b|$.

Multiply “top” and “bottom” by $-b\mp\sqrt{b^2-4ac}$. After the smoke clears, we obtain

$$\frac{2c}{-b \mp \sqrt{b^2-4ac}}.$$

So we have a new formula for solving the quadratic equation. This formula is sometimes called the **Citardauq Formula**.

Suppose that our quadratic equation has two real roots, and $|4ac|$ very small compared to $b^2$. If we want to find the larger root, use the Quadratic Formula. For the smaller root, we get less, sometimes much less, loss of precision by using the Citardauq Formula.

In general, when we are planning a computation, it is very important to set things up so that the standard precision issues do not arise. Numerical differentiation is particularly problematic. And even something as simple as row reduction can give problems if we use blindly the process taught in first Linear Algebra courses.

$x\times y$, $x/y$, and $\sqrt{x}$ all have $n$ significant places. $x+y$ and $x-y$ can have up to $n$ significant places, but depending on cancellation, one of them might have fewer. For example, suppose we know both $\pi$ and $22/7$ to $6$ significant places. We only know $22/7-\pi$ to $3$ significant places: $3.14286-3.14159=0.00127$. However, we know $22/7+\pi$ to $6$ significant places:

$3.14286+3.14159=6.28445$

$ \left[ a , b \right] + \left[ c , d \right] = \left[ a + c , b + d \right] $

$ \left[ a , b \right] – \left[ c , d \right] = \left[ a – d , b – c \right] $

$ \left[ a , b \right] \times \left[ c , d \right] = \left[ \min \left( a \times c , a \times d , b \times c , b \times d \right) , \max \left( a \times c , a \times d , b \times c , b \times d \right) \right] $

If $ 0 \notin \left[ c , d \right] $, then $ \left[ a , b \right] / \left[ c , d \right] = \left[ \min \left( a / c , a / d , b / c , b / d \right) , \max \left( a / c , a / d , b / c , b / d \right) \right] $

If $ a \geq 0 $, then $ \sqrt { \left[ a , b \right] } = \left[ \sqrt a , \sqrt b \right] $

$ a \approx a ^ { \prime } $ to $ n $ decimal significant places after the period if and only if $ a \in \left[ a ^ { \prime } – 5 \times 10 ^ { – \left( n + 1 \right) }, a ^ { \prime } + 5 \times 10 ^ { – \left( n + 1 \right) } \right) $, assuming I’m rounding half up.

If $ a \approx a ^ { \prime } $, $ b \approx b ^ { \prime } $ to $ n + 1 $ decimal significant places after the period, then $ a + b \approx a ^ { \prime } + b ^ { \prime } $, $ a – b \approx a ^ { \prime } – b ^ { \prime } $ to $ n $ decimal significant places after the period because $ a + b $ $ \in \left[ a ^ { \prime } – 5 \times 10 ^ { – \left( \left( n + 1 \right) + 1 \right) } + b ^ { \prime } – 5 \times 10 ^ { – \left( \left( n + 1 \right) + 1 \right) } , a ^ { \prime } + 5 \times 10 ^ { – \left( \left( n + 1 \right) + 1 \right) } + b ^ { \prime } + 5 \times 10 ^ { – \left( \left( n + 1 \right) + 1 \right) } \right) $ $ = \left[ a ^ { \prime } + b ^ { \prime } – 10 ^ { – \left( n + 1 \right) } , a ^ { \prime } + b ^ { \prime } + 10 ^ { – \left( n + 1 \right) } \right) $ $ \subset \left[ a ^ { \prime } + b ^ { \prime } – 5 \times 10 ^ { – \left( n + 1 \right) }, a ^ { \prime } + b ^ { \prime } + 5 \times 10 ^ { – \left( n + 1 \right) } \right) $, $ a – b $ $ \in \left[ a ^ { \prime } – 5 \times 10 ^ { – \left( \left( n + 1 \right) + 1 \right) } – \left( b ^ { \prime } + 5 \times 10 ^ { – \left( \left( n + 1 \right) + 1 \right) } \right) , a ^ { \prime } + 5 \times 10 ^ { – \left( \left( n + 1 \right) + 1 \right) } – \left( b ^ { \prime } – 5 \times 10 ^ { – \left( \left( n + 1 \right) + 1 \right) } \right) \right) $ $ = \left[ a ^ { \prime } – b ^ { \prime } – 10 ^ { – \left( n + 1 \right) } , a ^ { \prime } – b ^ { \prime } + 10 ^ { – \left( n + 1 \right) } \right) $ $ \subset \left[ a ^ { \prime } – b ^ { \prime } – 5 \times 10 ^ { – \left( n + 1 \right) }, a ^ { \prime } – b ^ { \prime } + 5 \times 10 ^ { – \left( n + 1 \right) } \right) $. So, to calculate $ a + b $ to $ n $ decimal significant places after the period, I need to first calculate $ a $, $ b $ to $ n + 1 $ decimal significant places after the period.

I’m still working on multiplication, division, root. My brain is frying…

- Does an irreducible operator generate an exact $C^{*}$-algebra?
- How generalize the alternating Möbius function?
- Brownian motion martingale
- Plotting the locus of points equidistant from a point
- Preservation of Lipschitz Constant by Convolutions
- Diffeomorphisms and Stokes' theorem
- How to convert the general form of ellipse equation to the standard form?
- How can I show that $f$ must be zero if $\int fg$ is always zero?
- For $f$ continuous, show $\lim_{n\to\infty} n\int_0^1 f(x)x^n\,dx = f(1).$
- Create unique number from 2 numbers
- Scaling at an arbitrary point and figuring out the distance from origin
- Prove $n^2(n^4-1)$ is divisible by 60 using Mathematical Induction.
- Compute $\int_0^\infty\frac{\cos(xt)}{1+t^2}dt$
- Integral involving Modified Bessel Function of the First Kind
- For every continuous function $f:\to$ there exists $y\in $ such that $f(y)=y$