2.3. Errors: problem conditioning and algorithm stability#

The model from the previous section says that each operation introduces a relative error of at most \(u \approx 1.1\cdot10^{-16}\). A program, however, performs thousands or billions of operations, and in Lecture 1 we saw that Rump’s example loses all its digits in a dozen or so operations. To predict when a computation is reliable, we need two notions. Conditioning is a property of the problem: it tells us how strongly the result depends on perturbations of the data. Stability is a property of the algorithm: it tells us whether the algorithm refrains from adding errors larger than the problem itself requires. Together they give a rule that we will test on several examples: the relative error of the result is approximately the conditioning of the problem times the sum of the relative error of the data and the error introduced by the algorithm.

We need the standard library, NumPy, SymPy (for symbolic condition numbers), and mpmath, in which we compute reference values to 50 digits:

import math
from fractions import Fraction
import numpy as np
import sympy as sp
import mpmath

mpmath.mp.dps = 50                 # wartości wzorcowe liczymy z 50 cyframi

2.3.1. Absolute and relative error#

Definition (absolute and relative error)

Let \(\hat x\) be an approximation of a number \(x\). The absolute error is \(|\hat x - x|\), and for \(x \neq 0\) the relative error is \(|\hat x - x| / |x|\). If the relative error is about \(10^{-d}\), we say that \(\hat x\) has about \(d\) correct significant digits.

The error model of an operation from the previous section concerns the relative error, and it is the relative error that is the natural measure in floating-point arithmetic. Ramanujan’s constant from Lecture 1 illustrates this well: let us compute \(e^{\pi\sqrt{163}}\) in float and to 50 digits.

v = math.exp(math.pi * math.sqrt(163))
V = mpmath.exp(mpmath.pi * mpmath.sqrt(163))
print("float:", v, "  dokładnie:", mpmath.nstr(V, 33))
print("błąd bezwzględny:", mpmath.nstr(abs(v - V), 5),
      "  błąd względny:", mpmath.nstr(abs(v - V) / V, 5))
float: 2.6253741264076826e+17   dokładnie: 262537412640768743.99999999999925
błąd bezwzględny: 488.0   błąd względny: 1.8588e-15

The absolute error is several hundred, and the relative error is \(1.9\cdot10^{-15}\): the result has almost 15 correct significant digits, and yet it is completely useless for deciding whether \(e^{\pi\sqrt{163}}\) is an integer. Which error matters depends on the question.

2.3.2. Conditioning of a problem#

Before we ask whether an algorithm computes well, let us ask whether the problem can be computed well at all. The data almost always carry an error, if only a representation error of order \(u\). If \(\hat x = x(1+\delta)\) and \(f\) is differentiable, then by Taylor’s formula

\[ f(\hat x) = f(x) + f'(x)\,x\delta + O(\delta^2) = f(x)\Bigl(1 + \frac{x f'(x)}{f(x)}\,\delta + O(\delta^2)\Bigr). \]

Definition (condition number)

Let \(f\) be differentiable at the point \(x\), with \(f(x) \neq 0\). The condition number of the problem of computing \(f(x)\) is

