Numerically Stable Formulas for x >= 0 and x < 0

In summary, the formulas are stable for x>=0 but not for x<0. To make them stable for negative x values, you can use the absolute value of x in the formula.
  • #1
happyg1
308
0
Hi, here's my question...We have to determine whether or not the formulas down there are numerically stable for the cases where x >=0 and x<0. I say that the formulas are stable for x>=0 but not for x<0 because you are subracting numbers that could be close to each other. My problem is that I am having a really hard time writing a new formula that is numerically stable for negative x values. See if you can point me down the right path.
the formulas are:

u= +-sqrt((x+sqrt(x^2+y^2)))/2)

v=y/2u

Thanks for any help that you can give,
CC
 
Physics news on Phys.org
  • #2
To make the formulas numerically stable for negative x values, you can use a slightly different approach. Instead of subtracting two numbers close to each other, you can use the absolute value of x in the formula. So the new formula would be: u= +-sqrt(|x|+sqrt(x^2+y^2))/2)v=y/2u
 
  • #3


I understand the importance of using numerically stable formulas in calculations. A numerically stable formula is one that produces accurate results even when small changes are made to the input values. In the case of x<0, the existing formulas may not be numerically stable because of the possibility of subtracting numbers that are close in value, leading to potential rounding errors.

To address this issue, we can use a technique called "numerical conditioning" to improve the stability of the formulas. This involves modifying the formulas in a way that minimizes the potential for rounding errors. In this case, we can rewrite the formulas as:

u= sqrt((x+sqrt(x^2+y^2)))/2) for x>=0

u= -sqrt((x+sqrt(x^2+y^2)))/2) for x<0

v=y/2u

By separating the formulas for positive and negative x values, we can avoid the possibility of subtracting numbers that are close in value. This approach should improve the numerical stability of the formulas for all values of x.

However, it is always important to carefully consider the potential for numerical instability when using mathematical formulas, particularly in cases where the input values may vary widely. It may be helpful to perform sensitivity analysis or use alternative methods, such as using a logarithmic transformation, to improve the stability of the calculations. I hope this helps guide you in finding a numerically stable solution for negative x values.
 

Related to Numerically Stable Formulas for x >= 0 and x < 0

What does it mean for a formula to be numerically stable?

Numerical stability refers to the ability of a mathematical formula to produce accurate and reliable results even when small changes are made to the input values.

Why is it important for a formula to be numerically stable?

Having a numerically stable formula ensures that the results obtained from the calculations are not significantly affected by rounding errors or other small variations in the input values. This is crucial for obtaining accurate and reliable data in scientific research.

What are "x >= 0" and "x < 0" conditions in the context of this topic?

In mathematics, "x >= 0" means that x is greater than or equal to 0, and "x < 0" means that x is less than 0. These conditions are often used in formulas to specify the range of values for which the formula will provide accurate and stable results.

How can one ensure that a formula is numerically stable for both "x >= 0" and "x < 0" conditions?

One way to ensure numerical stability for both "x >= 0" and "x < 0" conditions is to use separate formulas for each condition. These formulas should be specifically designed to handle the respective ranges of x values and produce accurate results for both positive and negative values.

Are there any specific techniques or strategies for developing numerically stable formulas?

Yes, there are various techniques and strategies that can be used to develop numerically stable formulas. Some common approaches include using alternative forms of the formula, using well-conditioned computations, and minimizing the number of operations involved in the calculations.

Similar threads

  • Introductory Physics Homework Help
2
Replies
64
Views
2K
  • Introductory Physics Homework Help
Replies
10
Views
2K
  • Introductory Physics Homework Help
Replies
25
Views
1K
  • Introductory Physics Homework Help
Replies
13
Views
2K
  • Introductory Physics Homework Help
2
Replies
40
Views
978
  • Introductory Physics Homework Help
Replies
13
Views
845
  • Introductory Physics Homework Help
Replies
10
Views
548
  • Introductory Physics Homework Help
Replies
4
Views
940
  • Introductory Physics Homework Help
Replies
10
Views
947
  • Introductory Physics Homework Help
Replies
4
Views
901
Back
Top