Questions tagged [catastrophic-cancellation]

For questions about catastrophic cancellation, the devastating loss of precision when small numbers are computed from large numbers, which themselves are subject to roundoff error.

Filter by
Sorted by
Tagged with
5
votes
0answers
71 views

Transforming sum with alternating signs into something less prone to catastrophic cancellation

I'm wrestling with this formula, formally a function of the vector $\pmb{F}$: $$\begin{aligned} S(\pmb{F}) &:=\sum_{a=0}^A (-1)^{A-a}\,\binom{A}{a}\, \Biggl[\sum_{b=0}^{A} F_b \, \binom{a}{b}\Big/\...
3
votes
3answers
235 views

Avoiding catastrophic cancellation with $\sqrt{1+x} - 1$ for $x$ close to $0$

I'm trying to figure out how to avoid catastrophic cancellation for the following expression $$\sqrt{1+x} - 1$$ for $x$ being a number very close to $0$. Of course, the answer would come to $0$ ...
3
votes
2answers
85 views

Catastrophic cancellation problem: what is the relative error of this computation?

My book has the following problem (which is part of our ungraded homework in numerical analysis): Assume that you are solving the quadratic equation $ax^2 + bx + c = 0$, with $a = 1.22$, $b = 3.34$,...
1
vote
1answer
37 views

Loss of Significance in Experiment

I am quite familiar with the problem associated with loss of significance in numerical analysis. This problem seems to be an even bigger problem in the science lab, where subtracting one physical ...
2
votes
0answers
66 views

Avoid Catastrophic Cancellation for difference between sines [duplicate]

Is there a way to rewrite $\sin(x)-\sin(y)$ that avoids catastrophic cancellation when $x \rightarrow y$? I've tried to rewrite it using trigonometric identities such as $$\sin(x)-\sin(y)=2*\cos\...
1
vote
0answers
55 views

How do I fight loss of significance and/or improve convergence for this recursive algorithm?

While trying to answer this question I used the series approach and obtained a recursive algorithm. While checking it numerically, I found it suffering from "catastrophic cancellation", i.e. loss of ...
9
votes
3answers
832 views

Avoiding numerical cancellation question for $\sin x -\sin y$ for $x \approx y$

When trying to avoid cancellation, one tries to reformulate the equation in order to avoid subtraction between almost equal terms. In $\sin (x) - \sin (y), x \approx y$ the suggested solution is to ...
5
votes
1answer
190 views

Explain this amazing cancellation of 4 terms to 40 digits

Define the following four rational numbers. $$ a = \frac{4243257079864535154162785598448178442416}{41016602865234375} \\ b = -\frac{143308384621912247542172258992236503771301}{1210966757832031250} \\ ...
6
votes
1answer
175 views

how do you compute $\|c-a\| - \|b-a\|$ without catastrophic cancellation?

Given three points or vectors in the plane: \begin{align} \vec a &= (a_x,a_y) \\ \vec b &= (b_x,b_x) \\ \vec c &= (c_x,c_y) \end{align} How do you compute $\lVert \vec c - \vec ...
12
votes
3answers
8k views

How does rewriting $x^2 -y^2$ as $(x+y)(x-y)$ avoid catastrophic cancellation?

Why is rewriting $x^2 -y^2$ as $(x+y)(x-y)$ a way to avoid catastrophic cancellation? We are still doing $(x-y)$. Is it because the last operation in the second form is a multiplication?