These are the human proofs of Graeffe's method, at full length.
Correctness of Graeffe's method full
This proof shows: correctness, termination, convergence-rate.
Let p(x)=a0xn+⋯+an=a0∏i=1n(x−ri) with real aj, a0=0, an=0 (after line L1) and ∣r1∣≥⋯≥∣rn∣>0. Statements are in exact arithmetic; the remark at the end discusses rounding.
Lemma 1 (the squaring step)
If b are the coefficients of a polynomial P(x)=b0∏(x−ρi) of degree n, the coefficients c of line L4 are those of Q(y)=b02∏(y−ρi2).
Proof.P(−x)=b0∏(−x−ρi)=(−1)nb0∏(x+ρi), so (−1)nP(x)P(−x)=b02∏(x2−ρi2)=Q(x2). Write P(x)=∑jbjxn−j and P(−x)=∑l(−1)n−lblxn−l. The coefficient of x2n−2j in (−1)nP(x)P(−x) is ∑s+l=2j(−1)lbsbl. Pairing the term (s,l)=(j−i,j+i) with (j+i,j−i) for each i≥1 gives (−1)j(bj2+2∑i≥1(−1)ibj−ibj+i), since (−1)j+i=(−1)j−i. Odd powers of x cancel because the product is even. □
By induction, after k steps the coefficients are those of a0N∏(y−riN) with N=2k. By Vieta, bj=(−1)ja0Nej(r1N,…,rnN), where ej is the j-th elementary symmetric function and e0=1.
Lemma 2 (regular indices)
Fix j with 1≤j≤n−1 and ∣rj∣>∣rj+1∣, and let λj=∣rj+1/rj∣<1. Then
The same holds trivially with ηj=0 for j=0 and j=n.
Proof.ej is the sum over j-element subsets S of ∏i∈SriN. Any S={1,…,j} contains some t>j and misses some s≤j. Then ∏S∣ri∣≤∣r1⋯rj∣⋅∣rt/rs∣≤∣r1⋯rj∣λj, because the moduli are ordered: swap the indices one at a time and each swap does not increase the product. There are (jn)−1 such subsets. □
Theorem 1 (the moduli)
Let 0=j0<j1<⋯<jt=n be the indices j with ∣rj∣>∣rj+1∣, together with 0 and n. For consecutive i=js−1, l=js, the roots ri+1,…,rl have one common modulus ρ, and
with λ=maxsλjs<1. So the formula of L10 converges to the common modulus, and the relative error decreases like λ2k/2k.
Proof. By Lemma 1, ∣bl/bi∣=∣el/ei∣, and by Lemma 2, ∣el/ei∣=∣ri+1⋯rl∣N∣1+ηl∣/∣1+ηi∣=ρN(l−i)∣1+ηl∣/∣1+ηi∣. Since ∣η∣=O(λN), the N(l−i)-th root of the last factor is 1+O(λN/N). □
Theorem 2 (the deviations and the order)
At a regular index j (one of the js), with ηj(k) the remainder after k steps,
If moreover ηj(k)=cλjN(1+o(1)) for a constant c>0, which holds for instance when all roots are real, with c the number of subsets S attaining ∏S∣ri∣=λj∣r1⋯rj∣, then d(k+1)≈(d(k))2/(2c). So the deviations converge with order q=2 in the step number k, and the moduli error of Theorem 1 is about d(k)/(2N).
At an index j strictly inside a group, the deviation does not tend to 0. For the simplest case, a group that is a single complex pair ρe±iθ, 0<θ<π, sitting at positions j,j+1, the dominant part of ej is PNρN⋅2cos(Nθ), where P is the product of the moduli above the pair. So asymptotically (−1)jcj/bj2→2cos(2Nθ)/(4cos2(Nθ))=1−1/(2cos2(Nθ)), and dj≥1/2 in the limit. A real double root gives dj→1/2. A pair ±r gives bj=0 exactly after one step, which L6 treats as irregular.
Proof. The first display follows from bj(k)=(−1)ja0N(r1⋯rj)N(1+ηj(k)) and Lemma 1, which gives cj=bj(k+1). Expanding (1+η′)/(1+η)2=1−2η+η′+O(η2) and using η′=O(λ2N) gives the second. If η(k)≈cλN, then η(k+1)≈cλ2N=(η(k))2/c and d(k+1)≈2(η(k))2/c=(d(k))2/(2c). The pair computation is the same expansion with the two dominant subsets carrying the conjugate factors e±iNθ. □
Termination and what the output means
Each pass of the loop L3 increases k, so the loop ends after at most K steps; L8 may end it earlier. If it ends with status "separated", every dj≤ tol. By Theorem 2 this happens for all large k exactly when all the moduli are distinct, and then the error of each modulus is asymptotically at most about tol/2k+1. This bound is asymptotic, not a guaranteed bound at the stopping step. If the loop ends at the cap, the set R of L9 contains 0, n and the indices that look regular. When K is large enough that λ2K≪ tol, these are exactly the js of Theorem 1, so the groups are the true groups of equal moduli. When it is not, two close moduli may be merged into one group, and the reported value is then the geometric mean of the moduli in the group, which is exact by the same formula with the merged indices. Line L11 is correct because the conjugate of a non-real root of a real polynomial is a root of the same modulus, so a modulus carried by one root belongs to a real root, which is ρ or −ρ.
Rounding
The reference code stores the bj as 40-digit decimals with an exponent range of about 1018, so nothing overflows for K≤30 and moduli in the double range. At a regular index the computed cj is dominated by bj2, so each step adds a relative error of a few units of the 40-digit precision. After the N-th root this error is divided by N. The moduli are then those of the polynomial with the given floating point coefficients, to the accuracy observed in the tests (2×10−16 relative on the Wilkinson polynomial of degree 20). Inside a group, cancellation can amplify the relative error of the irregular coefficients, but these coefficients are not used in L10. This rounding analysis is stated, not proved in detail.