Catastrophic cancellation with a specific function

  • Thread starter Thread starter NotEuler
  • Start date Start date
  • Tags Tags
    Function Specific
Click For Summary
SUMMARY

The discussion focuses on the function xy (eax-eay)/(xeax-yeay) and its susceptibility to catastrophic cancellation when x and y are large and close in value. Participants suggest rewriting the function to xy (1-ea(y-x))/(x-yea(y-x)) to mitigate issues. Additionally, a change of variables is recommended, defining y as x + δ, where δ is a small number, to derive a more stable expression. This approach allows for further expansion using Taylor series to address the cancellation problem effectively.

PREREQUISITES
  • Understanding of exponential functions and their properties
  • Familiarity with Taylor series expansion
  • Knowledge of numerical stability and catastrophic cancellation
  • Basic proficiency in mathematical manipulation of functions
NEXT STEPS
  • Research methods to mitigate catastrophic cancellation in numerical computations
  • Learn about Taylor series and its applications in approximating functions
  • Explore numerical analysis techniques for improving computational stability
  • Investigate alternative formulations of functions to enhance precision
USEFUL FOR

Mathematicians, computational scientists, and software developers working on numerical algorithms who need to understand and address issues related to catastrophic cancellation in computations.

NotEuler
Messages
58
Reaction score
2
I've been playing around with this function of two variables:
xy (eax-eay)/(xeax-yeay )
where a is a positive parameter.

Now, when x and y are very large and close to each other in size, this seems to easily lead to catastrophic cancellation and computational problems.

One thing that seems to help a little is to rewrite as follows:
xy (1-ea(y-x))/(x-yea(y-x) )

I haven't really had to deal with catastrophic cancellation issues in the past. I was wondering if there might be a better way to deal with the problem here?
 
Physics news on Phys.org
I have not dealt with catastrophic cancellation either but if x and y are large and close to each other, I would do a change in variables and write ##y=x+\delta## where ##\delta## is a small number. Then$$\frac{xy(e^{ax}-e^{ay})}{xe^{ax}-ye^{ay}}=\frac{e^{ax}x(x+\delta)(1-e^{a\delta}) }{e^{ax}[x-(x+\delta)e^{a\delta}]}=\frac{x(x+\delta)((1-e^{a\delta})}{x-(x+\delta)e^{a\delta}}.$$Up to this point the expression is exact. You can expand it, if you wish, in Taylor series for small ##\delta##. I don't know if this addresses your problem, but that's what I would try first.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
3K
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
6K
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K