1

I've got a division of the sort

$$\frac{a}{a+b}$$

which is for some reason rewritten as $$\frac{1}{1+\frac{b}{a}}$$ for numerical stability. But why would this be more stable and how do they rewrite the first formula into the second one?

mrtaurho
  • 16,103
  • 2
    Divide by $a$ numerator and denominator – JoseSquare Dec 30 '19 at 15:38
  • Observe $\frac{a}{a+b}=\frac{a}{a\left(1+\frac ba\right)}=\frac aa\frac1{1+\frac ba}=\frac1{1+\frac ba}$. Don't know anything concerning numercial stability. – mrtaurho Dec 30 '19 at 15:38
  • [This has nothing to do with algebraic number theory, so I have deleted that tag] – almagest Dec 30 '19 at 15:39
  • 3
    There should be a context to this problem. What are approximately the sizes of $a$ and $b$? – WhatsUp Dec 30 '19 at 15:40
  • @WouterVandenputte what do you mean by numerical stability exactly? are you talking about stability in numerical differential equations or in linear algebra? –  Dec 30 '19 at 15:42
  • There is also a disadvantage: the second form is not defined if $a=0$. I am not familiar with "numerical stability". – drhab Dec 30 '19 at 15:45

2 Answers2

1

$$\frac a{a+b}=\frac a{a+b}\cdot \dfrac {\frac 1a}{\frac 1a}=\frac 1{1+\frac ba}$$ I don't see any reason the two forms should differ in numerical stability. The usual problem is subtraction of two nearly equal quantities, so here if $a \approx -b$ you have a problem. The division of the numerator and denominator by $a$ does not change that because then $\frac ba \approx -1$.

Ross Millikan
  • 374,822
0

If this is eventually implemented in computer code, there could be limits to the values of intermediate results which make one more stable than the other, depending on the values of $a$ and $b$.

johnnyb
  • 3,509