\[ \kappa_f(x) = \left|\frac{x\,f'(x)}{f(x)}\right| . \]

A relative perturbation of the data by \(\delta\) changes the result, in relative terms, by about \(\kappa_f(x)\,|\delta|\). A problem with a large \(\kappa_f(x)\) is called ill-conditioned.

The condition number is a symbolic quantity, so let us compute it in SymPy for several functions:

x, n = sp.symbols("x n", positive=True)
for f in (x - 1, sp.sqrt(x), sp.exp(x), x**n, sp.log(x), sp.sin(x)):
    kappa = sp.simplify(x * sp.diff(f, x) / f)
    print(f"f(x) = {str(f):8}  kappa = |{kappa}|")
f(x) = x - 1     kappa = |x/(x - 1)|
f(x) = sqrt(x)   kappa = |1/2|
f(x) = exp(x)    kappa = |x|
f(x) = x**n      kappa = |n|
f(x) = log(x)    kappa = |1/log(x)|
f(x) = sin(x)    kappa = |x/tan(x)|

The square root is always well conditioned (\(\kappa = \tfrac12\)): a perturbation of the data is halved. The power \(x^{n}\) multiplies the relative error by \(n\), and the exponential function by \(|x|\). This explains the error we saw for Ramanujan’s constant: the argument \(\pi\sqrt{163} \approx 40.1\) was rounded with a relative error of order \(u\), and \(\exp\) multiplied it by about \(40\). The logarithm is ill-conditioned near \(x = 1\), the sine near nonzero multiples of \(\pi\), and the subtraction \(x \mapsto x - 1\) near \(x = 1\), where \(\kappa = |x/(x-1)|\) grows without bound.

This last case is catastrophic cancellation. Let us compute \((1 + 10^{-15}) - 1\):

a = 1 + 1e-15                      # zapis 1 + 10**-15: jedno zaokrąglenie
r = a - 1
print("a - 1 =", r, "  odejmowanie dokładne:", Fraction(a) - 1 == Fraction(r))
X = 1 + Fraction(1, 10**15)        # dokładna liczba, którą chcieliśmy zapisać
print("błąd względny zapisu a: ", float(abs(Fraction(a) - X) / X))
print("kappa(x - 1) w punkcie X:", float(X / (X - 1)))
print("błąd względny wyniku:   ", float(abs(Fraction(r) - (X - 1)) / (X - 1)))
a - 1 = 1.1102230246251565e-15   odejmowanie dokładne: True
błąd względny zapisu a:  1.1022302462515643e-16
kappa(x - 1) w punkcie X: 1000000000000001.0
błąd względny wyniku:    0.11022302462515654

The result differs from \(10^{-15}\) by \(11\%\), even though the subtraction itself is exact (this is Sterbenz’s lemma). The error arose earlier, when the number \(1 + 10^{-15}\) was stored: it is of order \(10^{-16}\), that is, harmless. At this point, however, subtracting one has a condition number \(\kappa \approx 10^{15}\) and amplifies this error to \(10^{15} \cdot 1.1\cdot10^{-16} \approx 0.11\) — just as the definition predicts. It is not the subtraction that spoils the result: it merely brings to the surface an error stored earlier in the data, and the large condition number tells us how many times this error will grow.

2.3.3. Stability of an algorithm#

Conditioning concerns the problem, not the way it is solved. The same problem can be computed by different algorithms, and each of them introduces its own rounding errors.

Definition (backward stability)

An algorithm \(\hat f\) for computing \(f\) is backward stable if for all data \(x\) its result is the exact value of \(f\) for slightly perturbed data: \(\hat f(x) = f(\hat x)\) for some \(\hat x\) with \(|\hat x - x| \le C u\,|x|\), where \(C\) is a small constant that depends on the algorithm. Then the relative error of the result is approximately no larger than \(\kappa_f(x) \cdot C u\).

A backward stable algorithm thus gives the exact answer to a slightly different question, and how much this answer differs from the true one is then decided by conditioning alone. A single IEEE 754 operation is backward stable: \(\fl(x+y) = x(1+\delta) + y(1+\delta)\) is the exact sum of numbers perturbed by the relative amount \(\delta\), \(|\delta| \le u\). An unstable algorithm is usually one that solves an ill-conditioned subproblem along the way, even though the problem as a whole is well conditioned. Let us look at two examples.

2.3.3.1. The smaller root of a quadratic equation#

The equation \(x^2 - bx + c = 0\) with a large \(b > 0\) and \(c = 1\) has two positive roots, close to \(b\) and close to \(c/b\). The schoolbook formula gives the smaller root as \(\bigl(b - \sqrt{b^2 - 4c}\bigr)/2\). Is the problem well conditioned? Let us compute in SymPy the condition number of the smaller root with respect to \(b\) and with respect to \(c\) for \(b = 10^{8}\):

b, c = sp.symbols("b c", positive=True)
r = (b - sp.sqrt(b**2 - 4 * c)) / 2
for zmienna in (b, c):
    kappa = sp.simplify(zmienna * sp.diff(r, zmienna) / r)
    print(f"kappa względem {zmienna}: |{kappa}| =",
          sp.N(abs(kappa.subs({b: 10**8, c: 1})), 6))
kappa względem b: |-b/sqrt(b**2 - 4*c)| = 1.00000
kappa względem c: |2*c/(-b**2 + b*sqrt(b**2 - 4*c) + 4*c)| = 1.00000

Both condition numbers equal \(1\) to six digits: the problem is extremely well conditioned. Let us now compare the schoolbook formula with a second method, which first computes the larger root \(x_1 = \bigl(b + \sqrt{b^2 - 4c}\bigr)/2\) (without a subtraction) and then obtains the smaller one from Viète’s formula \(x_1 x_2 = c\):

print(f"{'b':>6} {'wzór szkolny':>22} {'bł. wzgl.':>9} "
      f"{'Viète: c / x1':>22} {'bł. wzgl.':>9}")
for b_ in (1e4, 1e6, 1e8, 1e10):
    c_ = 1.0
    d = math.sqrt(b_ * b_ - 4 * c_)
    szkolny = (b_ - d) / 2
    viete = c_ / ((b_ + d) / 2)
    B = mpmath.mpf(b_)
    wzorzec = (B - mpmath.sqrt(B * B - 4)) / 2
    bl = [float(abs(w - wzorzec) / wzorzec) for w in (szkolny, viete)]
    print(f"{b_:6.0e} {szkolny!r:>22} {bl[0]:9.1e} {viete!r:>22} {bl[1]:9.1e}")
     b           wzór szkolny bł. wzgl.          Viète: c / x1 bł. wzgl.
 1e+04 0.00010000000111176632   1.1e-09 0.00010000000100000001   5.7e-17
 1e+06   1.00000761449337e-06   7.6e-06     1.000000000001e-06   8.9e-17
 1e+08  7.450580596923828e-09   2.5e-01                  1e-08   7.9e-17
 1e+10                    0.0   1.0e+00                  1e-10   3.6e-17

For \(b = 10^{8}\) the schoolbook formula is off by \(25\%\), and for \(b = 10^{10}\) it gives zero. Viète’s formula has an error of order \(u\) in all rows. The cause lies in the subtraction \(b - \sqrt{b^2-4c}\): the two numbers agree in almost all digits, and the computed square root \(\sqrt{b^2-4c}\) has an absolute error of order \(u\,b\). The subtraction is exact, but the result is of order \(c/b\), so the relative error grows to about \(u\,b/(c/b) = u\,b^2/c\), that is, for \(b = 10^{8}\), to unity. The schoolbook formula is an unstable algorithm: it solves a well-conditioned problem through an ill-conditioned subtraction. Viète’s formula avoids subtracting nearby numbers.

2.3.3.2. The limit \((1 + 1/n)^n\)#

The sequence \((1+1/n)^n\) tends to \(e\). The natural algorithm first computes \(y = 1 + 1/n\) and then \(y^n\). The second step is a power with condition number \(n\): the relative error \(\delta\) made when storing the number \(y\) turns into a relative error of about \(n\delta\) in the result. We can compute the error \(\delta\) exactly with Fraction, so we can compare the prediction with reality. We compute the reference value of \((1+1/n)^n\) (not the limit \(e\)) in mpmath:

print(f"{'n':>6} {'delta zapisu y':>15} {'n * delta':>11}"
      f" {'exp(n*delta) - 1':>17} {'błąd wyniku':>12}")
for k in (4, 8, 12, 14, 15):
    n_ = 10.0**k
    y = 1 + 1 / n_
    dokladne_y = 1 + Fraction(1, 10**k)
    delta = float((Fraction(y) - dokladne_y) / dokladne_y)
    wzorzec = (1 + mpmath.mpf(1) / 10**k) ** (10**k)
    blad = float((y**n_ - wzorzec) / wzorzec)
    print(f"{n_:6.0e} {delta:15.2e} {n_ * delta:11.2e}"
          f" {math.expm1(n_ * delta):17.2e} {blad:12.2e}")
     n  delta zapisu y   n * delta  exp(n*delta) - 1  błąd wyniku
 1e+04       -1.10e-17   -1.10e-13         -1.10e-13    -1.10e-13
 1e+08       -6.08e-17   -6.08e-09         -6.08e-09    -6.08e-09
 1e+12        8.89e-17    8.89e-05          8.89e-05     8.89e-05
 1e+14       -7.99e-18   -7.99e-04         -7.99e-04    -7.99e-04
 1e+15        1.10e-16    1.10e-01          1.17e-01     1.17e-01

The columns “\(n \cdot \delta\)” and błąd wyniku (“error of the result”) agree in sign and in the leading digits: the error of the naive algorithm comes entirely from rounding the number \(1 + 1/n\), amplified \(n\) times. More precisely, \(\bigl((1+1/n)(1+\delta)\bigr)^{n} = (1+1/n)^{n}(1+\delta)^{n}\) and \((1+\delta)^{n} \approx e^{n\delta}\). For \(n = 10^{15}\) the linear approximation \(e^{n\delta} - 1 \approx n\delta\) is no longer sufficient, but the value \(e^{n\delta} - 1\) still agrees with the error of the result. The problem itself is well conditioned; it is the algorithm passing through the number \(1 + 1/n\) that is unstable. A stable algorithm uses the formula \((1+1/n)^n = \exp\bigl(n\log(1 + 1/n)\bigr)\) and the function math.log1p(t), which computes \(\log(1+t)\) with a relative error of order \(u\) without forming the number \(1 + t\):

print(f"{'n':>5} {'naiwnie':>20} {'z log1p':>20} {'wzorzec':>20}")
for k in (8, 12, 15, 16):
    n_ = 10.0**k
    wzorzec = (1 + mpmath.mpf(1) / 10**k) ** (10**k)
    naiwnie = (1 + 1 / n_) ** n_
    z_log1p = math.exp(n_ * math.log1p(1 / n_))
    print(f"{n_:5.0e} {naiwnie!r:>20} {z_log1p!r:>20}"
          f" {mpmath.nstr(wzorzec, 17):>20}")
    n              naiwnie              z log1p              wzorzec
1e+08   2.7182817983473577   2.7182818148676366   2.7182818148676362
1e+12   2.7185234960372378    2.718281828457686   2.7182818284576861
1e+15    3.035035206549262   2.7182818284590438   2.7182818284590439
1e+16                  1.0    2.718281828459045   2.7182818284590451

The version with log1p gives \(16\)–\(17\) correct digits in all rows, while the naive one returns \(1\) for \(n = 10^{16}\), because \(1 + 10^{-16}\) rounds to \(1\). The deep dive, part 2, §7, shows a plot of the error of both versions for \(n\) from \(10\) to \(10^{17}\), as well as the twin function math.expm1.

2.3.4. Summation#

A sum of \(n\) numbers is the simplest computation with many operations. To bound its error, we need a lemma on products of factors \((1 + \delta_i)\), which will also be useful in the last section.

Lemma (product of relative errors)

If \(|\delta_i| \le u\) for \(i = 1, \dots, k\) and \(ku < 1\), then \(\prod_{i=1}^{k}(1 + \delta_i) = 1 + \theta_k\), where

\[ |\theta_k| \le \gamma_k := \frac{ku}{1 - ku} . \]

Proof. The product lies between \((1-u)^{k}\) and \((1+u)^{k}\). By Bernoulli’s inequality, \((1-u)^{k} \ge 1 - ku \ge 1 - \gamma_k\). From the inequality \(e^{t} \le 1/(1-t)\) for \(0 \le t < 1\) we get \((1+u)^{k} \le e^{ku} \le 1/(1-ku) = 1 + \gamma_k\). \(\blacksquare\)

Theorem (error of summation in a loop)

Let \(\hat s\) be the sum of machine numbers \(x_1, \dots, x_n\) computed in the loop \(\hat s_1 = x_1\), \(\hat s_k = \fl(\hat s_{k-1} + x_k)\), without overflow or underflow, and let \((n-1)u < 1\). Then

\[ \Bigl|\hat s - \sum_{i=1}^{n} x_i\Bigr| \le \gamma_{n-1} \sum_{i=1}^{n} |x_i| \approx (n-1)\,u \sum_{i=1}^{n} |x_i| . \]

Proof. By the error model, \(\hat s_k = (\hat s_{k-1} + x_k)(1 + \delta_k)\), \(|\delta_k| \le u\). Unrolling the recurrence, we get \(\hat s = \sum_{i=1}^{n} x_i \prod_{k=\max(i,2)}^{n}(1+\delta_k)\): each term passes through at most \(n-1\) additions. By the lemma, each product has the form \(1 + \theta^{(i)}\) with \(|\theta^{(i)}| \le \gamma_{n-1}\), so \(|\hat s - \sum x_i| = |\sum x_i\theta^{(i)}| \le \gamma_{n-1}\sum|x_i|\). \(\blacksquare\) (N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., SIAM 2002, ch. 4.)

Pitfall: in Python 3.12, sum() is not a plain loop

Since Python 3.12, the built-in function sum adds float numbers with error compensation (Neumaier’s algorithm), so sum([0.1] * 10) == 1.0 is true, while a for loop gives 0.9999999999999999. To show the error of ordinary summation, you have to write the loop yourself. In older versions, sum was a plain loop.

Let us check the bound on the harmonic sum \(H_n\) for \(n = 10^{6}\), this time in the binary64 format. We compare the forward and the backward loop, the built-in sum, the function math.fsum (which returns the correctly rounded exact sum of the given numbers), and np.sum (which sums pairwise, in a tree of additions):

def petla(xs):
    s = 0.0
    for x in xs:
        s += x
    return s

n_ = 10**6
wyrazy = [1 / k for k in range(1, n_ + 1)]
H = mpmath.harmonic(n_)
wyniki = {"pętla w przód": petla(wyrazy), "pętla wstecz": petla(wyrazy[::-1]),
          "sum()": sum(wyrazy), "math.fsum": math.fsum(wyrazy),
          "np.sum": float(np.sum(wyrazy))}
for nazwa, s in wyniki.items():
    blad = mpmath.mpf(s) - H
    print(f"{nazwa:14} {s!r:20}  błąd {mpmath.nstr(blad, 3):>10}"
          f"  = {float(blad) / math.ulp(s):8.2f} ulp")
print("oszacowanie (n-1) u sum|x_i|:", (n_ - 1) * 2**-53 * math.fsum(wyrazy))
pętla w przód  14.392726722864989    błąd  -7.35e-13  =  -413.62 ulp
pętla wstecz   14.392726722865772    błąd   4.86e-14  =    27.38 ulp
sum()          14.392726722865724    błąd   6.67e-16  =     0.38 ulp
math.fsum      14.392726722865724    błąd   6.67e-16  =     0.38 ulp
np.sum         14.392726722865726    błąd   2.44e-15  =     1.38 ulp
oszacowanie (n-1) u sum|x_i|: 1.5979120615726707e-09

The forward loop is off by several hundred \(\ulp\), the backward loop by a few dozen, and sum and math.fsum by less than one. The error of \(6.7\cdot10^{-16}\) that remains in math.fsum does not come from the summation but from the data: each term \(1/k\) was already rounded when it was stored. The bound from the theorem, \(1.6\cdot10^{-9}\), is true, but more than a thousand times too pessimistic: it describes the worst case, in which all the errors have the same sign and the largest possible magnitude. Compensated summation algorithms (Kahan’s, Neumaier’s, Shewchuk’s) and their guarantees are discussed in the deep dive, part 2, §2, and exercise C2 in Lab 3 asks you to find data on which Neumaier’s method fails.

2.3.5. Muller’s sequence: when more digits do not help#

The last example shows a problem so ill-conditioned that no fixed precision is enough. Muller’s sequence is

\[ u_0 = 2, \qquad u_1 = -4, \qquad u_{n+1} = 111 - \frac{1130}{u_n} + \frac{3000}{u_n u_{n-1}} . \]

We compute it in float and exactly, with fractions:

def muller(u0, u1, n):
    """Wyraz u_n ciągu Mullera o wyrazach początkowych u0, u1."""
    a, b = u0, u1
    for _ in range(n - 1):
        a, b = b, 111 - 1130 / b + 3000 / (a * b)
    return b

for n_ in (5, 10, 15, 20, 30):
    print(f"n = {n_:2}:  float {muller(2.0, -4.0, n_)!r:20}"
          f"  dokładnie {float(muller(Fraction(2), Fraction(-4), n_))!r}")
n =  5:  float 7.154414480975333     dokładnie 7.154414480975249
n = 10:  float 6.274438662728116     dokładnie 6.274438598216328
n = 15:  float 6.166086559598099     dokładnie 6.094739439333681
n = 20:  float 99.8985692661829      dokładnie 6.036031881081857
n = 30:  float 99.99999999999993     dokładnie 6.00564868877142

The exact terms tend to \(6\), while the computation in float “jumps” to \(100\) after a dozen or so steps and stays there for good. The explanation lies in the conditioning of the problem “compute \(u_n\) from the data \(u_0, u_1\).” Let us measure it in exact arithmetic: we perturb \(u_1\) by \(10^{-40}\) and check how much \(u_n\) changes. The ratio of these relative changes approximates the condition number \(\kappa_n\):

eps = Fraction(1, 10**40)
for n_ in (5, 10, 15, 20, 25, 30):
    un = muller(Fraction(2), Fraction(-4), n_)
    zaburzony = muller(Fraction(2), Fraction(-4) + eps, n_)
    kappa = abs((zaburzony - un) / un) / abs(eps / 4)
    print(f"n = {n_:2}:  kappa_n ≈ {float(kappa):.2e}")
n =  5:  kappa_n ≈ 1.07e+04
n = 10:  kappa_n ≈ 9.40e+09
n = 15:  kappa_n ≈ 1.07e+16
n = 20:  kappa_n ≈ 1.32e+22
n = 25:  kappa_n ≈ 1.66e+28
n = 30:  kappa_n ≈ 2.13e+34

The condition number grows roughly \(100/6 \approx 16.7\) times per step. When \(\kappa_n u\) reaches one, that is, around \(n = 15\), a rounding error of order \(u\) is enough to destroy all the digits of the result — and that is exactly when the float result breaks away from \(6\). Higher precision only shifts this moment: with \(d\) digits, the disaster comes when \(\kappa_n\) reaches about \(10^{d}\), and \(\kappa_n\) grows exponentially. In exercise D1 in Lab 3 you will check how many steps you gain by adding digits. Exact computation works because the data \(u_0 = 2\), \(u_1 = -4\) are rational. The explicit formula for \(u_n\), which reveals both limits, \(6\) and \(100\), is in the deep dive, part 2, §7.

2.3.6. Summary#

  • The relative error is the natural measure in floating-point arithmetic; which error matters is decided by the question.

  • The condition number \(\kappa_f(x) = |xf'(x)/f(x)|\) tells us how many times the problem amplifies the relative error of the data. Subtracting nearby numbers is ill-conditioned: it reveals errors in the data, even though it is itself exact.

  • A backward stable algorithm gives the exact result for slightly perturbed data, so its error is about \(\kappa \cdot Cu\). An unstable algorithm passes through an ill-conditioned subproblem: the schoolbook formula for the roots, \((1+1/n)^n\) computed directly.

  • The error of summation in a loop does not exceed \(\gamma_{n-1}\sum|x_i|\); in practice it is much smaller. In Python 3.12, sum of float numbers uses compensation, and math.fsum rounds the exact sum.

  • For an ill-conditioned problem, such as Muller’s sequence, more digits only postpone the disaster. What helps is exact computation or mathematical analysis.

2.3.7. Exercises#

  1. ★ The number \(\pi\) has the approximations \(3.14\) and \(\tfrac{22}{7}\). Compute the absolute and relative errors of both, as well as the number of correct significant digits. Which approximation is better?

  2. ★ Compute in SymPy the condition numbers of the functions \(f(x) = x^2 - 1\) and \(g(x) = \cos x\). Where are these problems ill-conditioned?

  3. ★★ For \(x = 1 + 10^{-8}\), compare the results of x*x - 1 and (x - 1)*(x + 1) with the exact value (Fraction). Which algorithm is stable, and why? Point out an operation in it that is exact by Sterbenz’s lemma.

  4. ★★ The integrals \(I_n = \int_0^1 x^{n} e^{x-1}\,dx\) satisfy \(I_0 = 1 - 1/e\) and \(I_n = 1 - nI_{n-1}\). Compute \(I_{20}\) with this recurrence in float, and then with the backward recurrence \(I_{n-1} = (1 - I_n)/n\), starting from \(I_{40} = 0\). Compare with the value from mpmath.quad and explain the result by tracking how the error changes in one step of each recurrence.

  5. ★★★ Show that, up to terms of order \(u^2\), the error of summation in a loop satisfies \(|\hat s - s| \lesssim u\sum_{k=2}^{n}|\hat s_k|\), where \(\hat s_k\) are the computed partial sums. Use this bound to explain why the harmonic sum computed backward is more accurate.

  6. ★★★ The substitution \(u_n = y_{n+1}/y_n\) turns Muller’s recurrence into the linear recurrence \(y_{n+1} = 111y_n - 1130y_{n-1} + 3000y_{n-2}\). Find its general solution in SymPy, fit the constants to \(u_0 = 2\), \(u_1 = -4\), and show that the coefficient of \(100^{n}\) is zero. What happens to this coefficient when \(u_1\) is perturbed by \(\varepsilon \neq 0\)?