I want to analyze the stability of this formula $\frac{|x|-|y|}{x-y}$ as $x$ approaches $y$.
But this formula is not a recursion! I used to analyze the stability of recursion by computing the first n terms of this formula.
Like this question: The integral
$$I_n=\int_0^1x^ne^xdx\quad n=0,1,2\cdots$$
suggests a recursion relation obtained by integration by parts:
$$I_n=[x^ne^x]|_0^1-n\int_0^1x^{n-1}e^xdx=e-nI_{n-1}$$
terminating with $I_0=e-1$. However, this algorithm, applied "forwards" for increasing $n$ is numerically unstable since small errors (such as floating-point rounding errors) are magnified at each step: if the error in $I_n$ is $\varepsilon_n$ such that the estimated value of $I_n$ is $I^{'}_n+\varepsilon_n$ then
$$\varepsilon_n=I_n^{'}-I_n=(e-nI_{n-1}^{'})-(e-nI_{n-1})=n(I_n-I_{n-1})=-n\varepsilon_{n-1}$$
and hence $|\varepsilon_n|=n!\varepsilon_0$. Even if the error in $\varepsilon_0$ is small, that in $\varepsilon_n$ is larger by a factor $n!$ which can be huge. So the propagation error is uncontrollable, that is to say, this recursion is unstable.
But now I don't know how to verify the stability of this formula $\frac{|x|-|y|}{x-y}$ as $x$ approaches $y$.
Stability: If the error propagation is controllable, then the algorithm is said to be numerically stable.
2026-03-29 05:50:19.1774763419