This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Posts

Fact checks

Some quantities are stated in more than one post; each has one accepted value, and every post that states it must round to it. Below that are the sentences in the posts that have been fact-checked, each with its verdict. The claims themselves, each checked by a program, are in the Claims channel.

Quantities stated across posts

QuantityAccepted valueStated asPostsAgree
critical temperature of the square-lattice Ising model, 2/ln(1 + sqrt 2), in J/k_B 2.269185314213022 2.26919, 2.269185314213022 1 2 / 2
Onsager-Yang spontaneous magnetization at T = 1.8 J/k_B 0.9568570172474183 0.95686, 0.956857 1 3 / 3
fastest cold-beam two-stream growth rate, 1/(2 sqrt 2), in units of the plasma frequency 0.3535533905932738 0.354, 0.35355, 0.353553 2 4 / 4
real frequency of the Landau-damped Langmuir root at k lambda_D = 0.5, in omega_p 1.4156618886045365 1.4156618886045364 1 1 / 1
Landau damping rate at k lambda_D = 0.5, in omega_p 0.15335946690960484 0.1534, 0.15335946690960483 1 2 / 2
Gibbs overshoot as a fraction of the jump, Si(pi)/pi - 1/2 0.08948987223608362 8.95%, 0.0895 1 4 / 4
the hartree in electronvolts 27.211386245988 27.211, 27.2114 2 2 / 2
the bohr in angstroms 0.529177210903 0.5292 1 1 / 1
RHF energy of water in 6-31G at the posts' geometry, hartree -75.98394849810573 -75.98394849810573 2 4 / 4
double-precision machine epsilon, 2^-52 2.220446049250313e-16 , 2 3 / 3
double-precision unit roundoff, 2^-53 1.1102230246251565e-16 1 1 / 1
ln 2 0.6931471805599453 0.7, 0.693 2 4 / 4
years to double at 7% compounded once a year, ln 2 / ln 1.07 10.244768351058712 10.24 4 5 / 5
years to double at 7% a year compounded monthly, ln 2 / (12 ln(1 + 0.07/12)) 9.930955714667654 9.931 2 2 / 2
largest mass of a star of free neutrons (Oppenheimer-Volkoff), solar masses 0.7102 0.7102, 0.71, 0.71018029 1 4 / 4

Fact-checked sentences

1071 of 3036 sentences have a verdict (676 verified, 297 not-checkable, 98 plausible); 91 factual sentences and definitions are waiting.

  1. verified Forward Euler loses the planet

    Forward Euler gains energy until the planet is unbound.

    Explicit Euler steadily gains energy on the Kepler problem; here the run confirms it ends with E>0.

    Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  2. verified Forward Euler loses the planet

    Leapfrog's energy error stays under one percent, and it keeps the angular momentum to rounding.

    Stormer-Verlet/leapfrog keeps energy bounded near its start and conserves angular momentum exactly for central forces; the 0.74% figure is the run's.

    Wikipedia, Leapfrog integration (kick-drift-kick form; second order; symplectic, conserves a modified energy; preserves angular momentum), https://en.wikipedia.org/wiki/Leapfrog_integration; Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  3. not-checkable Forward Euler loses the planet

    A planet goes around a sun that sits still at the origin.

    Describes the model the program sets up (fixed sun at the origin).

  4. verified Forward Euler loses the planet

    The only force on it is the sun's gravity, which pulls toward the origin, so its acceleration is

    Gravity from a fixed point mass is a central attraction toward it.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit

  5. verified Forward Euler loses the planet

    r¨=−GM r∣r∣3,\ddot{\mathbf r} = -\frac{GM\,\mathbf r}{|\mathbf r|^3},

    Newton's inverse-square law for a fixed central mass.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit

  6. not-checkable Forward Euler loses the planet

    where r\mathbf r is the planet's position, GG is the gravitational constant and MM is the sun's mass.

    Defines the symbols in the formula.

  7. verified Forward Euler loses the planet

    Kepler's third law then says one orbit takes 2πa3/GM=2π2\pi\sqrt{a^3/GM} = 2\pi time units.

    P = 2pi sqrt(a^3/mu), which is 2pi for a = GM = 1.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit

  8. verified Forward Euler loses the planet

    The eccentricity ECC says how stretched the ellipse is: 0 is a circle, and at 0.6 the closest approach to the sun (the perihelion) is 1−0.6=0.41 - 0.6 = 0.4 and the farthest point is 1+0.6=1.61 + 0.6 = 1.6.

    Perihelion a(1-e) = 0.4 and aphelion a(1+e) = 1.6 for a = 1, e = 0.6.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit; Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  9. verified Forward Euler loses the planet

    With only gravity acting, the planet's energy per unit mass, kinetic plus potential,

    Specific orbital energy is kinetic plus potential per unit mass and is conserved.

    Wikipedia, Vis-viva equation (v^2 = GM(2/r - 1/a); specific orbital energy -GM/2a), https://en.wikipedia.org/wiki/Vis-viva_equation

  10. verified Forward Euler loses the planet

    E=12∣v∣2−1∣r∣,E = \tfrac12|\mathbf v|^2 - \frac{1}{|\mathbf r|},

    Specific energy v^2/2 - GM/r with GM = 1.

    Wikipedia, Vis-viva equation (v^2 = GM(2/r - 1/a); specific orbital energy -GM/2a), https://en.wikipedia.org/wiki/Vis-viva_equation

  11. verified Forward Euler loses the planet

    has the same value at every moment of the true motion.

    The specific orbital energy is constant along an exact Kepler orbit.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit; Wikipedia, Vis-viva equation (v^2 = GM(2/r - 1/a); specific orbital energy -GM/2a), https://en.wikipedia.org/wiki/Vis-viva_equation

  12. verified Forward Euler loses the planet

    The planet starts at perihelion, at (0.4,0)(0.4, 0), moving straight up.

    Same initial condition as Hairer-Lubich-Wanner's Kepler test: q0 = (1-e, 0), velocity perpendicular, at perihelion.

    Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  13. verified Forward Euler loses the planet

    It is negative because the planet is bound: it lacks the energy to climb out of the sun's pull.

    Negative energy corresponds to a bound elliptical orbit.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit

  14. verified Forward Euler loses the planet

    If a method pushed EE above zero, the simulated planet would leave and never come back.

    E > 0 gives a hyperbolic trajectory that escapes to infinity.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit

  15. not-checkable Forward Euler loses the planet

    A computer cannot follow the motion continuously.

    Framing sentence about time stepping.

  16. not-checkable Forward Euler loses the planet

    It jumps ahead by a time step Δt\Delta t, again and again.

    Framing sentence about time stepping.

  17. verified Forward Euler loses the planet

    Forward Euler is the simplest way to make each jump: take the velocity and the acceleration at the start of the step and pretend they stay fixed for the whole step,

    Explicit Euler freezes the derivative at the start of the step.

    Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  18. verified Forward Euler loses the planet

    rn+1=rn+Δt vn,vn+1=vn+Δt a(rn).\mathbf r_{n+1} = \mathbf r_n + \Delta t\,\mathbf v_n, \qquad \mathbf v_{n+1} = \mathbf v_n + \Delta t\,\mathbf a(\mathbf r_n).

    Explicit Euler for q' = v, v' = a(q).

    Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  19. verified Forward Euler loses the planet

    At perihelion the velocity points straight up and the pull points straight left, toward the sun.

    From (0.4, 0) with velocity (0, 2), the velocity is along +y and the attraction along -x.

    Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  20. verified Forward Euler loses the planet

    The position update moves the planet along a straight line, up and off the curve, which leaves it a little farther from the sun, so the potential energy rises.

    With r perpendicular to v, |r + h v|^2 = r^2 + h^2 v^2 > r^2, so the distance and the potential energy rise.

    Direct symbolic expansion (sympy) done in this check; Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  21. verified Forward Euler loses the planet

    The velocity update adds a sideways kick at right angles to the velocity, which makes the velocity longer, so the kinetic energy rises too.

    With a perpendicular to v, |v + h a|^2 = v^2 + h^2 a^2 > v^2.

    Direct symbolic expansion (sympy) done in this check; Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  22. verified Forward Euler loses the planet

    Both parts go up.

    Follows from the two preceding computations.

    Direct symbolic expansion (sympy) done in this check

  23. verified Forward Euler loses the planet

    Leapfrog does the same work per step, one evaluation of the force, in a different order.

    Kick-drift-kick needs one new force evaluation per step, the same as Euler.

    Wikipedia, Leapfrog integration (kick-drift-kick form; second order; symplectic, conserves a modified energy; preserves angular momentum), https://en.wikipedia.org/wiki/Leapfrog_integration

  24. verified Forward Euler loses the planet

    vn+12=vn+Δt2a(rn),rn+1=rn+Δt vn+12,vn+1=vn+12+Δt2a(rn+1).\mathbf v_{n+\frac12} = \mathbf v_n + \tfrac{\Delta t}{2}\mathbf a(\mathbf r_n), \qquad \mathbf r_{n+1} = \mathbf r_n + \Delta t\,\mathbf v_{n+\frac12}, \qquad \mathbf v_{n+1} = \mathbf v_{n+\frac12} + \tfrac{\Delta t}{2}\mathbf a(\mathbf r_{n+1}).

    Matches the kick-drift-kick form of leapfrog.

    Wikipedia, Leapfrog integration (kick-drift-kick form; second order; symplectic, conserves a modified energy; preserves angular momentum), https://en.wikipedia.org/wiki/Leapfrog_integration

  25. not-checkable Forward Euler loses the planet

    From the same starting point, one leapfrog step changes the energy by 0.0001250.000125 (leap_one_step_change), 398 times less than Euler's step (step_ratio).

    Program output; tested (step_ratio 398, leap_one_step_change 1.246e-4).

  26. not-checkable Forward Euler loses the planet

    That is not yet the difference that matters.

    Transition.

  27. not-checkable Forward Euler loses the planet

    If each of the 2000 steps added that much, ten orbits would add 0.250.25 (leap_if_errors_added).

    Run output; 2000 x 0.0001246 = 0.249.

  28. not-checkable Forward Euler loses the planet

    What matters is whether the errors of many steps pile up or cancel.

    Transition.

  29. verified Forward Euler loses the planet

    After ten orbits Euler has added 0.5460.546 (euler_final), so the planet's energy is +0.046+0.046 (euler_end_energy): positive, which means the simulated planet is no longer in orbit at all.

    -0.5 + 0.546 = +0.046 > 0, and positive specific energy means an unbound (hyperbolic) path.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit

  30. not-checkable Forward Euler loses the planet

    It is flying away.

    Describes the simulated run.

  31. verified Forward Euler loses the planet

    The real planet would go around forever.

    An exact two-body Kepler ellipse is periodic.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit

  32. not-checkable Forward Euler loses the planet

    The largest energy error leapfrog makes in ten orbits is 0.00370.0037 (leap_worst), which is 0.74%0.74\% of the orbit's 0.50.5 (leap_worst_share) and almost seventy times less than 0.250.25.

    Program output; 0.003676/0.5 = 0.74% is tested (leap_worst_share), and 0.25/0.003676 = 68 is consistent.

  33. not-checkable Forward Euler loses the planet

    Its errors do not add up.

    Describes the run.

  34. not-checkable Forward Euler loses the planet

    That leaves the planet on a larger orbit, one that takes 4.34.3 of the original orbits to go around (euler_orbit_period), so the next close pass to the sun comes near orbit 4.3 on the plot.

    Program output: euler_orbit_period = 4.3 (shown), and the energy series' second jump is between orbits 4.35 and 4.40 in this run.

  35. verified Forward Euler loses the planet

    Each leapfrog step is the exact motion of a slightly different system, one whose energy function differs from the true EE by an amount that shrinks with Δt2\Delta t^2.

    Backward error analysis: Stormer-Verlet exactly conserves a modified Hamiltonian H + O(h^2) up to exponentially small terms (GNI Ch. IX).

    Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf; Wikipedia, Leapfrog integration (kick-drift-kick form; second order; symplectic, conserves a modified energy; preserves angular momentum), https://en.wikipedia.org/wiki/Leapfrog_integration

  36. not-checkable Forward Euler loses the planet

    A second conserved quantity makes the same point more directly.

    Transition.

  37. verified Forward Euler loses the planet

    The angular momentum per unit mass, L=xvy−yvxL = x v_y - y v_x, is constant for any force that points at the origin.

    Angular momentum is conserved for any central force.

    Wikipedia, Kepler orbit (P = 2pi sqrt(a^3/mu); energy -mu/(2a); angular momentum constant for a central force), https://en.wikipedia.org/wiki/Kepler_orbit

  38. verified Forward Euler loses the planet

    Leapfrog should keep LL to rounding error.

    Stormer-Verlet conserves angular momentum exactly for central forces, so only rounding remains.

    Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf; Wikipedia, Leapfrog integration (kick-drift-kick form; second order; symplectic, conserves a modified energy; preserves angular momentum), https://en.wikipedia.org/wiki/Leapfrog_integration

  39. verified Forward Euler loses the planet

    Euler moves the position and the velocity at the same time, from the old values; working out the product gives a change of Δt2(vxay−vyax)\Delta t^2 (v_x a_y - v_y a_x) per step, which is not zero.

    Expanding (x+h vx)(vy+h ay) - (y+h vy)(vx+h ax) gives h(x ay - y ax) + h^2(vx ay - vy ax); the first term vanishes for a central force.

    Direct symbolic expansion (sympy) done in this check

  40. not-checkable Forward Euler loses the planet

    Leapfrog's drift is at the level of rounding error, 2.9×10−152.9 \times 10^{-15} (momentum_drift), and the test holds it under 10−1210^{-12}.

    Program output: momentum_drift = 2.89e-15, tested under 1e-12.

  41. verified Forward Euler loses the planet

    A method is order p if its error shrinks like Δtp\Delta t^p: halve the step and the error drops by a factor of 2p2^p.

    Standard definition of order p (global error O(h^p)).

    Hairer, Lubich & Wanner, Geometric Numerical Integration, 2nd ed. (Springer 2006), Ch. I.2 (Kepler problem, e=0.6, q0=(1-e,0), p0=(0,sqrt((1+e)/(1-e))), period 2pi); lecture intro read at https://www.unige.ch/~hairer/poly_geoint/intro.pdf

  42. not-checkable Forward Euler loses the planet

    The cell below runs leapfrog again with 400 steps per orbit and measures pp from the two worst errors:

    Describes the program.

  43. not-checkable Forward Euler loses the planet

    p=log⁡10(error at Δt)−log⁡10(error at Δt/2)log⁡102.p = \frac{\log_{10}(\text{error at } \Delta t) - \log_{10}(\text{error at } \Delta t/2)}{\log_{10} 2}.

    Formula the program uses to estimate the order.

  44. not-checkable Forward Euler loses the planet

    leapfrog's error sits near 0.0036 for most of each orbit

    Describes this program's test: the median of the 200 leapfrog samples is 0.003556 and 74% of them are within 5e-5 of it.

  45. verified The Gibbs overshoot never shrinks

    Its Fourier series is 4π(sin⁡x+13sin⁡3x+15sin⁡5x+…)\tfrac{4}{\pi}\big(\sin x + \tfrac13 \sin 3x + \tfrac15 \sin 5x + \dots\big): odd harmonics only, falling off like 1/k1/k.

    The square wave's series is 4/pi sum sin((2k-1)x)/(2k-1), odd harmonics with 1/k coefficients.

    Wikipedia, Square wave: Fourier series 4/pi sum sin((2k-1)x)/(2k-1), odd harmonics only, https://en.wikipedia.org/wiki/Square_wave_(waveform)

  46. verified The Gibbs overshoot never shrinks

    The sum of the first mm odd harmonics has its first peak at exactly x=π/2mx = \pi / 2m, where the derivative 2πsin⁡(2mx)/sin⁡x\tfrac{2}{\pi} \sin(2mx) / \sin x first vanishes.

    The derivative is 4/pi sum cos((2j+1)x) = (2/pi) sin(2mx)/sin x, first zero at x = pi/(2m); the peak sum is the midpoint rule for (2/pi) Si(pi) = 1.178980.

    Wikipedia, Gibbs phenomenon (overshoot 0.089489872... of the jump; Wilbraham-Gibbs constant Si(pi)=1.851937...; first maximum at x0 + L/(2N); Fejer/sigma-approximation), https://en.wikipedia.org/wiki/Gibbs_phenomenon; Direct symbolic expansion (sympy) done in this check

  47. verified The Gibbs overshoot never shrinks

    The overshoot is 0.1790.179, which is 8.95%8.95\% of the jump from −1-1 to 11.

    The overshoot (2/pi)Si(pi) - 1 = 0.17898 is 0.0894899 of the jump of 2.

    Wikipedia, Gibbs phenomenon (overshoot 0.089489872... of the jump; Wilbraham-Gibbs constant Si(pi)=1.851937...; first maximum at x0 + L/(2N); Fejer/sigma-approximation), https://en.wikipedia.org/wiki/Gibbs_phenomenon

  48. verified The Gibbs overshoot never shrinks

    The peak sits at π/2m\pi/2m and is about that wide, so as mm grows it carries less and less area.

    The first maximum is at L/(2N) from the jump and moves in as N grows, so its area shrinks.

    Wikipedia, Gibbs phenomenon (overshoot 0.089489872... of the jump; Wilbraham-Gibbs constant Si(pi)=1.851937...; first maximum at x0 + L/(2N); Fejer/sigma-approximation), https://en.wikipedia.org/wiki/Gibbs_phenomenon

  49. verified The Gibbs overshoot never shrinks

    In the mean-square sense the series converges: the integral of the squared error goes to zero.

    The square wave is in L^2, so its Fourier series converges in mean square (Parseval).

    Wikipedia, Gibbs phenomenon (overshoot 0.089489872... of the jump; Wilbraham-Gibbs constant Si(pi)=1.851937...; first maximum at x0 + L/(2N); Fejer/sigma-approximation), https://en.wikipedia.org/wiki/Gibbs_phenomenon; Wikipedia, Square wave: Fourier series 4/pi sum sin((2k-1)x)/(2k-1), odd harmonics only, https://en.wikipedia.org/wiki/Square_wave_(waveform)

  50. plausible The Gibbs overshoot never shrinks

    But at the peak itself the error stays 0.1790.179 for every mm.

    The peak error tends to 0.179 but is larger for small m (0.273 at m = 1, 0.182 at m = 5, 0.1798 at m = 10, computed here); 'stays near 0.179 however large m is' would be exact.

    Wikipedia, Gibbs phenomenon (overshoot 0.089489872... of the jump; Wilbraham-Gibbs constant Si(pi)=1.851937...; first maximum at x0 + L/(2N); Fejer/sigma-approximation), https://en.wikipedia.org/wiki/Gibbs_phenomenon; Direct symbolic expansion (sympy) done in this check

  51. verified The Gibbs overshoot never shrinks

    That is the difference between convergence in L2L^2 and uniform convergence, and a square wave, being discontinuous, has the first without the second.

    A uniform limit of continuous partial sums would be continuous, so a discontinuous wave gives L^2 convergence without uniform convergence.

    Wikipedia, Gibbs phenomenon (overshoot 0.089489872... of the jump; Wilbraham-Gibbs constant Si(pi)=1.851937...; first maximum at x0 + L/(2N); Fejer/sigma-approximation), https://en.wikipedia.org/wiki/Gibbs_phenomenon

  52. verified The Gibbs overshoot never shrinks

    A smoothing filter (Fejér, Lanczos) trades the spike for a slower approach to the wave; nothing that keeps the partial sums as they are removes it.

    Fejer summation (a positive kernel) removes the overshoot and Lanczos sigma factors reduce it.

    Wikipedia, Gibbs phenomenon (overshoot 0.089489872... of the jump; Wilbraham-Gibbs constant Si(pi)=1.851937...; first maximum at x0 + L/(2N); Fejer/sigma-approximation), https://en.wikipedia.org/wiki/Gibbs_phenomenon; Wikipedia, Square wave: Fourier series 4/pi sum sin((2k-1)x)/(2k-1), odd harmonics only, https://en.wikipedia.org/wiki/Square_wave_(waveform)

  53. not-checkable The Gibbs overshoot never shrinks

    The peak of a thousand harmonics, summed directly, matches the integral computed by Simpson's rule with 2000 panels to a millionth.

    Describes the program's check; I computed that the m = 1000 peak differs from (2/pi)Si(pi) by 8.3e-8, consistent with it.

  54. not-checkable Which root does Newton's method find?

    Near a root the answer is obvious.

    Rhetorical lead-in.

  55. verified Which root does Newton's method find?

    Along the lines between them it is a fractal: every boundary point touches all three basins.

    The basins share a common boundary, the Julia set, and each point of it is an accumulation point of all three basins (Wada property).

    Wikipedia, Newton fractal (the Fatou sets share a common boundary, the Julia set; each Julia-set point is an accumulation point of every basin), https://en.wikipedia.org/wiki/Newton_fractal

  56. verified Which root does Newton's method find?

    Newton's step for z3−1z^3 - 1 is z→z−(z3−1)/(3z2)=(2z3+1)/(3z2)z \to z - (z^3 - 1)/(3z^2) = (2z^3 + 1)/(3z^2).

    z - (z^3-1)/(3z^2) = (2z^3+1)/(3z^2) by direct algebra.

    Wikipedia, Newton fractal (the Fatou sets share a common boundary, the Julia set; each Julia-set point is an accumulation point of every basin), https://en.wikipedia.org/wiki/Newton_fractal; Direct symbolic expansion (sympy) done in this check

  57. not-checkable How far a finite-difference Hamiltonian's levels sit below n + 1/2

    How low is predictable.

    Transition.

  58. verified How far a finite-difference Hamiltonian's levels sit below n + 1/2

    The three-point second difference is ∂x2+h212∂x4+…\partial_x^2 + \tfrac{h^2}{12} \partial_x^4 + \dots, so the grid Hamiltonian is the true one plus −h224 p4-\tfrac{h^2}{24}\, p^4.

    The truncation term (h^2/12) f'''' gives -1/2 D2 = -1/2 d^2 - (h^2/24) d^4, and d^4 = p^4.

    Central second difference: [f(x+h)-2f(x)+f(x-h)]/h^2 = f'' + (h^2/12) f'''' + O(h^4), Langtangen, Truncation Error Analysis (INF5620 notes), http://hplgit.github.io/INF5620/doc/pub/H14/trunc/html/._main_trunc001.html (via search summary)

  59. verified How far a finite-difference Hamiltonian's levels sit below n + 1/2

    To first order the level moves by the expectation of that, and for the oscillator ⟨n∣p4∣n⟩=34(2n2+2n+1)\langle n | p^4 | n \rangle = \tfrac34 (2n^2 + 2n + 1).

    <n|p^4|n> = (3/4)(2n^2+2n+1); I computed the diagonal of p^4 with ladder-operator matrices for n = 0..5, and it matches.

    <n|x^4|n> = (3/4)(hbar/m omega)^2 (2n^2+2n+1), confirmed numerically with ladder-operator matrices in this check; by x<->p symmetry of H the same holds for p^4 in units m=omega=hbar=1

  60. plausible How far a finite-difference Hamiltonian's levels sit below n + 1/2

    The grid's error is a small perturbation of the Hamiltonian, so the perturbation theory used for the Stark shift predicts it.

    The first-order shift -(h^2/24)(3/4)(2n^2+2n+1) = -(h^2/32)(2n^2+2n+1) follows; first-order perturbation theory is standard (e.g. Griffiths, Introduction to QM, Ch. 7), not accessed; from general knowledge.

    Central second difference: [f(x+h)-2f(x)+f(x-h)]/h^2 = f'' + (h^2/12) f'''' + O(h^4), Langtangen, Truncation Error Analysis (INF5620 notes), http://hplgit.github.io/INF5620/doc/pub/H14/trunc/html/._main_trunc001.html (via search summary); <n|x^4|n> = (3/4)(hbar/m omega)^2 (2n^2+2n+1), confirmed numerically with ladder-operator matrices in this check; by x<->p symmetry of H the same holds for p^4 in units m=omega=hbar=1

  61. verified Pi from escape counts at the cusp of the Mandelbrot set

    It tends to π\pi.

    The pi-Theorem: lim sqrt(eps) N(eps) = pi for c = 1/4 + eps.

    Klebanoff, 'pi in the Mandelbrot set', Fractals 9(4) (2001) 393-402, p. 395 pi-Theorem and Lemma 1 (dx/dt = (x-1/2)^2 + eps near the tangent fixed point x=1/2 of x^2+1/4), https://www.doc.ic.ac.uk/~jb/teaching/jmc/pi-in-mandelbrot.pdf

  62. verified Pi from escape counts at the cusp of the Mandelbrot set

    At c=14c = \tfrac14 the map has a fixed point at z=12z = \tfrac12 where its slope is exactly 1, and the orbit from z=0z = 0 climbs toward it in ever smaller steps without ever passing it.

    At c = 1/4 the graph of x^2 + 1/4 touches y = x at x = 1/2 (slope 1), and the orbit of 0 increases monotonically toward it.

    Klebanoff, 'pi in the Mandelbrot set', Fractals 9(4) (2001) 393-402, p. 395 pi-Theorem and Lemma 1 (dx/dt = (x-1/2)^2 + eps near the tangent fixed point x=1/2 of x^2+1/4), https://www.doc.ic.ac.uk/~jb/teaching/jmc/pi-in-mandelbrot.pdf

  63. verified Pi from escape counts at the cusp of the Mandelbrot set

    Raise cc by ε\varepsilon and the fixed point disappears, but near z=12z = \tfrac12 each step still moves zz only a little.

    For eps > 0 there is no real fixed point, but most iterations are close to x = 1/2.

    Klebanoff, 'pi in the Mandelbrot set', Fractals 9(4) (2001) 393-402, p. 395 pi-Theorem and Lemma 1 (dx/dt = (x-1/2)^2 + eps near the tangent fixed point x=1/2 of x^2+1/4), https://www.doc.ic.ac.uk/~jb/teaching/jmc/pi-in-mandelbrot.pdf

  64. verified Pi from escape counts at the cusp of the Mandelbrot set

    The number of steps to get through is ∫−∞∞dw/(w2+ε)=π/ε\int_{-\infty}^{\infty} dw / (w^2 + \varepsilon) = \pi / \sqrt{\varepsilon}.

    Lemma 1: the continuous passage time satisfies sqrt(eps) T(eps) -> pi, i.e. the integral of dw/(w^2+eps) is pi/sqrt(eps).

    Klebanoff, 'pi in the Mandelbrot set', Fractals 9(4) (2001) 393-402, p. 395 pi-Theorem and Lemma 1 (dx/dt = (x-1/2)^2 + eps near the tangent fixed point x=1/2 of x^2+1/4), https://www.doc.ic.ac.uk/~jb/teaching/jmc/pi-in-mandelbrot.pdf

  65. verified The Runge phenomenon, where more points give a worse fit

    Interpolate 1/(1+25x2)1/(1 + 25x^2) by a polynomial through equally spaced points and the error grows as you add points.

    The classic Runge example: equispaced interpolation of 1/(1+25x^2) diverges near the ends.

    Wikipedia, Runge's phenomenon (1/(1+25x^2) at equispaced nodes diverges; Lebesgue constant grows exponentially; Chebyshev nodes converge), https://en.wikipedia.org/wiki/Runge%27s_phenomenon

  66. verified The Runge phenomenon, where more points give a worse fit

    The function has poles at x=±i/5x = \pm i/5.

    1 + 25x^2 = 0 at x = +-i/5.

    Wikipedia, Runge's phenomenon (1/(1+25x^2) at equispaced nodes diverges; Lebesgue constant grows exponentially; Chebyshev nodes converge), https://en.wikipedia.org/wiki/Runge%27s_phenomenon

  67. verified The Runge phenomenon, where more points give a worse fit

    Polynomial interpolation in Chebyshev points converges like ρ−n\rho^{-n}, where ρ\rho is the size of the largest ellipse with foci ±1\pm 1 that the function is analytic inside.

    Here 'size' means rho, the sum of the ellipse's semi-axes.

    Trefethen, ATAP, Theorem 8.2 (Chebyshev interpolants of functions analytic in the Bernstein ellipse E_rho, foci +-1, semi-axes summing to rho, converge as O(rho^-n)); confirmed via search summary, https://people.maths.ox.ac.uk/~trefethen/trefethen_sample.pdf

  68. verified The Runge phenomenon, where more points give a worse fit

    Both interpolants use the barycentric formula, which is stable in Chebyshev points.

    Replaces disputed 1253cbdbe71f. The claim is now limited to Chebyshev points, where ATAP says the formula is stable.

    Trefethen, Approximation Theory and Approximation Practice, Ch. 5, p. 37 (read from the PDF): barycentric interpolation in Chebyshev points 'is numerically stable'; (5.9) and (5.11)-(5.13) 'proved stable in floating point arithmetic for all x in [-1, 1]' [Rack & Reimer 1982, Higham 2004], https://people.maths.ox.ac.uk/trefethen/ATAP/ATAPfirst6chapters.pdf; posts/2026-09-21-runge-phenomenon.viv interpolate(): the second-kind formula sum(w f/(x-xj)) / sum(w/(x-xj))

  69. verified The Runge phenomenon, where more points give a worse fit

    With equally spaced points the problem is ill-conditioned (its Lebesgue constant grows exponentially with nn), and this formula adds rounding error of its own.

    Replaces disputed 1253cbdbe71f. The program uses the second-kind formula (5.11) with equispaced weights (-1)^j C(n,j), so it adds error of its own on top of an exponentially ill-conditioned problem.

    Trefethen, ATAP Ch. 5, p. 37: (5.11) 'is unstable even for interpolation when used with arbitrary points rather than points suitably clustered like Chebyshev points'; 'important to use (5.9) rather than (5.11) for computing interpolants through equispaced points', where 'the problem is probably so ill-conditioned', https://people.maths.ox.ac.uk/trefethen/ATAP/ATAPfirst6chapters.pdf; Chebfun example 'Lebesgue functions and Lebesgue constants' (read), after ATAP Ch. 15: 'for n equispaced points it is 2^n/(e n log(n))', https://www.chebfun.org/examples/approx/LebesgueConst.html

  70. not-checkable The eigenvalues of a random matrix fill Wigner's semicircle

    They do not scatter.

    Rhetorical lead-in.

  71. verified The eigenvalues of a random matrix fill Wigner's semicircle

    They fill the semicircle 12π4−x2\tfrac{1}{2\pi}\sqrt{4 - x^2}, whatever distribution the entries came from.

    Wigner's law holds for iid mean-zero entries of variance 1 (with mild moment conditions), with limit (1/2pi)sqrt(4-x^2); the next sentence says only the variance matters.

    Petrov, Lectures on Random Matrices (2025), Lecture 2, Sec. 1 (Wigner matrices: iid entries mean 0 variance sigma^2; semicircle (1/2pi)sqrt(4-x^2) on [-2,2]; moments -> rooted planar trees, Sec. 2.2 Catalan numbers), https://lpetrov.cc/rmt25/rmt25-notes/rmt2025-l02.pdf; Wikipedia, Wigner semicircle distribution (R=2 even moments are Catalan numbers 1, 2, 5, 14), https://en.wikipedia.org/wiki/Wigner_semicircle_distribution

  72. plausible The eigenvalues of a random matrix fill Wigner's semicircle

    The even moments of the semicircle are the Catalan numbers 1,2,5,…1, 2, 5, \dots because 1NTr H2k\tfrac1N \mathrm{Tr}\, H^{2k} counts closed walks that never cross themselves.

    The even moments are Catalan numbers, but the walks that survive as N -> infinity are closed walks tracing a planar tree with each edge used exactly twice (non-crossing pairings); 'never cross themselves' is a loose description, and Tr H^2k/N counts all closed walks before the limit.

    Petrov, Lectures on Random Matrices (2025), Lecture 2, Sec. 1 (Wigner matrices: iid entries mean 0 variance sigma^2; semicircle (1/2pi)sqrt(4-x^2) on [-2,2]; moments -> rooted planar trees, Sec. 2.2 Catalan numbers), https://lpetrov.cc/rmt25/rmt25-notes/rmt2025-l02.pdf; Wikipedia, Wigner semicircle distribution (R=2 even moments are Catalan numbers 1, 2, 5, 14), https://en.wikipedia.org/wiki/Wigner_semicircle_distribution

  73. verified Building a four-bit adder out of NAND gates

    A NAND gate wires into NOT, AND, OR and XOR.

    NAND is functionally complete; NOT, AND, OR, XOR are standard NAND constructions.

    Wikipedia, NAND logic (NAND is functionally complete; NOT, AND, OR, XOR from NAND), https://en.wikipedia.org/wiki/NAND_logic

  74. verified Building a four-bit adder out of NAND gates

    Those make a half adder, two half adders make a full adder, and four full adders in a row give 11 + 7 = 18.

    A full adder is two half adders plus an OR gate on the carries; 11 + 7 = 18 = 10010 in binary with carry out.

    Wikipedia, Adder (electronics) (full adder from two half adders and an OR; ripple-carry critical path 3 + 31x2 = 65 gate delays for 32 bits, i.e. 2 gate delays of carry propagation per full adder; carry-lookahead), https://en.wikipedia.org/wiki/Adder_(electronics)

  75. not-checkable Building a four-bit adder out of NAND gates

    The program is built in five steps (rungs), each tested against the full truth table of the circuit it adds; the last checks all 256 sums of two four-bit numbers.

    Describes the program; 16 x 16 = 256 pairs.

  76. plausible Building a four-bit adder out of NAND gates

    That models a circuit at the level of logic gates, above transistors and below an instruction set.

    Gate-level logic sits between device/transistor level and architecture in the usual abstraction stack (e.g. Harris & Harris, Digital Design and Computer Architecture, Ch. 1), not accessed; from general knowledge.

    Wikipedia, NAND logic (NAND is functionally complete; NOT, AND, OR, XOR from NAND), https://en.wikipedia.org/wiki/NAND_logic

  77. verified Building a four-bit adder out of NAND gates

    The last rung draws three pictures: the wiring of one column (one full adder), a timing diagram of that column as its three inputs count from 000 to 111, and the sum 11 + 7, where the carry has to pass through all four columns, one full-adder carry delay (two gate levels) each.

    Replaces disputed ffbc4f4a407a. Each column's carry passes two gate levels (AND, OR); the say() line after the figure now says 'four carry delays'.

    Wikipedia, 'Adder (electronics)', ripple-carry adder: '3 + 31 x 2 (for carry propagation in latter adders) = 65 gate delays', T_CRA(n) = 3D + (n-1)2D, https://en.wikipedia.org/wiki/Adder_(electronics); posts/2026-09-22-building-a-four-bit-adder-out-of-nand-gates.viv: full_carry = gate_or(half_carry(a, b), half_carry(gate_xor(a, b), cin)), an AND then an OR on the carry path

  78. verified Building a four-bit adder out of NAND gates

    That delay is what makes this design slow, and it is what a carry-lookahead adder removes.

    Ripple delay grows with width; carry-lookahead computes carries from generate/propagate signals to cut it.

    Wikipedia, Adder (electronics) (full adder from two half adders and an OR; ripple-carry critical path 3 + 31x2 = 65 gate delays for 32 bits, i.e. 2 gate delays of carry propagation per full adder; carry-lookahead), https://en.wikipedia.org/wiki/Adder_(electronics)

  79. verified Building a four-bit adder out of NAND gates

    s=a⊕b⊕cin,cout=ab+cin(a⊕b).s = a \oplus b \oplus c_{\text{in}}, \qquad c_{\text{out}} = ab + c_{\text{in}}(a \oplus b).

    Standard full-adder sum and carry equations.

    Wikipedia, Adder (electronics) (full adder from two half adders and an OR; ripple-carry critical path 3 + 31x2 = 65 gate delays for 32 bits, i.e. 2 gate delays of carry propagation per full adder; carry-lookahead), https://en.wikipedia.org/wiki/Adder_(electronics)

  80. verified Building a four-bit adder out of NAND gates

    That is why this is called a ripple-carry adder, and why a carry-lookahead adder computes the carries instead of passing them along.

    Ripple-carry passes the carry column to column; carry-lookahead computes the carries directly.

    Wikipedia, Adder (electronics) (full adder from two half adders and an OR; ripple-carry critical path 3 + 31x2 = 65 gate delays for 32 bits, i.e. 2 gate delays of carry propagation per full adder; carry-lookahead), https://en.wikipedia.org/wiki/Adder_(electronics)

  81. verified Building a four-bit adder out of NAND gates

    The test checks all 256 pairs of four-bit numbers, the fifth bit (the carry out) included.

    Replaces disputed ed69ce71a206.

    posts/2026-09-22-building-a-four-bit-adder-out-of-nand-gates.viv, the ripple-adder test: r[0] + 16 * r[1] == a + b for a, b in 0..15 (256 pairs); the carry out is worth 16, the fifth bit

  82. not-checkable A cart-pole, balanced by a PD controller

    The pole starts 15 degrees from upright.

    Initial condition of this program (0.2618 rad = 15 degrees in the code).

  83. not-checkable A cart-pole, balanced by a PD controller

    A controller that pushes the cart in proportion to the pole's angle and rate, and a little toward the origin, catches it in under two seconds and holds it.

    Describes this simulation's outcome.

  84. not-checkable A cart-pole, balanced by a PD controller

    At a fifth of the gains it falls.

    Describes this simulation's outcome at gain 0.2.

  85. verified A cart-pole, balanced by a PD controller

    The force is F=kθθ+kθ˙θ˙+kxx+kx˙x˙F = k_\theta \theta + k_{\dot\theta} \dot\theta + k_x x + k_{\dot x} \dot x, with the cart terms small and positive: to move the cart left toward the origin, the controller must first lean the pole left, and the way to do that is a push to the right.

    The cart-pole is non-minimum phase: moving the cart one way requires first moving it the other way to tilt the pole; with the library's sign convention, positive K_X pushes right when x > 0, which tips the pole left as described.

    MathWorks, 'Control Systems in Practice, Part 6: What Are Non-Minimum Phase Systems?', https://www.mathworks.com/videos/control-systems-in-practice-part-6-what-are-non-minimum-phase-systems-1574922412196.html (read via search summary); lib/cartpole.viv in this repo (theta > 0 leans right; a positive force accelerates the cart right and makes thetadd negative)

  86. not-checkable A cart-pole, balanced by a PD controller

    The gains are top-level constants, so viv run --set K_THETA=30 ... tries another controller without editing the program.

    Describes the program's CLI and constants.

  87. not-checkable A cart-pole, balanced by a PD controller

    Simulate from 15 degrees with the gains scaled by gain; draw when draw is true.

    Describes the program's run function.

  88. verified Compound interest

    Interest added nn times a year is r/nr/n each time, applied ntnt times over tt years.

    Periodic compounding applies rate r/n for nt periods: A = P(1+r/n)^(nt).

    Wikipedia, 'Compound interest', periodic compounding A = P(1+r/n)^(nt) and continuous limit P e^(rt), https://en.wikipedia.org/wiki/Compound_interest

  89. verified Compound interest

    Monthly beats annual by 1647.01−1628.89=18.121647.01 - 1628.89 = 18.12 dollars here.

    The two balances round to 1628.89 and 1647.01, and the arithmetic of those rounded balances is 18.12 (the unrounded gap is 18.11).

    Wikipedia, 'Compound interest', periodic compounding A = P(1+r/n)^(nt), https://en.wikipedia.org/wiki/Compound_interest; Recomputed in Python 3 in this session: 1000*1.05**10 = 1628.8946, 1000*(1+0.05/12)**120 = 1647.0095

  90. verified Compound interest

    Weekly beats monthly by less, daily by less again, and no matter how often the interest is added the balance never passes Pert=$1648.72Pe^{rt} = \$1648.72. Once the tests pass, try a few values of nn to see it approach that limit.

    The balance increases with n toward the continuous-compounding limit P e^(rt) = 1000 e^0.5 = 1648.72; each increase in frequency gains less.

    Wikipedia, 'Compound interest', periodic compounding A = P(1+r/n)^(nt) and continuous limit P e^(rt), https://en.wikipedia.org/wiki/Compound_interest; Recomputed in Python 3 (math.log, math.exp)

  91. verified Compound interest

    years_to_double is the question the doubling-time post answers: tt is in the exponent, and taking the logarithm of both sides brings it down.

    Cross-reference to another post; the math (log power rule brings the exponent down) is standard.

    Wikipedia, 'Logarithm', 'Logarithmic identities' (power rule) and 'Change of base', https://en.wikipedia.org/wiki/Logarithm

  92. verified Doubling time

    Something growing 7% a year doubles in ln⁡2/ln⁡1.07=10.24\ln 2 / \ln 1.07 = 10.24 years, not 100/7=14.3100/7 = 14.3: growth compounds.

    ln 2 / ln 1.07 = 10.245 and 100/7 = 14.29; the naive linear estimate overstates the doubling time.

    Wikipedia, 'Rule of 72', derivation (t = ln 2 / ln(1+r), ln(1+r) ~ r, ln 2 ~ 0.693) and rule of 70, https://en.wikipedia.org/wiki/Rule_of_72; Recomputed in Python 3 (math.log, math.exp)

  93. verified Doubling time

    The logarithm is the tool that turns "how long until" into a division, and the rule of 70 is that division with ln⁡2≈0.7\ln 2 \approx 0.7 and ln⁡(1+r)≈r\ln(1 + r) \approx r.

    The rule of 70 follows from t = ln 2 / ln(1+r) with ln 2 ~ 0.7 and ln(1+r) ~ r.

    Wikipedia, 'Rule of 72', derivation (t = ln 2 / ln(1+r), ln(1+r) ~ r, ln 2 ~ 0.693) and rule of 70, https://en.wikipedia.org/wiki/Rule_of_72

  94. verified Doubling time

    Growth by a fixed fraction each year is A(t)=A0(1+r)tA(t) = A_0 (1 + r)^t.

    Growth at fixed fraction r per period gives A0 (1+r)^t.

    Wikipedia, 'Rule of 72', derivation (t = ln 2 / ln(1+r), ln(1+r) ~ r, ln 2 ~ 0.693) and rule of 70, https://en.wikipedia.org/wiki/Rule_of_72

  95. verified Doubling time

    Asking when A(t)=2A0A(t) = 2 A_0 means solving (1+r)t=2(1 + r)^t = 2 for tt, and tt is in the exponent; the logarithm brings it down:

    Doubling means (1+r)^t = 2; the log power rule brings t down.

    Wikipedia, 'Logarithm', 'Logarithmic identities' (power rule) and 'Change of base', https://en.wikipedia.org/wiki/Logarithm

  96. verified Doubling time

    tln⁡(1+r)=ln⁡2⟹t=ln⁡2ln⁡(1+r).t \ln(1 + r) = \ln 2 \qquad\Longrightarrow\qquad t = \frac{\ln 2}{\ln(1 + r)}.

    t = ln 2 / ln(1+r), standard.

    Wikipedia, 'Rule of 72', derivation (t = ln 2 / ln(1+r), ln(1+r) ~ r, ln 2 ~ 0.693) and rule of 70, https://en.wikipedia.org/wiki/Rule_of_72; Wikipedia, 'Logarithm', 'Logarithmic identities' (power rule) and 'Change of base', https://en.wikipedia.org/wiki/Logarithm

  97. verified Doubling time

    Any base works, since a ratio of logs does not depend on the base.

    Change of base: log_b x = log_k x / log_k b, so a ratio of logs is base-independent.

    Wikipedia, 'Logarithm', 'Logarithmic identities' (power rule) and 'Change of base', https://en.wikipedia.org/wiki/Logarithm

  98. verified Doubling time

    For small rr, ln⁡(1+r)≈r\ln(1 + r) \approx r and ln⁡2≈0.693\ln 2 \approx 0.693, so t≈70/(100r)t \approx 70 / (100 r): the rule of 70.

    ln 2 ~ 0.693 and ln(1+r) ~ r give t ~ 69.3/(100r), rounded to the rule of 70.

    Wikipedia, 'Rule of 72', derivation (t = ln 2 / ln(1+r), ln(1+r) ~ r, ln 2 ~ 0.693) and rule of 70, https://en.wikipedia.org/wiki/Rule_of_72

  99. verified Doubling time

    It is 2.4% off at 7% and 0.5% off at 3%, and a test checks both.

    At 7%: rule gives 10.0 vs exact 10.245, 2.39% low; at 3%: 23.33 vs 23.45, 0.50% low.

    Recomputed in Python 3 (math.log, math.exp)

  100. verified Doubling time

    70/(100r)70 / (100r): the same thing with ln⁡2≈0.7\ln 2 \approx 0.7 and ln⁡(1+r)≈r\ln(1+r) \approx r.

    Same approximation as the rule of 70 derivation.

    Wikipedia, 'Rule of 72', derivation (t = ln 2 / ln(1+r), ln(1+r) ~ r, ln 2 ~ 0.693) and rule of 70, https://en.wikipedia.org/wiki/Rule_of_72

  101. verified LQR computes the cart-pole's gains from the Riccati equation

    Linearize the same dynamics, choose how much each state error and each unit of push should cost, and the Riccati equation gives the gains instead.

    LQR: linearize, choose Q and R, and the Riccati equation yields the optimal gain K.

    Tedrake, Underactuated Robotics, ch. 'Linear Quadratic Regulators', sections 'Basic Derivation' (J* = x'Sx, K = R^-1 B'S) and 'Finite-horizon LQR' (Riccati ODE converges to the infinite-horizon solution), https://underactuated.csail.mit.edu/lqr.html; Wikipedia, 'Linear-quadratic regulator', infinite-horizon continuous-time section (K = R^-1 B'P, algebraic Riccati equation), citing Kwakernaak & Sivan (1972), https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator

  102. verified LQR computes the cart-pole's gains from the Riccati equation

    Linearize the cart-pole about the upright and you have z˙=Az+Bu\dot z = Az + Bu.

    Linearization about an equilibrium gives z' = Az + Bu; K = R^-1 B'P with P solving the algebraic Riccati equation.

    Tedrake, Underactuated Robotics, ch. 'Linear Quadratic Regulators', sections 'Basic Derivation' (J* = x'Sx, K = R^-1 B'S) and 'Finite-horizon LQR' (Riccati ODE converges to the infinite-horizon solution), https://underactuated.csail.mit.edu/lqr.html; Wikipedia, 'Linear-quadratic regulator', infinite-horizon continuous-time section (K = R^-1 B'P, algebraic Riccati equation), citing Kwakernaak & Sivan (1972), https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator

  103. verified LQR computes the cart-pole's gains from the Riccati equation

    The only choices made by hand are QQ and RR, and they state the tradeoff directly: angle error against cart position, and state error against force.

    In LQR the only design choices are the weights Q and R; the gains follow from the Riccati solution.

    Tedrake, Underactuated Robotics, ch. 'Linear Quadratic Regulators', sections 'Basic Derivation' (J* = x'Sx, K = R^-1 B'S) and 'Finite-horizon LQR' (Riccati ODE converges to the infinite-horizon solution), https://underactuated.csail.mit.edu/lqr.html

  104. not-checkable LQR computes the cart-pole's gains from the Riccati equation

    AA and BB are not written out here.

    Describes what the post shows.

  105. verified LQR computes the cart-pole's gains from the Riccati equation

    PP comes from integrating the differential Riccati equation backwards until it stops changing, which takes only matrix multiplication and addition.

    Tedrake states the finite-horizon Riccati ODE solution converges to the infinite-horizon solution as the horizon grows; with scalar R, the right-hand side needs only matrix products, sums and a scalar division.

    Tedrake, Underactuated Robotics, ch. 'Linear Quadratic Regulators', sections 'Basic Derivation' (J* = x'Sx, K = R^-1 B'S) and 'Finite-horizon LQR' (Riccati ODE converges to the infinite-horizon solution), https://underactuated.csail.mit.edu/lqr.html

  106. verified LQR computes the cart-pole's gains from the Riccati equation

    The hand-tuned gains also balance the pole; the Riccati gains are the ones that minimize the cost set by QQ and RR.

    LQR gains minimize the quadratic cost for the linearized system; that the hand-tuned gains also balance is shown by the run.

    Tedrake, Underactuated Robotics, ch. 'Linear Quadratic Regulators', sections 'Basic Derivation' (J* = x'Sx, K = R^-1 B'S) and 'Finite-horizon LQR' (Riccati ODE converges to the infinite-horizon solution), https://underactuated.csail.mit.edu/lqr.html; Wikipedia, 'Linear-quadratic regulator', infinite-horizon continuous-time section (K = R^-1 B'P, algebraic Riccati equation), citing Kwakernaak & Sivan (1972), https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator

  107. not-checkable A Lennard-Jones liquid by molecular dynamics in two dimensions

    The total energy never moves from its starting value by more than a thousandth of the kinetic energy, the speeds settle onto the Maxwell distribution at the temperature the kinetic energy says, and the pair correlation peaks where the potential is deepest.

    Summary of this simulation's results, checked by its tests.

  108. verified A Lennard-Jones liquid by molecular dynamics in two dimensions

    The box is periodic with the minimum-image rule, there is no cutoff (every pair, NN small), and the integrator is velocity Verlet, which is symplectic: the energy wobbles but does not drift.

    Velocity Verlet is symplectic and second order, and its energy error oscillates without secular drift for smooth Hamiltonian systems. With minimum image and no cutoff, the pair force is truncated at the half-box, which can add small energy errors.

    Hairer, Lubich, Wanner, 'Geometric numerical integration illustrated by the Stormer-Verlet method', Acta Numerica 12 (2003) 399-450; via Wikipedia 'Verlet integration', https://en.wikipedia.org/wiki/Verlet_integration

  109. verified A Lennard-Jones liquid by molecular dynamics in two dimensions

    Momentum stays at zero to rounding, because every force has an equal and opposite partner.

    Pairwise antisymmetric forces sum to zero, so velocity Verlet conserves total linear momentum exactly up to rounding; the code starts with zero total momentum.

    Hairer, Lubich, Wanner, 'Geometric numerical integration illustrated by the Stormer-Verlet method', Acta Numerica 12 (2003) 399-450; via Wikipedia 'Verlet integration', https://en.wikipedia.org/wiki/Verlet_integration

  110. not-checkable A Lennard-Jones liquid by molecular dynamics in two dimensions

    The fourth test checks the position and height of that peak.

    Describes the post's test.

  111. not-checkable A Lennard-Jones liquid by molecular dynamics in two dimensions

    The force loop is written with arrays: for each atom, the displacements to all the others are one array, the minimum image is one line, and the pair forces are a pow and two products.

    Describes the program's code.

  112. not-checkable A Lennard-Jones liquid by molecular dynamics in two dimensions

    The post also shows a recorded run of the same program at 400 atoms and three times the steps (the large setting), compiled to C and run natively; 100 atoms takes a few seconds in a browser tab.

    Describes the recorded large-scale run; the 21-second runtime was dropped because nothing records it.

  113. not-checkable Building the derivative from its definition

    The derivative is a good thing to build this way because each improvement is a few lines, and each has an error you can work out by hand before running anything.

    Rhetorical motivation for the post's structure.

  114. verified Building the derivative from its definition

    4(3x2+h24)−(3x2+h2)3=3x2.\frac{4\left(3x^2 + \tfrac{h^2}{4}\right) - \left(3x^2 + h^2\right)}{3} = 3x^2.

    For f = x^3 the centered difference is 3x^2 + h^2, so (4(3x^2 + h^2/4) - (3x^2 + h^2))/3 = 3x^2, which is Richardson extrapolation.

    Wikipedia, 'Richardson extrapolation', (4A(h/2) - A(h))/3 for t = 2, k0 = 2, citing Richardson & Gaunt (1927), https://en.wikipedia.org/wiki/Richardson_extrapolation

  115. verified Building the derivative from its definition

    On a log-log plot they are lines of slope 1, 2 and 4, and the figure draws them from h=0.4h = 0.4 down to h=0.0125h = 0.0125.

    Forward, centered and extrapolated differences have errors O(h), O(h^2), O(h^4); the code's h = 0.4/2^i for i = 0..5 ends at 0.0125.

    Wikipedia, 'Richardson extrapolation', (4A(h/2) - A(h))/3 for t = 2, k0 = 2, citing Richardson & Gaunt (1927), https://en.wikipedia.org/wiki/Richardson_extrapolation

  116. verified The geometric series adds up

    The trick that gives the formula: multiply Sn=a+ar+⋯+arn−1S_n = a + ar + \cdots + ar^{n-1} by rr and subtract.

    Standard derivation of the finite geometric sum.

    Wikipedia, 'Geometric series', closed form by multiplying by r and subtracting, https://en.wikipedia.org/wiki/Geometric_series

  117. verified The geometric series adds up

    Every term cancels except the first of SnS_n and the last of rSnrS_n:

    S_n - rS_n = a - ar^n: only the first term of S_n and the last of rS_n survive.

    Wikipedia, 'Geometric series', closed form by multiplying by r and subtracting, https://en.wikipedia.org/wiki/Geometric_series

  118. verified The geometric series adds up

    Sn−rSn=a−arn⟹Sn=a 1−rn1−r.S_n - rS_n = a - ar^n \qquad\Longrightarrow\qquad S_n = a\,\frac{1 - r^n}{1 - r}.

    S_n = a(1 - r^n)/(1 - r) for n terms a..ar^(n-1).

    Wikipedia, 'Geometric series', closed form by multiplying by r and subtracting, https://en.wikipedia.org/wiki/Geometric_series

  119. verified The geometric series adds up

    The r=0.9r = 0.9 series takes 44 terms to get within 1% of its limit; the r=1/2r = 1/2 series takes 7.

    Within 1% needs r^n < 0.01: n > 43.7 for r = 0.9 (44 terms) and n > 6.64 for r = 1/2 (7 terms).

    Wikipedia, 'Geometric series', closed form by multiplying by r and subtracting, https://en.wikipedia.org/wiki/Geometric_series; Recomputed in Python 3 (math.log, math.exp)

  120. verified Two lines cross

    Two straight lines, ax+by=cax + by = c and dx+ey=fdx + ey = f, meet at one point unless they are parallel.

    Two lines meet at a unique point exactly when the determinant is nonzero; the zero-determinant case includes coincident lines (infinitely many common points), which 'parallel' covers only informally.

    Wikipedia, 'Cramer's rule', 2x2 case and the zero-determinant (parallel/coincident) discussion, https://en.wikipedia.org/wiki/Cramer%27s_rule

  121. plausible Two lines cross

    Elimination, substitution, Cramer's rule: they are the same arithmetic in three arrangements, and any of them solves this.

    All three methods solve the 2x2 system and reduce to the same ratios; 'same arithmetic' is an informal but fair description.

    Wikipedia, 'Cramer's rule', 2x2 case and the zero-determinant (parallel/coincident) discussion, https://en.wikipedia.org/wiki/Cramer%27s_rule

  122. verified Two lines cross

    The lines x+y=5x + y = 5 and x−y=1x - y = 1 cross at (3,2)(3, 2), and so do 2x+3y=122x + 3y = 12 and x−y=1x - y = 1: a different pair of lines through the same point.

    3+2 = 5, 3-2 = 1, 2*3 + 3*2 = 12: both pairs pass through (3, 2).

    Recomputed in Python 3 (math.log, math.exp)

  123. verified Two lines cross

    A third pair crosses at (2,1)(2, 1), so an answer that always returns (3,2)(3, 2) fails.

    3*2 - 2*1 = 4 and 5*2 + 4*1 = 14, so the third pair crosses at (2, 1).

    Recomputed in Python 3 (math.log, math.exp)

  124. verified Two lines cross

    Slide one line until it is parallel to the other and the crossing runs off to infinity; something in the arithmetic must have gone to zero at that moment.

    By Cramer's rule the solution is a ratio with the determinant in the denominator, which vanishes when the lines become parallel.

    Wikipedia, 'Cramer's rule', 2x2 case and the zero-determinant (parallel/coincident) discussion, https://en.wikipedia.org/wiki/Cramer%27s_rule

  125. verified A swing-up policy trained offline

    An acrobot is two links with one motor, at the elbow; the shoulder turns freely.

    Tedrake: a two-link arm with an actuator at the elbow and none at the shoulder.

    Tedrake, Underactuated Robotics, ch. 'Acrobots, Cart-Poles, and Quadrotors', sections 'The Acrobot' and 'LQR feedback', https://underactuated.csail.mit.edu/acrobot.html

  126. verified A swing-up policy trained offline

    A linear controller can balance it only near upright, so from hanging down it first has to swing itself up.

    LQR balancing is local to the upright; swing-up controllers bring the acrobot near the top and then switch to LQR.

    Tedrake, Underactuated Robotics, ch. 'Acrobots, Cart-Poles, and Quadrotors', sections 'The Acrobot' and 'LQR feedback', https://underactuated.csail.mit.edu/acrobot.html; Tedrake, Underactuated Robotics, ch. 'Lyapunov Analysis', section 'Regions of attraction and LQR', https://underactuated.csail.mit.edu/lyapunov.html

  127. not-checkable A swing-up policy trained offline

    The swing-up controller here was not derived: it is nine weights found offline by a cross-entropy search over 1600 simulated swings, run as compiled native code, and the page contains only those nine numbers.

    Describes how the nine weights were produced offline; the search is not in the repository.

  128. verified A swing-up policy trained offline

    The acrobot is like a gymnast on a high bar who can bend only at the hips.

    Tedrake compares the acrobot to a gymnast on a bar controlling motion at the waist.

    Tedrake, Underactuated Robotics, ch. 'Acrobots, Cart-Poles, and Quadrotors', sections 'The Acrobot' and 'LQR feedback', https://underactuated.csail.mit.edu/acrobot.html

  129. verified A swing-up policy trained offline

    It is two links hinged end to end; the shoulder joint turns freely and the elbow has a motor.

    Matches the standard acrobot definition.

    Tedrake, Underactuated Robotics, ch. 'Acrobots, Cart-Poles, and Quadrotors', sections 'The Acrobot' and 'LQR feedback', https://underactuated.csail.mit.edu/acrobot.html

  130. verified A swing-up policy trained offline

    Its state is (q1,q2,q˙1,q˙2)(q_1, q_2, \dot q_1, \dot q_2) and its input is a single torque, so the shoulder moves only through its coupling to the elbow.

    State (q1, q2, q1dot, q2dot) with a single elbow torque; the torque reaches the shoulder only through dynamic coupling (gravity also acts on it).

    Tedrake, Underactuated Robotics, ch. 'Acrobots, Cart-Poles, and Quadrotors', sections 'The Acrobot' and 'LQR feedback', https://underactuated.csail.mit.edu/acrobot.html

  131. verified A swing-up policy trained offline

    A linear balancing controller works only near the upright, and the arm starts hanging straight down, far outside that region.

    A linear controller's region of attraction on the nonlinear system is local, and hanging down is far from upright.

    Tedrake, Underactuated Robotics, ch. 'Lyapunov Analysis', section 'Regions of attraction and LQR', https://underactuated.csail.mit.edu/lyapunov.html

  132. verified A swing-up policy trained offline

    So it takes two controllers and a rule for when to switch from one to the other.

    Swing-up plus switching to an LQR balancing controller near the top is the standard approach Tedrake describes.

    Tedrake, Underactuated Robotics, ch. 'Acrobots, Cart-Poles, and Quadrotors', sections 'The Acrobot' and 'LQR feedback', https://underactuated.csail.mit.edu/acrobot.html

  133. verified A swing-up policy trained offline

    Linearize the dynamics about the upright by central differences on the same chain_rate this page simulates, and the balancing gains come from the Riccati equation (the LQR method).

    Linearize about the upright and solve the Riccati equation for the LQR gains; the finite-difference and Schur details describe this program.

    Tedrake, Underactuated Robotics, ch. 'Linear Quadratic Regulators', sections 'Basic Derivation' (J* = x'Sx, K = R^-1 B'S) and 'Finite-horizon LQR' (Riccati ODE converges to the infinite-horizon solution), https://underactuated.csail.mit.edu/lqr.html; Wikipedia, 'Linear-quadratic regulator', infinite-horizon continuous-time section (K = R^-1 B'P, algebraic Riccati equation), citing Kwakernaak & Sivan (1972), https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator

  134. verified A swing-up policy trained offline

    The Riccati solution also gives the switching rule.

    The LQR cost-to-go serves as a Lyapunov function whose sublevel sets estimate the region where balancing succeeds.

    Tedrake, Underactuated Robotics, ch. 'Lyapunov Analysis', section 'Regions of attraction and LQR', https://underactuated.csail.mit.edu/lyapunov.html

  135. verified A swing-up policy trained offline

    The Riccati matrix PP turns it into one number, δ⊤Pδ\delta^\top P \delta, the cost the balancing controller expects to pay to bring the arm from δ\delta back to upright (its cost-to-go).

    For LQR, the optimal cost-to-go is J*(x) = x'Sx (for the linearized system).

    Tedrake, Underactuated Robotics, ch. 'Linear Quadratic Regulators', sections 'Basic Derivation' (J* = x'Sx, K = R^-1 B'S) and 'Finite-horizon LQR' (Riccati ODE converges to the infinite-horizon solution), https://underactuated.csail.mit.edu/lqr.html

  136. verified A swing-up policy trained offline

    When that number is small enough, the controller brings the arm upright within the torque limit; when it is larger, the controller can fail.

    Replaces disputed 38646ff9b4c8. Below the level the controller succeeds; above it it can fail, not must.

    Tedrake, Underactuated Robotics, ch. 'Lyapunov Analysis' (read): sublevel sets of a Lyapunov function are invariant and serve as inner approximations of the region of attraction, 'guaranteed to be contained within the true region of attraction', https://underactuated.mit.edu/lyapunov.html; posts/2026-09-23-a-swing-up-policy-trained-offline-and-flown-in-the-tab.viv: bisection along 300 directions reports only the smallest failing level, 23.0, so states with larger cost-to-go succeed in other directions

  137. not-checkable A swing-up policy trained offline

    To find how small is small enough (the switching level), the full nonlinear model with the torque limit was simulated offline from states along random directions in the four-dimensional state space, bisecting on the cost-to-go along each, and the level was set below the smallest one at which the controller failed.

    Describes the offline procedure that set the switching level; the search is not in the repository, and the program only uses V_SWITCH = 20.

  138. not-checkable A swing-up policy trained offline

    It is not derived.

    Describes this post's controller.

  139. verified A swing-up policy trained offline

    The nine weights come from a cross-entropy search: sample forty policies from a Gaussian, simulate each one, refit the Gaussian to the best six, and repeat forty times.

    Sample from a Gaussian, evaluate, refit to the elite samples, repeat is the cross-entropy method; 40 x 40 = 1600 simulations.

    de Boer, Kroese, Mannor, Rubinstein, 'A Tutorial on the Cross-Entropy Method', Ann. Oper. Res. 134 (2005) 19-67; via Wikipedia 'Cross-entropy method', https://en.wikipedia.org/wiki/Cross-entropy_method

  140. not-checkable A swing-up policy trained offline

    That is 1600 simulated swings, run as Viv compiled to native code.

    Describes how the weights were produced offline (40 policies x 40 rounds = 1600); the search is not in the repository.

  141. not-checkable A swing-up policy trained offline

    At the end of the six seconds this page simulates, the two joint angles add up to 0.0045 radians from upright and are still closing; with twelve seconds instead of six they reach 2.8×10−72.8 \times 10^{-7}.

    Results of this program's run.

  142. not-checkable A swing-up policy trained offline

    What it does not do.

    Section heading.

  143. not-checkable A swing-up policy trained offline

    The weights were trained from one starting position, and they fail from a nearby one.

    Describes this program's behavior.

  144. plausible A transformer trained with Muon

    The task is to output the previous token, which a transformer can do only by learning to look one position back.

    With random tokens, predicting the previous token requires attending to the position one back; this follows from the task design.

    Wikipedia, 'Attention (machine learning)', scaled dot-product attention and causal mask, pointing to Vaswani et al., 'Attention Is All You Need' (2017), https://en.wikipedia.org/wiki/Attention_(machine_learning)

  145. verified A transformer trained with Muon

    It is trained by Muon, an optimizer that orthogonalizes the momentum with five Newton-Schulz steps before stepping along it.

    Jordan: Muon post-processes the momentum update with about 5 Newton-Schulz steps, replacing it with the nearest semi-orthogonal matrix.

    K. Jordan, 'Muon: An optimizer for hidden layers in neural networks' (2024), https://kellerjordan.github.io/posts/muon/

  146. not-checkable A transformer trained with Muon

    In the attention matrix it ends with, each position puts its weight on the one before it.

    Describes this program's trained attention matrix.

  147. verified A transformer trained with Muon

    A transformer reads a sequence of tokens (symbols from a fixed list, the vocabulary) and, at every position, predicts a token.

    Fair description of a decoder-style transformer predicting a token at each position.

    Wikipedia, 'Attention (machine learning)', scaled dot-product attention and causal mask, pointing to Vaswani et al., 'Attention Is All You Need' (2017), https://en.wikipedia.org/wiki/Attention_(machine_learning)

  148. plausible A transformer trained with Muon

    What lets it use the rest of the sequence is attention: each position computes a weighted average over the positions before it, and the weights are learned.

    Informal: with a causal mask each position averages over itself and earlier positions, and the weights are computed from learned query/key projections rather than learned directly.

    Wikipedia, 'Attention (machine learning)', scaled dot-product attention and causal mask, pointing to Vaswani et al., 'Attention Is All You Need' (2017), https://en.wikipedia.org/wiki/Attention_(machine_learning)

  149. not-checkable A transformer trained with Muon

    Everything runs in this browser tab, forward and backward, with no machine-learning framework.

    Describes where this program runs.

  150. verified A transformer trained with Muon

    Muon is the optimizer used in the modded-nanogpt speedrun, a public contest to train a small GPT as fast as possible.

    The modded-nanogpt speedrun trains a GPT to 3.28 FineWeb validation loss on 8xH100 as fast as possible, and Muon has been its optimizer since October 2024.

    KellerJordan/modded-nanogpt README, https://github.com/KellerJordan/modded-nanogpt; K. Jordan, 'Muon: An optimizer for hidden layers in neural networks' (2024), https://kellerjordan.github.io/posts/muon/

  151. not-checkable A transformer trained with Muon

    Sequences of six tokens from a vocabulary of six.

    Describes this task.

  152. not-checkable A transformer trained with Muon

    At every position the model must name the token before it.

    Describes this task.

  153. plausible A transformer trained with Muon

    The tokens are random, so the token at a position says nothing about the one before it, and a model that cannot look at other positions can do no better than guessing.

    Not accessed; from general knowledge: if tokens are independent and uniform, the current token carries no information about the previous one, so a position-local model can only guess.

    Wikipedia, 'Attention (machine learning)', scaled dot-product attention and causal mask, pointing to Vaswani et al., 'Attention Is All You Need' (2017), https://en.wikipedia.org/wiki/Attention_(machine_learning)

  154. not-checkable A transformer trained with Muon

    (Position zero is the one exception; the section on what guessing scores comes back to it.)

    Forward reference within the post.

  155. not-checkable A transformer trained with Muon

    D is the width of the vector that stands for each token inside the model, H the width of the attention head's vectors, and MU, LR and STEPS are the optimizer's settings, explained where they are used.

    Defines the program's variables.

  156. not-checkable A transformer trained with Muon

    Sixteen sequences of six random tokens.

    Describes the program's data (NSEQ=16, T=6).

  157. verified A transformer trained with Muon

    The random numbers come from a linear congruential generator: multiply by a large constant, add another constant, keep the remainder.

    Replaces disputed 6819903a5a85.

    Wikipedia, 'Linear congruential generator': X_{n+1} = (a X_n + c) mod m, with the glibc/ISO C constants a = 1103515245, c = 12345, m = 2^31, https://en.wikipedia.org/wiki/Linear_congruential_generator; posts/2026-09-23-a-transformer-trained-by-muon-in-this-tab.viv line 64: rng = mod(1103515245.0 * rng + 12345.0, 2147483648.0)

  158. not-checkable A transformer trained with Muon

    The target at each position is the token one step back; position zero has nothing before it, so it names itself.

    Describes the program's targets; matches targ[s,t] = toks[s, max(t-1,0)].

  159. not-checkable A transformer trained with Muon

    The targets are the tokens shifted one place to the right, with the first token repeated at the front.

    Restates the program's targets.

  160. not-checkable A transformer trained with Muon

    At each position the model outputs six numbers, one per token, called logits.

    Definition of the model's output; the usage of 'logits' for pre-softmax scores is standard.

  161. verified A transformer trained with Muon

    A softmax turns them into probabilities: exponentiate each and divide by the sum.

    Matches the standard definition of softmax.

    Wikipedia, 'Softmax function' (definition: exponentiate each element, divide by the sum), https://en.wikipedia.org/wiki/Softmax_function

  162. verified A transformer trained with Muon

    The loss is the cross-entropy, −log⁡p-\log p where pp is the probability given to the right token, averaged over every position.

    Mean negative log-probability of the correct class is the standard cross-entropy loss; it is 0 at p=1 and diverges as p->0.

    Wikipedia, 'Cross-entropy' (loss as negative log-likelihood; minimized when predicted distribution equals the true one, Gibbs' inequality), https://en.wikipedia.org/wiki/Cross-entropy

  163. verified A transformer trained with Muon

    A model that knows nothing about the answer does best by spreading its probability evenly, p=1/6p = 1/6 for every token.

    With the correct token uniformly random, expected cross-entropy is minimized by the uniform prediction (Gibbs' inequality), giving log 6.

    Wikipedia, 'Cross-entropy' (loss as negative log-likelihood; minimized when predicted distribution equals the true one, Gibbs' inequality), https://en.wikipedia.org/wiki/Cross-entropy

  164. not-checkable A transformer trained with Muon

    That is the loss to beat.

    Rhetoric.

  165. verified A transformer trained with Muon

    A model that sees only the current token could do slightly better than this by getting position zero right, since its answer is its own token, but it would still be guessing at the other five positions out of six.

    Position zero's target is its own token, so a current-token model can score it perfectly while the other five stay at log 6: loss about (5/6) log 6 = 1.49 < 1.79.

    Wikipedia, 'Cross-entropy' (loss as negative log-likelihood; minimized when predicted distribution equals the true one, Gibbs' inequality), https://en.wikipedia.org/wiki/Cross-entropy

  166. plausible A transformer trained with Muon

    Only attention to the previous position gets the loss near zero.

    Follows from the task: the target at t>0 is independent of every token except t-1, so only a model that reads position t-1 can drive the loss near zero; not accessed as a single reference, from general reasoning.

    Haviv, Ram, Press, Izsak, Levy, 'Transformer Language Models without Positional Encodings Still Learn Positional Information' (2022), arXiv:2203.16634

  167. not-checkable A transformer trained with Muon

    Six weight matrices, all learned:

    Describes this model's parameters.

  168. not-checkable A transformer trained with Muon

    the token embedding E, 6×86 \times 8: a row of eight numbers for each token;

    Describes this model's parameters (V=6, D=8).

  169. not-checkable A transformer trained with Muon

    the position embedding P, 6×86 \times 8: a row for each position;

    Describes this model's parameters (T=6, D=8).

  170. not-checkable A transformer trained with Muon

    the attention head's three projections Wq, Wk and Wv, 8×88 \times 8 each;

    Describes this model's parameters (D=H=8).

  171. not-checkable A transformer trained with Muon

    the output projection Wo, 8×68 \times 6, which turns the head's output into six logits.

    Describes this model's parameters (H=8, V=6).

  172. not-checkable A transformer trained with Muon

    lib/params keeps all six in one flat vector, so the gradient is one vector too and the optimizer's memory is two more.

    Describes lib/params and lib/optim; optim_state does allocate two parameter-length vectors (Muon uses the first).

  173. not-checkable A transformer trained with Muon

    Each matrix starts as the corner of a fixed pseudo-random 8×88 \times 8 matrix, scaled down so that the first logits are small and the first guesses near even.

    Describes the program's initialization (test_matrix corners scaled by 0.5/0.3).

  174. verified A transformer trained with Muon

    The model's input at position tt is a row of eight numbers: the token embedding's row for the token there, plus the position embedding's row for tt.

    Adding a position embedding to the token embedding is the standard transformer input; the program does exactly this.

    Vaswani et al., 'Attention Is All You Need' (2017), arXiv:1706.03762, Sec. 3.5: positional encodings are added to the input embeddings

  175. plausible A transformer trained with Muon

    The position row is the only place the model learns where a token sits.

    True for this one-layer model, where attention scores see position only through P; Haviv et al. show the causal mask itself can leak position information in deeper models, but it is not learned.

    Haviv, Ram, Press, Izsak, Levy, 'Transformer Language Models without Positional Encodings Still Learn Positional Information' (2022), arXiv:2203.16634

  176. plausible A transformer trained with Muon

    Without it, the six positions would look the same to the attention head.

    Without P the keys depend only on the token, so the head cannot single out the previous position; the causal mask still differs by row (Haviv et al.), so 'look the same' holds for the scores, not for the mask.

    Haviv, Ram, Press, Izsak, Levy, 'Transformer Language Models without Positional Encodings Still Learn Positional Information' (2022), arXiv:2203.16634

  177. verified A transformer trained with Muon

    Each position's row xtx_t is multiplied by three matrices to make a query qt=xtWqq_t = x_t W_q, a key kt=xtWkk_t = x_t W_k and a value vt=xtWvv_t = x_t W_v.

    Queries, keys and values are learned linear projections of the input.

    Vaswani et al., 'Attention Is All You Need' (2017), arXiv:1706.03762, Sec. 3.2.1 (softmax(QK^T/sqrt(d_k))V) and 3.2.2 (learned linear projections of queries, keys, values)

  178. verified A transformer trained with Muon

    Position ii scores every position jj by how well its query matches that key, qi⋅kj/Hq_i \cdot k_j / \sqrt{H}.

    Scaled dot-product attention divides q.k by sqrt(d_k), here H.

    Vaswani et al., 'Attention Is All You Need' (2017), arXiv:1706.03762, Sec. 3.2.1 (softmax(QK^T/sqrt(d_k))V) and 3.2.2 (learned linear projections of queries, keys, values)

  179. verified A transformer trained with Muon

    The scores of positions after ii are set to −∞-\infty (the causal mask: a position may not look ahead).

    Causal masking sets scores for later positions to -inf before the softmax.

    Vaswani et al., 'Attention Is All You Need' (2017), arXiv:1706.03762, Sec. 3.2.3: decoder self-attention masks illegal (leftward) connections by setting softmax inputs to -inf

  180. not-checkable A transformer trained with Muon

    The attention matrix AA is where the model's looking shows.

    Rhetoric about this post's figure.

  181. not-checkable A transformer trained with Muon

    To solve the task, row ii has to put its weight on column i−1i - 1.

    Statement about this post's task (for rows i >= 1).

  182. not-checkable A transformer trained with Muon

    Everywhere it may, evenly.

    Describes this run's attention_before output.

  183. not-checkable A transformer trained with Muon

    There is no preference for the position before.

    Describes this run's attention_before output.

  184. not-checkable A transformer trained with Muon

    Everything above the diagonal is exactly zero: that is the mask.

    Describes this run's output; exp(-inf)=0 makes masked entries exactly zero.

  185. not-checkable A transformer trained with Muon

    The head's output times Wo gives the logits, and cross-entropy scores them against the targets.

    Describes the program's forward pass.

  186. not-checkable A transformer trained with Muon

    That is the forward pass.

    Transition.

  187. verified A transformer trained with Muon

    It runs the forward steps in reverse.

    Backpropagation propagates derivatives backward, one layer at a time, from output to input.

    Wikipedia, 'Backpropagation' (chain rule, propagating derivatives backward one layer at a time from output to input), https://en.wikipedia.org/wiki/Backpropagation

  188. verified A transformer trained with Muon

    An embedding's gradient goes only to the rows that were looked up.

    An embedding lookup is a row selection, so only the selected rows get nonzero gradient; this is why frameworks can return it as a sparse tensor.

    Wikipedia, 'Backpropagation' (chain rule, propagating derivatives backward one layer at a time from output to input), https://en.wikipedia.org/wiki/Backpropagation; PyTorch docs, torch.nn.Embedding (sparse=True gives a sparse gradient w.r.t. weight), https://docs.pytorch.org/docs/2.14/generated/torch.nn.Embedding.html

  189. not-checkable A transformer trained with Muon

    The training loss is the mean over all sixteen sequences, and the gradient is the sum of theirs.

    Describes loss_and_gradient: mean loss over 16 sequences, gradient summed (not averaged).

  190. not-checkable A transformer trained with Muon

    The accuracy is the fraction of the 96 positions where the token the model rates most likely is the right one.

    Defines this program's accuracy metric over 16 x 6 = 96 positions.

  191. not-checkable A transformer trained with Muon

    The accuracy starts at 0.1460.146 (start_accuracy), 14 of the 96 positions, about what luck gives.

    Describes this run; 14/96 = 0.1458 matches start_accuracy, and 1/6 of 96 is 16.

  192. verified A transformer trained with Muon

    Plain gradient descent steps each weight against its gradient.

    Gradient descent update w := w - eta grad.

    Wikipedia, 'Stochastic gradient descent', sections on the update w := w - eta grad Q and on momentum, https://en.wikipedia.org/wiki/Stochastic_gradient_descent

  193. not-checkable A transformer trained with Muon

    Muon adds one thing.

    Transition.

  194. plausible A transformer trained with Muon

    Then no direction of the weight matrix gets a much larger step than any other, however lopsided the gradient was.

    Jordan describes orthogonalization as raising the scale of small ('rare') directions in the update; 'no direction gets a much larger step' holds up to the approximate singular values Muon's five steps leave (0.45-1.17 in this run).

    K. Jordan, 'Muon: An optimizer for hidden layers in neural networks' (2024), https://kellerjordan.github.io/posts/muon/

  195. verified A transformer trained with Muon

    It does this with five steps of a Newton-Schulz iteration, a matrix polynomial,

    Muon applies five Newton-Schulz iterations, a quintic matrix polynomial, to the momentum.

    K. Jordan, 'Muon: An optimizer for hidden layers in neural networks' (2024), https://kellerjordan.github.io/posts/muon/

  196. verified A transformer trained with Muon

    X←3.4445 X−4.775 XX⊤X+2.0315 (XX⊤)2X,X \leftarrow 3.4445\,X - 4.775\,X X^\top X + 2.0315\,(X X^\top)^2 X,

    Jordan's tuned coefficients are (3.4445, -4.7750, 2.0315) for aX + b(XX^T)X + c(XX^T)^2X.

    K. Jordan, 'Muon: An optimizer for hidden layers in neural networks' (2024), https://kellerjordan.github.io/posts/muon/; Amsel et al., 'The Polar Express' (2025), Sec. 1.2, https://arxiv.org/html/2505.16932

  197. verified A transformer trained with Muon

    The classical Newton-Schulz polynomial, with coefficients 15/815/8, −10/8-10/8 and 3/83/8, converges to exactly 1 but slowly; Muon's coefficients are tuned to get close fast.

    The classical quintic Newton-Schulz polynomial is (15x - 10x^3 + 3x^5)/8, which converges to polar(M); Polar Express notes Jordan's coefficients do not converge but plateau (error about 0.3).

    Amsel et al., 'The Polar Express' (2025), Sec. 1.2, https://arxiv.org/html/2505.16932

  198. not-checkable A transformer trained with Muon

    A training step computes the loss and gradient over all sixteen sequences, then takes one Muon step.

    Describes the program's training step.

  199. not-checkable A transformer trained with Muon

    After step thirty the loss does not slide down steadily.

    Describes this run's loss curve.

  200. not-checkable A transformer trained with Muon

    It sits at a few thousandths and then jumps.

    Describes this run's loss curve.

  201. not-checkable A transformer trained with Muon

    Full-length steps get down fast and then keep stepping over the minimum.

    Interpretation of this run's comparison of constant and decaying step sizes.

  202. not-checkable A transformer trained with Muon

    Nothing in the setup mentions the previous position.

    Describes the program's setup.

  203. not-checkable A transformer trained with Muon

    The model gets a position embedding and a loss.

    Describes the program's setup.

  204. not-checkable A transformer trained with Muon

    The picture is the attention matrix: a bright line just below the diagonal, position zero's weight on itself in the top corner, and zeros above the diagonal, which are the causal mask, not something learned.

    Describes this post's figure.

  205. plausible A transformer trained with Muon

    A subtly wrong backward pass still runs and can still make the loss fall for a while, so training alone would not reveal the error.

    CS231n motivates gradient checks by the fact that an incorrect analytic gradient can go unnoticed during training; the specific 'loss can still fall' claim is from general knowledge.

    Stanford CS231n notes, 'Neural Networks Part 3', Gradient checks (centered difference (f(x+h)-f(x-h))/2h), https://cs231n.github.io/neural-networks-3/

  206. plausible Solving the Riccati equation without integrating it

    Every LQR controller comes from a quadratic matrix equation, and the tempting way to solve it is to integrate the differential version backwards until it stops moving.

    Infinite-horizon LQR gains come from the algebraic Riccati equation (finite-horizon ones from the differential equation, discrete-time from the DARE, so 'every' is loose); Laub lists integrating the Riccati differential equation among competing approaches.

    Wikipedia, 'Linear-quadratic regulator' (finite-horizon Riccati differential equation solved backward in time; infinite horizon gives the algebraic Riccati equation; K = R^-1 B^T P), https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator; A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  207. not-checkable Solving the Riccati equation without integrating it

    The gains of a linear-quadratic regulator come out of

    Sentence fragment leading into the formula.

  208. verified Solving the Riccati equation without integrating it

    A⊤P+PA−PBR−1B⊤P+W=0,A^\top P + P A - P B R^{-1} B^\top P + W = 0,

    Standard continuous-time algebraic Riccati equation, with W in the role of Q.

    Wikipedia, 'Algebraic Riccati equation' (CARE form; Hamiltonian [[A,-BR^-1B^T],[-Q,-A^T]]; P = U21 U11^-1 from the stable invariant subspace), https://en.wikipedia.org/wiki/Algebraic_Riccati_equation; Wikipedia, 'Linear-quadratic regulator' (finite-horizon Riccati differential equation solved backward in time; infinite horizon gives the algebraic Riccati equation; K = R^-1 B^T P), https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator

  209. verified Solving the Riccati equation without integrating it

    quadratic in the matrix PP.

    The CARE is quadratic in P via the P B R^-1 B^T P term.

    Wikipedia, 'Algebraic Riccati equation' (CARE form; Hamiltonian [[A,-BR^-1B^T],[-Q,-A^T]]; P = U21 U11^-1 from the stable invariant subspace), https://en.wikipedia.org/wiki/Algebraic_Riccati_equation

  210. verified Solving the Riccati equation without integrating it

    There is an obvious way to solve it: run P˙=−(A⊤P+PA−PBR−1B⊤P+W)\dot P = -(A^\top P + PA - PBR^{-1}B^\top P + W) backwards from zero until it stops changing.

    The Riccati differential equation integrated backward from a terminal P converges to the stabilizing ARE solution under stabilizability/detectability; Laub mentions this approach.

    Wikipedia, 'Linear-quadratic regulator' (finite-horizon Riccati differential equation solved backward in time; infinite horizon gives the algebraic Riccati equation; K = R^-1 B^T P), https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator; A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  211. plausible Solving the Riccati equation without integrating it

    The closed loop it produces decays like e−0.00141te^{-0.00141 t}, so the Riccati flow settles over roughly seven hundred seconds, and eighty seconds of backward integration gets nowhere near.

    A_cl = -0.001 - 0.001*0.414 = -0.00141 is correct, but the Riccati flow near P converges at rate 2|A_cl| (time constant ~354 s); my integration of the scalar flow from zero gives P at 18% of 414 at 80 s, 84% at 700 s and 98% at 1500 s, so 'roughly seven hundred seconds' is an order-of-magnitude timescale.

    Wikipedia, 'Linear-quadratic regulator' (finite-horizon Riccati differential equation solved backward in time; infinite horizon gives the algebraic Riccati equation; K = R^-1 B^T P), https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator

  212. verified Solving the Riccati equation without integrating it

    The fix is to solve a linear eigenvalue problem instead.

    Laub's method replaces the quadratic equation with an invariant-subspace (eigenvalue) computation on the Hamiltonian matrix.

    A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  213. verified Solving the Riccati equation without integrating it

    Stack AA and the two weights into the 2n×2n2n \times 2n Hamiltonian

    The Hamiltonian is 2n x 2n, built from A, B R^-1 B^T and the state weight.

    Wikipedia, 'Algebraic Riccati equation' (CARE form; Hamiltonian [[A,-BR^-1B^T],[-Q,-A^T]]; P = U21 U11^-1 from the stable invariant subspace), https://en.wikipedia.org/wiki/Algebraic_Riccati_equation; A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  214. verified Solving the Riccati equation without integrating it

    H=(A−BR−1B⊤−W−A⊤),H = \begin{pmatrix} A & -BR^{-1}B^\top \\ -W & -A^\top \end{pmatrix},

    Matches the standard Hamiltonian [[A, -BR^-1B^T], [-Q, -A^T]].

    Wikipedia, 'Algebraic Riccati equation' (CARE form; Hamiltonian [[A,-BR^-1B^T],[-Q,-A^T]]; P = U21 U11^-1 from the stable invariant subspace), https://en.wikipedia.org/wiki/Algebraic_Riccati_equation; A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  215. verified Solving the Riccati equation without integrating it

    whose spectrum is symmetric about the imaginary axis: every eigenvalue λ\lambda is matched by −λ-\lambda, so exactly nn of the 2n2n are stable.

    Eigenvalues come in pairs lambda, -lambda (with conjugates). 'Exactly n are stable' also needs no imaginary-axis eigenvalues, which Laub's stabilizability/detectability assumptions guarantee; the sentence leaves that condition out.

    Wikipedia, 'Hamiltonian matrix' (characteristic polynomial even: lambda, -lambda, conj(lambda), -conj(lambda) are all eigenvalues), https://en.wikipedia.org/wiki/Hamiltonian_matrix; A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  216. verified Solving the Riccati equation without integrating it

    No quadratic equation is solved.

    The Schur method needs an ordered real Schur form plus one linear solve (P = X2 X1^-1); no quadratic equation is solved.

    A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  217. plausible Solving the Riccati equation without integrating it

    Computing that basis is the main work.

    Laub's method has two steps, the ordered real Schur form of the 2n x 2n matrix and an n x n linear solve; the first is the O((2n)^3) QR iteration and dominates the cost (standard operation counts, not quoted directly).

    A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  218. verified Solving the Riccati equation without integrating it

    It is done by reducing HH to real Schur form (block upper triangular) and moving the stable blocks to the top left.

    Laub Theorem 4 and Sec. IV-A: reduce to real Schur form (quasi-upper-triangular) with the stable eigenvalues ordered into S11 at the top left.

    A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  219. verified Solving the Riccati equation without integrating it

    The animation below shows that reduction: the eleven subdiagonal entries of the Hessenberg matrix, driven to zero by Francis's implicit double-shift QR iteration, one turn of its outer loop at a time.

    A 12 x 12 Hessenberg matrix has 11 subdiagonal entries; the double Francis QR drives them toward zero (Laub cites the double Francis QR). The animation itself belongs to the post.

    Wikipedia, 'QR algorithm' (Hessenberg reduction, Francis double shift, deflation when a subdiagonal entry is small, quadratic convergence, real Schur form with 2x2 blocks), https://en.wikipedia.org/wiki/QR_algorithm; A. J. Laub, 'A Schur method for solving algebraic Riccati equations', IEEE Trans. Autom. Control AC-24(6):913-921 (1979), Theorems 4-5 and Sec. IV-A; http://eceweb1.rutgers.edu/~gajic/pdffiles/519KalmanFiltering/LaubARE_SchurMethod.pdf

  220. verified Solving the Riccati equation without integrating it

    Its size over four successive turns is 3.5×10−33.5\times10^{-3}, 7.7×10−77.7\times10^{-7}, 1.9×10−131.9\times10^{-13}, 3.8×10−273.8\times10^{-27}: the exponent doubles each time, which is the quadratic convergence a good shift gives.

    The listed values have exponents -2.5, -6.1, -12.7, -26.4, roughly doubling each time, consistent with quadratic convergence of a shifted QR subdiagonal. The last value is an orphan number, not linked to a test.

    Wikipedia, 'QR algorithm' (Hessenberg reduction, Francis double shift, deflation when a subdiagonal entry is small, quadratic convergence, real Schur form with 2x2 blocks), https://en.wikipedia.org/wiki/QR_algorithm

  221. verified Solving the Riccati equation without integrating it

    When an entry reaches rounding level, the matrix splits there into two smaller problems and the iteration moves on to the block above.

    Deflation: once a subdiagonal entry is negligible the problem splits into independent smaller eigenproblems.

    Wikipedia, 'QR algorithm' (Hessenberg reduction, Francis double shift, deflation when a subdiagonal entry is small, quadratic convergence, real Schur form with 2x2 blocks), https://en.wikipedia.org/wiki/QR_algorithm

  222. not-checkable Solving the Riccati equation without integrating it

    The matrix sign function, another way to get PP from HH, is more than thirty times worse on at least one.

    Compares results of this post's run; the matrix sign function is a standard alternative Riccati solver, but the 'thirty times worse' figure comes only from this program.

  223. not-checkable The tension in each of two ropes holding up a box

    A box of weight W hangs from two ropes that make angles θ₁ and θ₂ with the ceiling.

    Sets up the problem.

  224. verified The tension in each of two ropes holding up a box

    Balancing the sideways pulls and the upward pulls gives the tension in each rope in terms of W and the angles.

    Horizontal and vertical force balance give two equations for the two tensions.

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light: T1 cos30 = T2 cos45, T1 sin30 + T2 sin45 = w; net force zero because acceleration is zero), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  225. verified The tension in each of two ropes holding up a box

    A box's weight is the force gravity pulls it down with: its mass times g=9.8 m/s2g = 9.8\ \text{m/s}^2, measured in newtons (N).

    w = mg with g = 9.80 m/s^2; the standard value 9.80665 m/s^2 rounds to this.

    OpenStax, University Physics Vol. 1, Sec. 5.6 'Common Forces' (tension is a pulling force along a flexible connector; Example 5.13 T = w/(2 sin theta); g = 9.80 m/s^2), https://openstax.org/books/university-physics-volume-1/pages/5-6-common-forces

  226. verified The tension in each of two ropes holding up a box

    The box pulls straight down with its weight WW.

    Weight acts straight down with magnitude W.

    OpenStax, University Physics Vol. 1, Sec. 5.6 'Common Forces' (tension is a pulling force along a flexible connector; Example 5.13 T = w/(2 sin theta); g = 9.80 m/s^2), https://openstax.org/books/university-physics-volume-1/pages/5-6-common-forces

  227. verified The tension in each of two ropes holding up a box

    The left rope pulls up and to the left along its own length with some force T1T_1, and the right rope pulls up and to the right with T2T_2.

    Each rope pulls along its own length, away from the knot.

    OpenStax, University Physics Vol. 1, Sec. 5.6 'Common Forces' (tension is a pulling force along a flexible connector; Example 5.13 T = w/(2 sin theta); g = 9.80 m/s^2), https://openstax.org/books/university-physics-volume-1/pages/5-6-common-forces

  228. verified The tension in each of two ropes holding up a box

    A rope can only pull along itself; that pull is what tension means.

    OpenStax: tension is a pulling force acting along a stretched flexible connector.

    OpenStax, University Physics Vol. 1, Sec. 5.6 'Common Forces' (tension is a pulling force along a flexible connector; Example 5.13 T = w/(2 sin theta); g = 9.80 m/s^2), https://openstax.org/books/university-physics-volume-1/pages/5-6-common-forces

  229. not-checkable The tension in each of two ropes holding up a box

    Now require that nothing moves.

    Transition.

  230. verified The tension in each of two ropes holding up a box

    Sideways: the left rope's sideways pull must cancel the right rope's: T1cos⁡θ1=T2cos⁡θ2.T_1 \cos\theta_1 = T_2 \cos\theta_2.

    Same form as Example 6.1's horizontal equation.

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light: T1 cos30 = T2 cos45, T1 sin30 + T2 sin45 = w; net force zero because acceleration is zero), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  231. verified The tension in each of two ropes holding up a box

    Up and down: the two upward parts together must hold up the weight: T1sin⁡θ1+T2sin⁡θ2=W.T_1 \sin\theta_1 + T_2 \sin\theta_2 = W.

    Same form as Example 6.1's vertical equation.

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light: T1 cos30 = T2 cos45, T1 sin30 + T2 sin45 = w; net force zero because acceleration is zero), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  232. verified The tension in each of two ropes holding up a box

    Two equations, two unknowns, T1T_1 and T2T_2.

    Two linear equations in T1 and T2, solved simultaneously as in Example 6.1.

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light: T1 cos30 = T2 cos45, T1 sin30 + T2 sin45 = w; net force zero because acceleration is zero), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  233. not-checkable The tension in each of two ropes holding up a box

    The function below is those two equations written as code.

    Describes the program's function.

  234. not-checkable The tension in each of two ropes holding up a box

    Given candidate tensions, it adds up the three forces and reports how much is left over.

    Describes the program's function.

  235. verified The tension in each of two ropes holding up a box

    When both ropes make the same angle θ\theta, the sideways equation says T1=T2T_1 = T_2.

    Equal angles give equal cosines, so the horizontal balance gives T1 = T2 (Example 5.13's symmetric case).

    OpenStax, University Physics Vol. 1, Sec. 5.6 'Common Forces' (tension is a pulling force along a flexible connector; Example 5.13 T = w/(2 sin theta); g = 9.80 m/s^2), https://openstax.org/books/university-physics-volume-1/pages/5-6-common-forces

  236. verified The tension in each of two ropes holding up a box

    The up-and-down equation becomes 2Tsin⁡θ=W2T\sin\theta = W, so TW=12sin⁡θ.\frac{T}{W} = \frac{1}{2\sin\theta}.

    OpenStax Example 5.13 gives T = w/(2 sin theta) for the symmetric case.

    OpenStax, University Physics Vol. 1, Sec. 5.6 'Common Forces' (tension is a pulling force along a flexible connector; Example 5.13 T = w/(2 sin theta); g = 9.80 m/s^2), https://openstax.org/books/university-physics-volume-1/pages/5-6-common-forces

  237. verified The tension in each of two ropes holding up a box

    From the sideways equation, T2=T1cos⁡θ1/cos⁡θ2T_2 = T_1 \cos\theta_1 / \cos\theta_2.

    Horizontal balance T1 cos(theta1) = T2 cos(theta2), as in Example 6.1.

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light on two wires: T1cos30=T2cos45, T1sin30+T2sin45=w), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  238. verified The tension in each of two ropes holding up a box

    Each rope's tension has the other rope's angle on top.

    Solving the two balance equations gives T1 = W cos(theta2)/sin(theta1+theta2); checked algebraically.

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light on two wires: T1cos30=T2cos45, T1sin30+T2sin45=w), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  239. verified The tension in each of two ropes holding up a box

    At 30∘30^\circ and 30∘30^\circ the general formula gives 98 N98\ \text{N} (tension_at_30_degrees), the same as the symmetric case.

    cos30/sin60 = 1, so T = W = 98 N for a 10 kg load; matches the symmetric result.

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light on two wires: T1cos30=T2cos45, T1sin30+T2sin45=w), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  240. not-checkable The tension in each of two ropes holding up a box

    The formulas came from a few lines of algebra, and algebra can go wrong.

    Transition motivating the cross-check.

  241. verified The tension in each of two ropes holding up a box

    A rope pulled perfectly flat would need infinite tension, because none of its pull would point up.

    OpenStax Example 4.6: an infinite tension would result if the wire were horizontal.

    OpenStax, College Physics 2e, Sec. 4.5, Example 4.6 (tightrope: T = w/(2 sin theta); infinite tension if horizontal), https://openstax.org/books/college-physics-2e/pages/4-5-normal-tension-and-other-examples-of-forces

  242. verified The tension in each of two ropes holding up a box

    That is why a clothesline sags: no rope can be pulled tight enough to be straight while holding anything.

    Follows from T = w/(2 sin theta) diverging at theta = 0, as OpenStax states for the tightrope.

    OpenStax, College Physics 2e, Sec. 4.5, Example 4.6 (tightrope: T = w/(2 sin theta); infinite tension if horizontal), https://openstax.org/books/college-physics-2e/pages/4-5-normal-tension-and-other-examples-of-forces

  243. not-checkable The tension in each of two ropes holding up a box

    Problems measure the angle in two ways, and mixing them up is a common mistake.

    Rhetorical lead-in about angle conventions.

  244. verified The tension in each of two ropes holding up a box

    If the angle φ\varphi is measured from the vertical instead of the ceiling, then φ=90∘−θ\varphi = 90^\circ - \theta, and sin⁡θ\sin\theta becomes cos⁡φ\cos\varphi: T=W2cos⁡φ.T = \frac{W}{2\cos\varphi}. The ropes at 30∘30^\circ above the ceiling are at 60∘60^\circ from the vertical.

    With phi = 90 deg - theta, sin(theta) = cos(phi), so T = W/(2 cos phi); 30 deg from horizontal is 60 deg from vertical.

    OpenStax, College Physics 2e, Sec. 4.5, Example 4.6 (tightrope: T = w/(2 sin theta); infinite tension if horizontal), https://openstax.org/books/college-physics-2e/pages/4-5-normal-tension-and-other-examples-of-forces

  245. not-checkable The tension in each of two ropes holding up a box

    It does: 98 N98\ \text{N} (tension_from_the_vertical).

    Reports the program's output.

  246. not-checkable The tension in each of two ropes holding up a box

    Before using a formula, check which angle the problem gives you.

    Advice to the reader.

  247. not-checkable The tension in each of two ropes holding up a box

    Three quick checks find many mistakes.

    Transition.

  248. verified The tension in each of two ropes holding up a box

    If the two angles are equal, T1T_1 and T2T_2 should be equal.

    OpenStax: tensions are equal if and only if the angles on either side are the same.

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light on two wires: T1cos30=T2cos45, T1sin30+T2sin45=w), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  249. not-checkable The tension in each of two ropes holding up a box

    A 50 N50\ \text{N} sign hangs from two wires at 45∘45^\circ and 60∘60^\circ above the horizontal.

    Problem setup.

  250. verified The tension in each of two ropes holding up a box

    The steeper wire carries more, as before.

    36.6 N > 25.9 N; the steeper wire carries more, consistent with T1/T2 = cos(theta2)/cos(theta1).

    OpenStax, University Physics Vol. 1, Sec. 6.1, Example 6.1 (traffic light on two wires: T1cos30=T2cos45, T1sin30+T2sin45=w), https://openstax.org/books/university-physics-volume-1/pages/6-1-solving-problems-with-newtons-laws

  251. verified Doubling time breaks at tiny rates and at negative ones

    At a rate of 10−1210^{-12} a year it is off by a relative 9×10−59 \times 10^{-5}; at 10−1610^{-16} it says the money never doubles; at −5%-5\% it says the money doubled 13.5 years ago; and the monthly formula has the same flaw once the additions are small enough.

    Checked in Python: relative error 8.9e-5 at 1e-12, log(1+1e-16) = 0 giving infinity, and ln2/ln0.95 = -13.5; the monthly formula has the same log(1+r/n) rounding.

    D. Goldberg, What Every Computer Scientist Should Know About Floating-Point Arithmetic, Theorem 4 (ln(1+x) via x ln(1+x)/((1+x)-1)) and Table D-1 (double p=53), https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html; Local check: Python float, Decimal(1+1e-12)=1.0000000000010000889..., log(1+1e-12)/1e-12-1=8.9e-5, 1+1e-16==1, ln2/ln0.95=-13.51

  252. not-checkable Doubling time breaks at tiny rates and at negative ones

    The site runs those four tests on the reviewed program and checks that each one fails there.

    Describes the site's test mechanism.

  253. verified Doubling time breaks at tiny rates and at negative ones

    A double carries about 16 digits, so the 10−1210^{-12} in 1+10−121 + 10^{-12} is stored as 1.00009×10−121.00009 \times 10^{-12}, and the logarithm of the sum is off in its fifth digit.

    Double has 53 bits (~16 digits); in Python (1 + 1e-12) - 1 = 1.000088900582341e-12, so the stored 1e-12 is 1.00009e-12 and log(1 + 1e-12) is off by 8.9e-5 relative, the fifth digit.

    D. Goldberg, What Every Computer Scientist Should Know About Floating-Point Arithmetic, Theorem 4 (ln(1+x) via x ln(1+x)/((1+x)-1)) and Table D-1 (double p=53), https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html; Local check: Python float, Decimal(1+1e-12)=1.0000000000010000889..., log(1+1e-12)/1e-12-1=8.9e-5, 1+1e-16==1, ln2/ln0.95=-13.51

  254. not-checkable Doubling time, fixed for tiny and negative rates

    The logarithm of 1+r1 + r is computed without the rounding that lost the small rates, and a rate that is not positive gets an infinite doubling time.

    Describes what the program's fix does.

  255. not-checkable Doubling time, fixed for tiny and negative rates

    The fix makes two changes.

    Transition.

  256. not-checkable Doubling time, fixed for tiny and negative rates

    First, ln_one_plus computes ln⁡(1+x)\ln(1 + x) for small xx without losing it to rounding.

    Describes the program's function; the method is Goldberg's Theorem 4.

  257. not-checkable Hartree-Fock for water

    Water in the STO-3G basis, from the basis to the restricted Hartree-Fock energy, using lib/hf, a library whose tests compare it against PySCF.

    Describes the program and its library tests.

  258. not-checkable Hartree-Fock for water

    The overlap SS, kinetic energy TT and nuclear attraction VV matrices.

    Fragment naming matrices the program computes.

  259. not-checkable Hartree-Fock for water

    lib/hf has more than one implementation of each (three for SS and TT, two for VV).

    Describes the library's implementations.

  260. plausible Hartree-Fock for water

    The electron repulsion integrals (μν∣λσ)(\mu\nu|\lambda\sigma), 406 of them once the eightfold permutation symmetry is used.

    Not accessed; from general knowledge: with eightfold symmetry the unique ERIs for N=7 number M(M+1)/2 with M = N(N+1)/2 = 28, which is 406.

    Local check: 7 functions -> 28 pairs -> 28*29/2 = 406

  261. verified Hartree-Fock for water

    Two independent methods compute them: McMurchie-Davidson, which expands each product of Gaussians in Hermite Gaussians, and Head-Gordon-Pople, which runs the Obara-Saika vertical recurrence and then the horizontal one.

    Fermann-Valeev Sec. 7: MD uses recurrences over Hermite Gaussians; HGP combines the Obara-Saika VRR with the HRR.

    L. McMurchie and E. Davidson, One- and two-electron integrals over Cartesian Gaussian functions, J. Comput. Phys. 26, 218 (1978), https://ui.adsabs.harvard.edu/abs/1978JCoPh..26..218M/abstract; M. Head-Gordon and J. A. Pople, J. Chem. Phys. 89, 5777 (1988), abstract: Obara-Saika RR plus a new RR applied outside contraction loops, https://ui.adsabs.harvard.edu/abs/1988JChPh..89.5777H/abstract; J. T. Fermann and E. F. Valeev, Fundamentals of Molecular Integrals Evaluation, Sec. 7 (MD over Hermite Gaussians; OS VRR eq. 7.23 and HRR eq. 7.24), https://arxiv.org/abs/2007.12057

  262. plausible Hartree-Fock for water

    They share no recurrence.

    The MD Hermite recurrences and the OS VRR/HRR are different relations, though both start from the Boys function F_m(T), which is usually evaluated with its own recurrence.

    J. T. Fermann and E. F. Valeev, Fundamentals of Molecular Integrals Evaluation, Sec. 7 (MD over Hermite Gaussians; OS VRR eq. 7.23 and HRR eq. 7.24), https://arxiv.org/abs/2007.12057

  263. verified Hartree-Fock for water

    It solves F(D)C=SCεF(D) C = S C \varepsilon repeatedly until the change in energy and the commutator both fall below their tolerances, and EE is the formula above.

    The SCF loop stops on both the energy change and the commutator norm.

    lib/hf/rhf.viv hf_scf_loop (read): stops when it > 1, |E - E_prev| < etol and err < gtol, err = den_error; lib/hf/density.viv den_error (read): max |F'P' - P'F'| in the orthogonal basis, the commutator

  264. not-checkable Hartree-Fock for water

    The figure moves the two hydrogens along their O-H bonds, keeping the angle, and reruns the whole calculation at five more bond lengths, using only the default implementations.

    Describes the program's figure.

  265. not-checkable Hartree-Fock for water

    Each energy is checked against PySCF at the same geometry.

    Describes the program's checks.

  266. verified Hartree-Fock for water

    The stored geometry has O-H at 0.958 angstrom, close to the experimental bond length, so STO-3G makes the bond about 3 percent too long.

    Experimental re(OH) = 0.958 A; 0.987/0.958 = 1.030, so about 3 percent too long.

    NIST CCCBDB, experimental geometry of H2O: rOH = 0.958 A, angle 104.48 deg (Hoy and Bunker 1979), https://cccbdb.nist.gov/expgeom2x.asp?casno=7732185

  267. verified LOBPCG finds the lowest states of a particle in a box

    The grid Hamiltonian is then a symmetric matrix with 576576 rows.

    24 x 24 = 576 unknowns; the five-point Laplacian with Dirichlet boundaries is symmetric.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative, Dirichlet case: lambda_j = -(4/h^2) sin^2(pi j/(2(n+1))), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative

  268. verified LOBPCG finds the lowest states of a particle in a box

    Its eigenvalues are known exactly, so every number the solver produces can be checked.

    The Dirichlet discrete Laplacian has closed-form eigenvalues; in 2-D they are sums of the 1-D ones.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative, Dirichlet case: lambda_j = -(4/h^2) sin^2(pi j/(2(n+1))), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative

  269. not-checkable LOBPCG finds the lowest states of a particle in a box

    The mode with jj half-waves across and kk down has energy

    Lead-in to a formula.

  270. verified LOBPCG finds the lowest states of a particle in a box

    Ejk=12h2[(2−2cos⁡jπ25)+(2−2cos⁡kπ25)],E_{jk} = \frac{1}{2h^2}\Big[\big(2 - 2\cos\tfrac{j\pi}{25}\big) + \big(2 - 2\cos\tfrac{k\pi}{25}\big)\Big],

    1-D eigenvalue (2 - 2cos(j pi/(n+1)))/h^2 with n+1 = 25; the 2-D sum times 1/2 for H = -(1/2) Laplacian.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative, Dirichlet case: lambda_j = -(4/h^2) sin^2(pi j/(2(n+1))), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative

  271. verified LOBPCG finds the lowest states of a particle in a box

    a little below the continuous box's π2(j2+k2)/2\pi^2 (j^2 + k^2)/2.

    (4/h^2) sin^2(x/2) < x^2/h^2, so each discrete eigenvalue sits below pi^2 (j^2+k^2)/2.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative, Dirichlet case: lambda_j = -(4/h^2) sin^2(pi j/(2(n+1))), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative

  272. verified LOBPCG finds the lowest states of a particle in a box

    We want the lowest six: (1,1)(1,1), then (1,2)(1,2) and (2,1)(2,1), which have the same energy, then (2,2)(2,2), then (1,3)(1,3) and (3,1)(3,1), again a pair.

    Computed from the formula: (1,1), (1,2)=(2,1), (2,2), (1,3)=(3,1), then (2,3).

    Wikipedia, Eigenvalues and eigenvectors of the second derivative, Dirichlet case: lambda_j = -(4/h^2) sin^2(pi j/(2(n+1))), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative

  273. not-checkable LOBPCG finds the lowest states of a particle in a box

    We want six of them.

    Statement of the goal.

  274. verified LOBPCG finds the lowest states of a particle in a box

    Worse, the matrix has to exist: 5762576^2 numbers, of which at most five per row are not zero.

    A five-point stencil gives at most five nonzeros per row of a 576 x 576 matrix.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative, Dirichlet case: lambda_j = -(4/h^2) sin^2(pi j/(2(n+1))), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative

  275. not-checkable LOBPCG finds the lowest states of a particle in a box

    In this program that is apply_box, a few whole-array shifts.

    Describes the program.

  276. verified LOBPCG finds the lowest states of a particle in a box

    In the plane-wave DFT code on this site it is two FFTs and a projector sum, and the difference is measured: silicon with the matrix built and diagonalized at every k-point takes several times as long as with this solver (the timings, native on one core, are in dft/README.md).

    Dense takes about 8 times as long as the LOBPCG engine for silicon; the table is in dft/README.md.

    dft/README.md timing table (read): Si, one core of an Apple M2 Pro, dense 55 s, iterative (LOBPCG) 7 s

  277. verified LOBPCG finds the lowest states of a particle in a box

    The Rayleigh quotient of a vector is ρ(x)=xHHx/xHx\rho(x) = x^H H x / x^H x.

    Standard definition x^H H x / x^H x.

    Wikipedia, Rayleigh quotient (definition x*Mx/x*x; weighted average of eigenvalues; min = lambda_min), https://en.wikipedia.org/wiki/Rayleigh_quotient; D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf

  278. verified LOBPCG finds the lowest states of a particle in a box

    An average is smallest when all the weight sits on the smallest value, so the minimum of ρ\rho over all vectors is λ1\lambda_1, reached at the ground state.

    Bindel: rho is a weighted average of eigenvalues and lambda_min = min rho.

    Wikipedia, Rayleigh quotient (definition x*Mx/x*x; weighted average of eigenvalues; min = lambda_min), https://en.wikipedia.org/wiki/Rayleigh_quotient; D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf

  279. verified LOBPCG finds the lowest states of a particle in a box

    Finding the lowest eigenvector is therefore a minimization.

    Variational characterization lambda_min = min rho.

    D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf

  280. verified LOBPCG finds the lowest states of a particle in a box

    The gradient of ρ\rho is 2(Hx−ρx)/xHx2(Hx - \rho x)/x^H x.

    Differentiating rho by the quotient rule gives gradient 2(Hx - rho x)/(x^H x) for real symmetric H.

    D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf

  281. plausible LOBPCG finds the lowest states of a particle in a box

    The vector r=Hx−ρxr = Hx - \rho x is the residual: it is zero exactly when xx is an eigenvector, and its norm bounds how far ρ\rho is from the nearest eigenvalue.

    Bindel notes small residual means nearby eigenvalue; the exact bound min|lambda - rho| <= ||r||/||x|| (Parlett, Thm 4.5.1) not accessed; from general knowledge.

    D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf

  282. verified LOBPCG finds the lowest states of a particle in a box

    So the direction downhill costs one application of HH, and the residual's norm tells you when to stop.

    The gradient needs only Hx; residual norm is the natural stopping test.

    D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf

  283. verified LOBPCG finds the lowest states of a particle in a box

    For the lowest several states, carry several vectors at once, kept orthonormal.

    Block methods carry several orthonormal vectors (block Rayleigh quotient V*AV with V*V = I).

    A. V. Knyazev, Toward the Optimal Preconditioned Eigensolver: LOBPCG, SIAM J. Sci. Comput. 23(2), 517-541 (2001), as summarized at https://en.wikipedia.org/wiki/LOBPCG (span{x, w, previous}, Rayleigh-Ritz, CG generalization); D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf

  284. verified LOBPCG finds the lowest states of a particle in a box

    The lowest kk eigenvalues are what the kk Rayleigh quotients add up to at the minimum, and the kk vectors that reach it span the lowest kk eigenvectors.

    Ky Fan: min trace over orthonormal k-frames equals the sum of the k smallest eigenvalues, attained by the lowest invariant subspace (when there is a gap).

    Ky Fan (1949) trace minimization: min tr(U H U*) over UU*=I_k equals the sum of the k smallest eigenvalues, as stated in Liang, Wang, Zhang, On generalizing trace minimization principles, https://archive.ymsc.tsinghua.edu.cn/pacm_download/278/12759-liwz2023.pdf (search summary)

  285. verified LOBPCG finds the lowest states of a particle in a box

    Steepest descent would move each vector along its residual, x−αrx - \alpha r, with α\alpha chosen to make ρ\rho as small as possible.

    Steepest descent with exact line search along the residual (gradient) direction.

    J. R. Shewchuk, An Introduction to the Conjugate Gradient Method Without the Agonizing Pain, Sec. 6 and Fig. 8 (zigzag path because each gradient is orthogonal to the previous one), https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf

  286. verified LOBPCG finds the lowest states of a particle in a box

    Choosing that α\alpha is itself a small eigenvalue problem.

    Minimizing rho over span{x, r} is a 2 x 2 Rayleigh-Ritz eigenproblem.

    A. V. Knyazev, Toward the Optimal Preconditioned Eigensolver: LOBPCG, SIAM J. Sci. Comput. 23(2), 517-541 (2001), as summarized at https://en.wikipedia.org/wiki/LOBPCG (span{x, w, previous}, Rayleigh-Ritz, CG generalization); D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf

  287. verified LOBPCG finds the lowest states of a particle in a box

    For any set of orthonormal vectors SS (as rows), the best combinations of them are found by forming the small matrix S∗HSTS^* H S^T and diagonalizing it; its eigenvalues are the lowest Rayleigh quotients available in the span of SS (Ritz values) and its eigenvectors say which combinations reach them (Ritz vectors).

    Rayleigh-Ritz: projected matrix V*AV; its eigenvalues are Ritz values, eigenvectors give Ritz vectors.

    D. Bindel, CS 6210 notes, Rayleigh quotients revisited (Fall 2012): derivative of rho_A, rho a weighted average of eigenvalues, lambda_min = min rho, Courant-Fischer, block Rayleigh quotient V*AV, https://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec29.pdf; A. V. Knyazev, Toward the Optimal Preconditioned Eigensolver: LOBPCG, SIAM J. Sci. Comput. 23(2), 517-541 (2001), as summarized at https://en.wikipedia.org/wiki/LOBPCG (span{x, w, previous}, Rayleigh-Ritz, CG generalization)

  288. verified LOBPCG finds the lowest states of a particle in a box

    This is called Rayleigh-Ritz.

    Standard name, used in LOBPCG.

    A. V. Knyazev, Toward the Optimal Preconditioned Eigensolver: LOBPCG, SIAM J. Sci. Comput. 23(2), 517-541 (2001), as summarized at https://en.wikipedia.org/wiki/LOBPCG (span{x, w, previous}, Rayleigh-Ritz, CG generalization)

  289. verified LOBPCG finds the lowest states of a particle in a box

    LOBPCG searches a bigger span.

    LOBPCG uses span{x, w, p}, larger than steepest descent's span{x, w}.

    A. V. Knyazev, Toward the Optimal Preconditioned Eigensolver: LOBPCG, SIAM J. Sci. Comput. 23(2), 517-541 (2001), as summarized at https://en.wikipedia.org/wiki/LOBPCG (span{x, w, previous}, Rayleigh-Ritz, CG generalization)

  290. verified LOBPCG finds the lowest states of a particle in a box

    x, the current approximations,

    First LOBPCG block: current approximations.

    A. V. Knyazev, Toward the Optimal Preconditioned Eigensolver: LOBPCG, SIAM J. Sci. Comput. 23(2), 517-541 (2001), as summarized at https://en.wikipedia.org/wiki/LOBPCG (span{x, w, previous}, Rayleigh-Ritz, CG generalization)

  291. plausible LOBPCG finds the lowest states of a particle in a box

    w, their residuals, made orthogonal to x and scaled to unit length, and

    Second block is the (preconditioned) residual; orthogonalizing it against x and normalizing is an implementation choice for stability, which the LOBPCG article mentions.

    A. V. Knyazev, Toward the Optimal Preconditioned Eigensolver: LOBPCG, SIAM J. Sci. Comput. 23(2), 517-541 (2001), as summarized at https://en.wikipedia.org/wiki/LOBPCG (span{x, w, previous}, Rayleigh-Ritz, CG generalization)

  292. verified LOBPCG finds the lowest states of a particle in a box

    The third block is the conjugate-gradient idea.

    LOBPCG is a generalization of preconditioned CG to eigenproblems; p plays the role of the CG direction.

    A. V. Knyazev, Toward the Optimal Preconditioned Eigensolver: LOBPCG, SIAM J. Sci. Comput. 23(2), 517-541 (2001), as summarized at https://en.wikipedia.org/wiki/LOBPCG (span{x, w, previous}, Rayleigh-Ritz, CG generalization)

  293. verified LOBPCG finds the lowest states of a particle in a box

    Steepest descent on a long, narrow valley zigzags from wall to wall, because each new step undoes part of the last one.

    Shewchuk Fig. 8: steepest descent zigzags because each gradient is orthogonal to the previous one.

    J. R. Shewchuk, An Introduction to the Conjugate Gradient Method Without the Agonizing Pain, Sec. 6 and Fig. 8 (zigzag path because each gradient is orthogonal to the previous one), https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf

  294. verified LOBPCG finds the lowest states of a particle in a box

    "Locally optimal" means that instead of a formula for the step it takes the best point in the span of all three.

    LOBPCG's update is the Rayleigh-Ritz maximizer/minimizer over span{x, w, previous step}, which is what 'locally optimal' refers to.

    Wikipedia, 'LOBPCG' (pointer to Knyazev, SIAM J. Sci. Comput. 23(2), 517-541, 2001), https://en.wikipedia.org/wiki/LOBPCG

  295. plausible LOBPCG finds the lowest states of a particle in a box

    The spares are there because the highest vectors in a block converge slowest: nothing above them in the block keeps them separated from the rest of the spectrum.

    Wikipedia notes larger blocks help when some eigenvectors converge slower; the rate for the k-th vector depends on its gap to the first vector outside the block, so extra vectors speed the top wanted ones. The exact phrasing is informal; source only partly accessed.

    Wikipedia, 'LOBPCG' (pointer to Knyazev, SIAM J. Sci. Comput. 23(2), 517-541, 2001), https://en.wikipedia.org/wiki/LOBPCG

  296. verified LOBPCG finds the lowest states of a particle in a box

    Degenerate pairs need no special treatment: any combination of (1,2)(1,2) and (2,1)(2,1) is an eigenvector with the same energy, and the block converges to some orthonormal pair spanning that plane.

    Any combination of degenerate eigenvectors is an eigenvector, and block LOBPCG is noted to handle multiple and clustered eigenvalues well.

    Wikipedia, 'LOBPCG' (pointer to Knyazev, SIAM J. Sci. Comput. 23(2), 517-541, 2001), https://en.wikipedia.org/wiki/LOBPCG; Direct check: E_jk is symmetric in j,k, so (1,2) and (2,1) are degenerate

  297. plausible LOBPCG finds the lowest states of a particle in a box

    The P in the name is for preconditioner: replace rr by an approximation to (H−λ)−1r(H - \lambda)^{-1} r, which points closer to the correction needed.

    LOBPCG applies a preconditioner T to the residual (w = T r); approximating (H - sigma)^{-1} is the usual heuristic, though Wikipedia does not state that exact form. Partly from general knowledge.

    Wikipedia, 'LOBPCG' (pointer to Knyazev, SIAM J. Sci. Comput. 23(2), 517-541, 2001), https://en.wikipedia.org/wiki/LOBPCG

  298. not-checkable LOBPCG finds the lowest states of a particle in a box

    The DFT engine uses one built from the kinetic energy.

    Describes the site's DFT engine.

  299. verified LOBPCG finds the lowest states of a particle in a box

    It stays in the Rayleigh-Ritz step, though, so it still improves from the other states' directions.

    This is soft locking: locked vectors skip the residual computation but stay in the Rayleigh-Ritz step, as Wikipedia describes (after Knyazev et al., BLOPEX).

    Wikipedia, 'LOBPCG' (pointer to Knyazev, SIAM J. Sci. Comput. 23(2), 517-541, 2001), https://en.wikipedia.org/wiki/LOBPCG

  300. verified LOBPCG finds the lowest states of a particle in a box

    The eigenvalues get good much sooner than the vectors do.

    Eigenvectors are stationary points of the Rayleigh quotient, so eigenvalue estimates converge about quadratically faster than the vectors.

    Wikipedia, 'Rayleigh quotient' (stationary points at eigenvectors; min is lambda_min), https://en.wikipedia.org/wiki/Rayleigh_quotient

  301. not-checkable LOBPCG finds the lowest states of a particle in a box

    At step 50 the worst residual norm is 10−2.210^{-2.2} and the worst eigenvalue error is 10−6.910^{-6.9}.

    Numbers from this run.

  302. verified LOBPCG finds the lowest states of a particle in a box

    That is because ρ\rho is flat at an eigenvector: an error ϵ\epsilon in the vector moves the Rayleigh quotient by about ϵ2\epsilon^2.

    Eigenvectors are critical points of the Rayleigh quotient, so a first-order vector error changes it only at second order.

    Wikipedia, 'Rayleigh quotient' (stationary points at eigenvectors; min is lambda_min), https://en.wikipedia.org/wiki/Rayleigh_quotient

  303. not-checkable LOBPCG finds the lowest states of a particle in a box

    The levels also sit where they should relative to the continuous box.

    Transition to the next sentence's check.

  304. verified LOBPCG finds the lowest states of a particle in a box

    The five-point stencil drops the h2h^2 term of the second derivative's Taylor series, which lowers each level by about h2π4(j4+k4)/24h^2 \pi^4 (j^4 + k^4)/24; the measured shifts match that to within half a percent.

    The leading error of the second difference gives a downward shift h^2 (j pi)^4/24 per direction for H = -1/2 Laplacian; the next term changes that by at most 0.47% for the listed levels. Taylor expansion done here, not read from a textbook.

    Taylor series: 2 - 2cos(theta) = theta^2 - theta^4/12 + theta^6/360; checked numerically for (j,k) up to (1,3), h = 1/25

  305. verified Muon orthogonalizes the update

    Five Newton-Schulz steps get close to that without an SVD.

    Muon uses 5 Newton-Schulz steps to approximately orthogonalize the update without an SVD.

    Keller Jordan, 'Muon: An optimizer for hidden layers in neural networks' (blog, 2024), https://kellerjordan.github.io/posts/muon/

  306. verified Muon orthogonalizes the update

    When the singular values are lopsided, the few large ones get nearly all of the movement and the small ones almost none.

    Follows from the previous sentence; movement along each pair is proportional to its singular value.

    Algebra: -lr G = -lr sum_i s_i u_i v_i^T

  307. not-checkable Muon orthogonalizes the update

    The problem here is built to show that.

    Describes this post's test problem.

  308. not-checkable Muon orthogonalizes the update

    A direction the inputs barely excite gets a gradient ten thousand times weaker than the loudest one, and SGD's step along it is ten thousand times shorter.

    Describes this problem: S S^T has eigenvalues 1 to 1e-4, so for the same error the gradient along the quietest direction is 1e-4 times smaller.

  309. plausible Muon orthogonalizes the update

    Muon does it one direction of the matrix at a time, and those directions need not line up with the entries.

    Orthogonalization acts on the singular directions of the whole matrix, which are generally not aligned with the coordinate axes. The comparison with Adam is the post's own.

    Keller Jordan, 'Muon: An optimizer for hidden layers in neural networks' (blog, 2024), https://kellerjordan.github.io/posts/muon/

  310. verified Muon orthogonalizes the update

    X←aX+b(XXT)X+c(XXT)2X,(a,b,c)=(3.4445,−4.775,2.0315)X \leftarrow a X + b (X X^T) X + c (X X^T)^2 X, \qquad (a, b, c) = (3.4445, -4.775, 2.0315)

    The coefficients (3.4445, -4.7750, 2.0315) match Jordan's quintic Newton-Schulz iteration.

    Keller Jordan, 'Muon: An optimizer for hidden layers in neural networks' (blog, 2024), https://kellerjordan.github.io/posts/muon/

  311. verified Muon orthogonalizes the update

    The directions never move.

    Follows from the previous sentence, as long as p(s) stays positive, which it does for these coefficients on (0, 1.2].

    Algebra: odd polynomial p(X) = U p(S) V^T

  312. verified Muon orthogonalizes the update

    The coefficients were tuned for speed near zero.

    Jordan picks the coefficients to maximize a = p'(0), the growth rate for small singular values, while keeping the converged values in a band.

    Keller Jordan, 'Muon: An optimizer for hidden layers in neural networks' (blog, 2024), https://kellerjordan.github.io/posts/muon/

  313. not-checkable Muon orthogonalizes the update

    On the first gradient here, the singular values after dividing by the norm are

    Introduces this run's numbers.

  314. not-checkable Muon orthogonalizes the update

    and after five steps they are

    Introduces this run's numbers.

  315. not-checkable Muon orthogonalizes the update

    The five largest are in the band.

    About this run's output, compared with the band the library measures.

  316. not-checkable Muon orthogonalizes the update

    Each gets its best starting step size from the same grid, 0.01 * 2^g for g = 0, ..., 10, judged by how far it ends from the true map in the Frobenius norm.

    Describes this program's step-size sweep.

  317. not-checkable Muon orthogonalizes the update

    Muon's entry is a range because its result depends on rounding.

    Describes this run.

  318. verified Muon orthogonalizes the update

    Newton-Schulz enlarges a small singular value by up to about 485 times, whatever put it there, and a rounding error in the momentum is no exception.

    Replaces disputed a8d2c7d04c6a.

    3.4445^5 = 484.876 (computed); p(s)/s = a + b s^2 + c s^4 with b < 0 is at most a = 3.4445 for small s, so five steps enlarge by at most about 485; posts/2026-09-24-muon-orthogonalizes-the-update.viv test: measured ratio 484.872

  319. not-checkable Muon orthogonalizes the update

    The quietest input direction shows why.

    Transition.

  320. not-checkable Muon orthogonalizes the update

    Measured by training loss instead, Muon is behind.

    Result of this run.

  321. plausible Muon orthogonalizes the update

    The quiet directions are the ones the loss hardly counts, so an optimizer can leave them alone and still reach a low loss.

    Follows from the form of the loss: an error along a direction with eigenvalue 1e-4 adds little to it.

    Not accessed; from general knowledge: loss |(W - W*) S|^2/2 weights the error along each input direction by that direction's eigenvalue of S S^T (down to 1e-4)

  322. plausible Muon orthogonalizes the update

    Getting them right matters once the model sees inputs that point along them more than the training inputs did.

    If test inputs have larger components along the quiet directions, the error left in those directions shows up in the output.

    Not accessed; from general knowledge (generalization under covariate shift)

  323. not-checkable Muon orthogonalizes the update

    The optimizers are in lib/optim, over the parameter layout of lib/params, and the Newton-Schulz iteration is in lib/polar.

    Describes the library layout.

  324. not-checkable Muon orthogonalizes the update

    The transformer post in this channel trains with the same muon step.

    Refers to another post on the site.

  325. not-checkable Newton's method doubles the correct digits

    A notebook: the prose between the cells says what each one is for, and each cell's output appears under it.

    Describes the post format.

  326. verified Newton's method doubles the correct digits

    Already 1.52=2.251.5^2 = 2.25 is close to 2.

    Arithmetic is correct.

    Arithmetic: 1.5 x 1.5 = 2.25; x_1 = 1 - (1-2)/2 = 1.5 is the first Newton step from x_0 = 1; Wikipedia, 'Newton's method' (quadratic convergence, error relation), https://en.wikipedia.org/wiki/Newton%27s_method

  327. verified Newton's method doubles the correct digits

    xn+1−2=xn−xn2−22xn−2=(xn−2)22xn,x_{n+1} - \sqrt 2 = x_n - \frac{x_n^2 - 2}{2 x_n} - \sqrt 2 = \frac{(x_n - \sqrt 2)^2}{2 x_n},

    The identity holds exactly; it is the f''/(2f') e^2 error relation Wikipedia gives, with f = x^2 - 2.

    Algebra: x - (x^2-2)/(2x) - sqrt2 = (x^2 - 2 sqrt2 x + 2)/(2x) = (x - sqrt2)^2/(2x); Wikipedia, 'Newton's method' (quadratic convergence, error relation), https://en.wikipedia.org/wiki/Newton%27s_method

  328. verified Newton's method doubles the correct digits

    An error of 10−310^{-3} becomes 3.5×10−73.5 \times 10^{-7}, then 4.4×10−144.4 \times 10^{-14}: the number of correct digits doubles.

    e_{n+1} = e_n^2/(2 x_n): 1e-6/2.8304 = 3.53e-7, then (3.53e-7)^2/2.8284 = 4.4e-14; the program tests both steps.

    Wikipedia, 'Newton's method' (quadratic convergence, error relation), https://en.wikipedia.org/wiki/Newton%27s_method; Direct computation: (1e-3)^2/(2 sqrt2) = 3.5e-7, then (3.5e-7)^2/(2 sqrt2) = 4.4e-14

  329. verified Newton's method doubles the correct digits

    Far from the root the ratio is 1/(2xn)1/(2 x_n) with xnx_n still far from 2\sqrt 2; by the fourth step it matches 1/(22)1 / (2\sqrt 2) to four digits.

    The ratio is exactly 1/(2x_n), and by the fourth step x_3 agrees with sqrt 2 to about six digits, so four digits is correct.

    Algebra from the identity above: e_{n+1}/e_n^2 = 1/(2 x_n) exactly; x_3 = 1.4142157 differs from sqrt2 by 1.5e-6 relative; Wikipedia, 'Newton's method' (quadratic convergence, error relation), https://en.wikipedia.org/wiki/Newton%27s_method

  330. verified Newton's method doubles the correct digits

    Bisection keeps an interval where ff changes sign and halves it.

    Bisection keeps a sign-change interval and halves it each step.

    Wikipedia, 'Bisection method', https://en.wikipedia.org/wiki/Bisection_method

  331. verified Newton's method doubles the correct digits

    After kk halvings of [1,2][1, 2] the midpoint is within 2−(k+1)2^{-(k+1)} of the root, one binary digit per step, and that guarantee is all it has: it never fails, and it never speeds up.

    The bound and the guaranteed-but-linear convergence match the standard description.

    Wikipedia, 'Bisection method', https://en.wikipedia.org/wiki/Bisection_method; Arithmetic: after k halvings the interval has width 2^-k, so its midpoint is within 2^-(k+1) of the root

  332. not-checkable Newton's method doubles the correct digits

    Newton's curve bends down; bisection's is a straight line.

    Describes the post's figure (log error against step).

  333. verified The rule of 72 against the rule of 70

    Above a rate of 4.90% a year it is closer to the exact doubling time than the rule of 70, and below that the rule of 70 is closer; at 8% the rule of 72 is off by 0.07%.

    The crossover and the error at 8% check out; Wikipedia says the rule of 72 is best near 6-10% and the rule of 70 at lower rates.

    Wikipedia, 'Rule of 72' (exact t = ln2/ln(1+r); t ~ 69.3/r + 0.35; divisors of 72), https://en.wikipedia.org/wiki/Rule_of_72; Direct computation: 100 r ln2/ln(1+r) = 71 at r = 0.049018; at r = 0.08 the exact time is 9.0065 years, so 9 is off by 0.072%

  334. not-checkable The rule of 72 against the rule of 70

    The original four tests are kept word for word.

    Describes the post's tests.

  335. verified The rule of 72 against the rule of 70

    Both rules approximate ln⁡2/ln⁡(1+r)\ln 2 / \ln(1 + r).

    The exact doubling time is ln 2 / ln(1 + r).

    Wikipedia, 'Rule of 72' (exact t = ln2/ln(1+r); t ~ 69.3/r + 0.35; divisors of 72), https://en.wikipedia.org/wiki/Rule_of_72

  336. verified The rule of 72 against the rule of 70

    Expanding the logarithm one more term gives t≈69.3100r(1+r2)t \approx \frac{69.3}{100 r}\left(1 + \frac{r}{2}\right), so the exact time, multiplied by 100r100r, is not a constant: it is 69.3 plus about 35r35r.

    100 r t is approximately 69.3 + 34.7 r, matching Wikipedia's t ~ 69.3/R + 0.35 with R in percent.

    Wikipedia, 'Rule of 72' (exact t = ln2/ln(1+r); t ~ 69.3/r + 0.35; divisors of 72), https://en.wikipedia.org/wiki/Rule_of_72; Series: ln(1+r) = r - r^2/2 + ..., so ln2/ln(1+r) = (ln2/r)(1 + r/2 + ...)

  337. verified The rule of 72 against the rule of 70

    At 3% that is 70.3, and 70 is the closer rule; at 8% it is 72.1, and 72 is.

    The first-order formula gives 70.3 and 72.1, and the exact values are 70.35 and 72.05, so the conclusions hold.

    Direct computation: 100 r ln2/ln(1+r) = 70.35 at r = 0.03 and 72.05 at r = 0.08; Wikipedia, 'Rule of 72' (exact t = ln2/ln(1+r); t ~ 69.3/r + 0.35; divisors of 72), https://en.wikipedia.org/wiki/Rule_of_72

  338. verified The rule of 72 against the rule of 70

    70/(100r)70 / (100r): the same thing with ln⁡2≈0.7\ln 2 \approx 0.7 and ln⁡(1+r)≈r\ln(1+r) \approx r.

    Same approximation as the rule of 70 derivation.

    Wikipedia, 'Rule of 72', derivation (t = ln 2 / ln(1+r), ln(1+r) ~ r, ln 2 ~ 0.693) and rule of 70, https://en.wikipedia.org/wiki/Rule_of_72

  339. verified The rule of 72 against the rule of 70

    72/(100r)72 / (100r): the version for mental arithmetic, since 72 divides by 2, 3, 4, 6, 8, 9 and 12.

    Wikipedia lists 72's small divisors as 1, 2, 3, 4, 6, 8, 9, 12 and gives this as the reason for the choice.

    Wikipedia, 'Rule of 72' (exact t = ln2/ln(1+r); t ~ 69.3/r + 0.35; divisors of 72), https://en.wikipedia.org/wiki/Rule_of_72

  340. verified Two methods compute water's 6-31G integrals

    McMurchie-Davidson and Head-Gordon-Pople compute the same 4186 electron repulsion integrals for water in the 6-31G basis by different recurrences.

    MD uses Hermite-Gaussian recurrences, HGP uses the OS VRR plus HRR; the 4186 count follows from 13 functions and eightfold symmetry.

    J. T. Fermann and E. F. Valeev, 'Fundamentals of Molecular Integrals Evaluation', arXiv:2007.12057, Sec. 7 (MD, OS VRR eq. 7.23, HGP HRR eq. 7.24); Count: 13 functions -> 91 pairs -> 91*92/2 = 4186 unique integrals

  341. not-checkable Two methods compute water's 6-31G integrals

    They agree to rounding, each matches PySCF, and each one alone gives PySCF's Hartree-Fock energy.

    Results of this program's tests against PySCF.

  342. plausible Two methods compute water's 6-31G integrals

    The electron repulsion integrals are most of the cost of a Hartree-Fock calculation and the easiest place for a bug that does not announce itself.

    Fermann and Valeev treat ERI evaluation as the computational core of Gaussian-basis methods; 'most of the cost' holds for conventional HF on small molecules but depends on the algorithm. The second half is rhetorical.

    J. T. Fermann and E. F. Valeev, 'Fundamentals of Molecular Integrals Evaluation', arXiv:2007.12057, Sec. 7 (MD, OS VRR eq. 7.23, HGP HRR eq. 7.24)

  343. not-checkable Two methods compute water's 6-31G integrals

    lib/hf computes them more than one way and compares the answers.

    Describes the library.

  344. verified Two methods compute water's 6-31G integrals

    This post takes the two methods the library cross-checks by default and runs each one alone on water in 6-31G: 13 basis functions and 4186 integrals after the eightfold permutation symmetry.

    9 + 2 + 2 = 13 basis functions, and n(n+1)/2 pairs taken pairwise gives 4186 unique integrals.

    Basis Set Exchange, 6-31G: O has [3s2p] = 9 functions, H has [2s] = 2 each (not re-accessed; general knowledge); Count: 91 pairs -> 4186

  345. verified Two methods compute water's 6-31G integrals

    McMurchie-Davidson writes each product of two Gaussians as a sum of Hermite Gaussians.

    In McMurchie-Davidson, the product of two Cartesian Gaussians is expanded in Hermite Gaussians with E coefficients (Asadchev-Valeev eq. 8).

    A. Asadchev and E. F. Valeev, 'Implementation of McMurchie-Davidson algorithm for Gaussian AO integrals suited for SIMD processors', arXiv:2506.12501, eqs. 8, 25, 32-33; J. T. Fermann and E. F. Valeev, 'Fundamentals of Molecular Integrals Evaluation', arXiv:2007.12057, Sec. 7 (MD, OS VRR eq. 7.23, HGP HRR eq. 7.24)

  346. verified Two methods compute water's 6-31G integrals

    The integral becomes two matrix products over those expansions and the Hermite Coulomb integrals RtuvR_{tuv} at the distance between the two product centers.

    The ERI is the bra and ket E-coefficient expansions contracted against Hermite Coulomb integrals R_{t+tau,u+nu,v+phi}(alpha, R_PQ) (eq. 25), and implementations write these contractions as matrix products (eqs. 32-33).

    A. Asadchev and E. F. Valeev, 'Implementation of McMurchie-Davidson algorithm for Gaussian AO integrals suited for SIMD processors', arXiv:2506.12501, eqs. 8, 25, 32-33

  347. verified Two methods compute water's 6-31G integrals

    Head-Gordon-Pople starts from Obara and Saika's vertical recurrence, which builds up the angular momentum on one center of each pair, primitive by primitive.

    HGP's VRR (eq. 7.23) is the OS relation with b = d = 0, building [e0|f0] on centers A and C for each primitive combination.

    J. T. Fermann and E. F. Valeev, 'Fundamentals of Molecular Integrals Evaluation', arXiv:2007.12057, Sec. 7 (MD, OS VRR eq. 7.23, HGP HRR eq. 7.24)

  348. verified Two methods compute water's 6-31G integrals

    A horizontal recurrence then moves it onto the other center once per contracted shell quartet.

    The HRR (eq. 7.24) moves angular momentum from A and C to B and D and depends only on geometry, so it is applied after contraction.

    J. T. Fermann and E. F. Valeev, 'Fundamentals of Molecular Integrals Evaluation', arXiv:2007.12057, Sec. 7 (MD, OS VRR eq. 7.23, HGP HRR eq. 7.24)

  349. plausible Two methods compute water's 6-31G integrals

    They share no recurrence.

    The MD Hermite recurrences and the OS VRR/HRR are different relations, though both start from the Boys function F_m(T), which is usually evaluated with its own recurrence.

    J. T. Fermann and E. F. Valeev, Fundamentals of Molecular Integrals Evaluation, Sec. 7 (MD over Hermite Gaussians; OS VRR eq. 7.23 and HRR eq. 7.24), https://arxiv.org/abs/2007.12057

  350. verified Two methods compute water's 6-31G integrals

    Both take the Boys function from lib/hf/boys, which is checked on its own against mpmath values (tools/boys_reference.py).

    lib/hf/boys is held against a table of mpmath values written by tools/boys_reference.py.

    tools/boys_reference.py docstring (read): emits lib/hfref/boys.viv, F_n(x) from mpmath at 40 digits, rounded once to double; lib/hf/boys.viv header (read): 'The mpmath table in lib/hfref/boys (written by tools/boys_reference.py)'

  351. not-checkable Two methods compute water's 6-31G integrals

    About 60 percent of the integrals come out as the same double from both methods, bit for bit: 2483 of the 4186.

    Result of this run (2483/4186 = 59.3%).

  352. not-checkable Two methods compute water's 6-31G integrals

    The exact count depends on the last bit of exp, so a different math library would change it.

    Claim about this program's floating-point behavior.

  353. plausible Two methods compute water's 6-31G integrals

    The screened McMurchie-Davidson code skips any shell quartet whose Schwarz bound is under 10−1410^{-14}, so a few integrals no larger than 3×10−203 \times 10^{-20} are exactly zero in its set.

    Schwarz screening bounds every skipped integral by the threshold. The 3e-20 figure comes from this run.

    Not accessed; from general knowledge: Schwarz inequality |(ab|cd)| <= sqrt((ab|ab)(cd|cd)), Haser and Ahlrichs, J. Comput. Chem. 10, 104 (1989)

  354. not-checkable Two methods compute water's 6-31G integrals

    Finding which implementation is wrong.

    Heading.

  355. verified Two methods compute water's 6-31G integrals

    For an even count the program takes the upper of the two middle values as the median.

    Replaces disputed 595adbee782e: names the upper-median convention.

    lib/hf/sweep.viv sw_table_median: sort(col); C[i] = col[floor(nstrat / 2.0)], the upper middle value for an even count

  356. verified Two methods compute water's 6-31G integrals

    With two implementations that is the larger value, so a disagreement is detected but the blame falls on whichever one gave the lower value.

    Replaces disputed 595adbee782e.

    lib/hf/sweep.viv sw_table_median (upper middle value of the sorted column; for two values, the larger); posts/2026-09-24-two-integral-families.viv, its test of the blame with two implementations

  357. plausible Two methods compute water's 6-31G integrals

    With three, the median is a correct value.

    If only one of three implementations is wrong, the middle value is one of the two correct ones. The sentence assumes a single faulty member.

    Not accessed; from general knowledge (median of three / triple modular redundancy)

  358. not-checkable Two methods compute water's 6-31G integrals

    The last part of the program adds a third implementation that returns the Head-Gordon-Pople integrals with integral 2000, which is −0.117-0.117, multiplied by 1−10−91 - 10^{-9}.

    Describes this program's fault injection.

  359. verified Two methods compute water's 6-31G integrals

    That makes it larger, so with only two implementations the median is the wrong value and the correct one takes the blame.

    Scaling a negative number by 1 - 1e-9 makes it larger. Under the library's upper-median rule the altered value then becomes the median of the pair.

    Arithmetic: -0.117 x (1 - 1e-9) = -0.117 + 1.17e-10 > -0.117

  360. not-checkable A random walk spreads as 2Dt and turns Gaussian

    Every tolerance is a multiple of a measured spread.

    Describes this post's tolerances.

  361. verified A random walk spreads as 2Dt and turns Gaussian

    Diffusion is what a drop of ink does in still water: it spreads, and the width of the spread grows as the square root of time.

    Point-source solution of the diffusion equation is a Gaussian with variance 2Dt, so its width grows as sqrt(t).

    Wikipedia, 'Fick's laws of diffusion' (second law, point-source Gaussian, MSD = 2nDt), https://en.wikipedia.org/wiki/Fick%27s_laws_of_diffusion

  362. verified A random walk spreads as 2Dt and turns Gaussian

    The equation for the concentration c(x,t)c(x, t) is ∂tc=D ∂x2c\partial_t c = D\,\partial_x^2 c, and a drop that starts at one point becomes a Gaussian of variance 2Dt2Dt.

    Fick's second law in 1D; point-source Gaussian with MSD = 2Dt in one dimension.

    Wikipedia, 'Fick's laws of diffusion' (second law, point-source Gaussian, MSD = 2nDt), https://en.wikipedia.org/wiki/Fick%27s_laws_of_diffusion

  363. plausible A random walk spreads as 2Dt and turns Gaussian

    The constant DD, the diffusion constant, is a property of the ink and the water.

    D depends on the solute and solvent, but also on temperature (Stokes-Einstein), which the sentence leaves out; acceptable as informal.

    Wikipedia, 'Fick's laws of diffusion' (second law, point-source Gaussian, MSD = 2nDt), https://en.wikipedia.org/wiki/Fick%27s_laws_of_diffusion

  364. plausible A random walk spreads as 2Dt and turns Gaussian

    Steps are independent, so after nn steps the variances add: ⟨x2⟩=nσ2\langle x^2 \rangle = n\sigma^2.

    Variances of independent variables add, so Var(sum of n steps) = n sigma^2; standard probability (not accessed as a separate source; from general knowledge).

    Wikipedia, 'Central limit theorem', Lindeberg-Levy statement (finite variance), https://en.wikipedia.org/wiki/Central_limit_theorem

  365. verified A random walk spreads as 2Dt and turns Gaussian

    ⟨x2⟩=σ2Δt t=2Dt,D=σ22Δt=0.5.\langle x^2 \rangle = \frac{\sigma^2}{\Delta t}\, t = 2Dt, \qquad D = \frac{\sigma^2}{2\Delta t} = 0.5.

    MSD = 2Dt in 1D (Fick's laws page); with sigma^2 = 0.01 and dt = 0.01, D = sigma^2/(2 dt) = 0.5 by arithmetic.

    Wikipedia, 'Fick's laws of diffusion' (second law, point-source Gaussian, MSD = 2nDt), https://en.wikipedia.org/wiki/Fick%27s_laws_of_diffusion

  366. verified A random walk spreads as 2Dt and turns Gaussian

    The mean squared displacement (MSD) grows linearly, and its slope is 2D2D.

    MSD = 2Dt: linear in t with slope 2D in one dimension.

    Wikipedia, 'Fick's laws of diffusion' (second law, point-source Gaussian, MSD = 2nDt), https://en.wikipedia.org/wiki/Fick%27s_laws_of_diffusion

  367. plausible A random walk spreads as 2Dt and turns Gaussian

    Nothing about the shape of one step enters, only its variance.

    <x^2> = n sigma^2 holds for any zero-mean step distribution with finite variance; follows from additivity of variances.

    Wikipedia, 'Central limit theorem', Lindeberg-Levy statement (finite variance), https://en.wikipedia.org/wiki/Central_limit_theorem

  368. not-checkable A random walk spreads as 2Dt and turns Gaussian

    The reference's 2000 runs spread by 0.0451 there, so the formula holds.

    Compares the post's standard error with the reference's run-to-run spread (0.04465 vs 0.0451, linked).

  369. not-checkable A random walk spreads as 2Dt and turns Gaussian

    After one step the walkers are spread evenly over [−a,a][-a, a]: a flat distribution, not a bell.

    Describes this program's step distribution (uniform on [-a, a]).

  370. verified A random walk spreads as 2Dt and turns Gaussian

    The central limit theorem says the sum of many independent steps is Gaussian whatever one step looks like, and the diffusion equation's solution is that Gaussian.

    CLT (finite variance required, holds for the uniform step) gives a Gaussian limit for the scaled sum, matching the diffusion equation's Gaussian solution; wording is informal but correct here.

    Wikipedia, 'Central limit theorem', Lindeberg-Levy statement (finite variance), https://en.wikipedia.org/wiki/Central_limit_theorem; Wikipedia, 'Fick's laws of diffusion' (second law, point-source Gaussian, MSD = 2nDt), https://en.wikipedia.org/wiki/Fick%27s_laws_of_diffusion

  371. verified A random walk spreads as 2Dt and turns Gaussian

    A number that measures it is the excess kurtosis, ⟨x4⟩/⟨x2⟩2−3\langle x^4 \rangle / \langle x^2 \rangle^2 - 3.

    Excess kurtosis = kurtosis - 3; for zero-mean x this is <x^4>/<x^2>^2 - 3.

    Wikipedia, 'Kurtosis' (excess kurtosis; uniform -6/5, normal 0; excess kurtosis of a sum of n iid variables is 1/n times one's), https://en.wikipedia.org/wiki/Kurtosis

  372. verified A random walk spreads as 2Dt and turns Gaussian

    For a sum of nn independent steps it is exactly −1.2/n-1.2/n: the fourth cumulant grows as nn, the squared variance as n2n^2.

    Excess kurtosis of a sum of n iid variables is (1/n) times one variable's; uniform gives -6/5, so -1.2/n (cumulant additivity).

    Wikipedia, 'Kurtosis' (excess kurtosis; uniform -6/5, normal 0; excess kurtosis of a sum of n iid variables is 1/n times one's), https://en.wikipedia.org/wiki/Kurtosis

  373. plausible A random walk spreads as 2Dt and turns Gaussian

    Each bar is ±count\pm\sqrt{\text{count}}, the Poisson spread of a count.

    Poisson sqrt(count) is the usual error bar; with a fixed number of walkers the count is binomial, variance Np(1-p), close to Poisson for small bin probabilities. Not accessed; from general knowledge.

    Wikipedia, 'Pearson's chi-squared test' (statistic, mean = df, variance = 2 df), https://en.wikipedia.org/wiki/Pearson%27s_chi-squared_test

  374. verified A random walk spreads as 2Dt and turns Gaussian

    The agreement at step 200 is measured by Pearson's chi-square, χ2=∑(O−E)2/E\chi^2 = \sum (O - E)^2 / E over the bins, with EE the count the Gaussian predicts.

    Pearson's statistic is sum (O - E)^2 / E.

    Wikipedia, 'Pearson's chi-squared test' (statistic, mean = df, variance = 2 df), https://en.wikipedia.org/wiki/Pearson%27s_chi-squared_test

  375. not-checkable BFGS against gradient descent on the Rosenbrock valley

    Both methods start at (−1.2,1)(-1.2, 1) on Rosenbrock's function and use the same backtracking line search; they differ only in the direction they search along.

    Describes this program's setup.

  376. verified BFGS against gradient descent on the Rosenbrock valley

    f(x,y)=(1−x)2+100 (y−x2)2f(x, y) = (1 - x)^2 + 100\,(y - x^2)^2

    Rosenbrock function with a = 1, b = 100.

    Rosenbrock, H.H. (1960), Computer Journal 3(3):175-184, via Wikipedia 'Rosenbrock function', https://en.wikipedia.org/wiki/Rosenbrock_function

  377. verified BFGS against gradient descent on the Rosenbrock valley

    is a standard test for minimizers.

    Introduced by Rosenbrock (1960) and used as a performance test problem for optimization algorithms.

    Rosenbrock, H.H. (1960), Computer Journal 3(3):175-184, via Wikipedia 'Rosenbrock function', https://en.wikipedia.org/wiki/Rosenbrock_function

  378. verified BFGS against gradient descent on the Rosenbrock valley

    The floor of the valley is nearly flat and the walls are steep, so the downhill direction points mostly at the opposite wall, not along the valley toward the minimum.

    Long, narrow, flat-floored parabolic valley; gradient descent zigzags across such valleys.

    Rosenbrock, H.H. (1960), Computer Journal 3(3):175-184, via Wikipedia 'Rosenbrock function', https://en.wikipedia.org/wiki/Rosenbrock_function; Wikipedia, 'Gradient descent' (update x - eta grad f; zigzag in narrow valleys such as Rosenbrock; rate set by condition number), https://en.wikipedia.org/wiki/Gradient_descent

  379. not-checkable BFGS against gradient descent on the Rosenbrock valley

    Both methods here step from xx to x+t dx + t\,d for a direction dd.

    Describes both methods in this program.

  380. verified BFGS against gradient descent on the Rosenbrock valley

    Gradient descent takes d=−∇fd = -\nabla f.

    Steepest descent direction is -grad f.

    Wikipedia, 'Gradient descent' (update x - eta grad f; zigzag in narrow valleys such as Rosenbrock; rate set by condition number), https://en.wikipedia.org/wiki/Gradient_descent

  381. verified BFGS against gradient descent on the Rosenbrock valley

    BFGS takes d=−H∇fd = -H \nabla f, where HH is its running estimate of the inverse of the Hessian, the matrix of second derivatives.

    BFGS direction p = -H grad f with H approximating the inverse Hessian.

    Nocedal & Wright, Numerical Optimization (2006), ch. 6, via Wikipedia 'BFGS algorithm' (p = -H grad f, H approximates inverse Hessian, secant equation), https://en.wikipedia.org/wiki/Broyden%E2%80%93Fletcher%E2%80%93Goldfarb%E2%80%93Shanno_algorithm

  382. not-checkable BFGS against gradient descent on the Rosenbrock valley

    The reference is a Python twin of the same algorithm (posts/refs/bfgs-against-gradient-descent-on-rosenbrock.py, output beside it).

    Describes the post's reference script.

  383. verified BFGS against gradient descent on the Rosenbrock valley

    Gradient descent goes downhill, and on this function downhill is across the valley.

    Gradient points across the narrow valley; gradient descent zigzags across it.

    Wikipedia, 'Gradient descent' (update x - eta grad f; zigzag in narrow valleys such as Rosenbrock; rate set by condition number), https://en.wikipedia.org/wiki/Gradient_descent; Rosenbrock, H.H. (1960), Computer Journal 3(3):175-184, via Wikipedia 'Rosenbrock function', https://en.wikipedia.org/wiki/Rosenbrock_function

  384. not-checkable BFGS against gradient descent on the Rosenbrock valley

    There is one exception here.

    Transition.

  385. verified BFGS against gradient descent on the Rosenbrock valley

    Near the minimum ff is close to a quadratic, with Hessian (802−400−400200)\begin{pmatrix} 802 & -400 \\ -400 & 200 \end{pmatrix}.

    Hessian of (1-x)^2+100(y-x^2)^2 at (1,1): f_xx = 2-400(y-x^2)+1200x^2 = 802, f_xy = -400x = -400, f_yy = 200 (direct differentiation, checked numerically).

    Rosenbrock, H.H. (1960), Computer Journal 3(3):175-184, via Wikipedia 'Rosenbrock function', https://en.wikipedia.org/wiki/Rosenbrock_function

  386. not-checkable BFGS against gradient descent on the Rosenbrock valley

    Its eigenvalues are 1001.6 and 0.399: the valley is 2508 times steeper across than along (kappa).

    Program result; tested (eigenvalues 0.39936 and 1001.60, kappa = 2508.0).

  387. verified BFGS against gradient descent on the Rosenbrock valley

    For a quadratic with Hessian BB, y=Bsy = B s.

    For a quadratic, the gradient change is B s, the basis of the secant equation B_{k+1} s_k = y_k.

    Nocedal & Wright, Numerical Optimization (2006), ch. 6, via Wikipedia 'BFGS algorithm' (p = -H grad f, H approximates inverse Hessian, secant equation), https://en.wikipedia.org/wiki/Broyden%E2%80%93Fletcher%E2%80%93Goldfarb%E2%80%93Shanno_algorithm

  388. not-checkable BFGS against gradient descent on the Rosenbrock valley

    Here it is 0.305 at iteration 31, between 0.013 and 0.033 for the next three, and 1.1×10−41.1 \times 10^{-4} at iteration 35.

    Error ratios from this run, linked to tests; the 0.013 and 0.033 bounds are program output.

  389. not-checkable BFGS against gradient descent on the Rosenbrock valley

    The last five errors match the Python twin's to the last bit.

    Describes agreement between this program and its Python twin.

  390. not-checkable BFGS against gradient descent on the Rosenbrock valley

    The first figure draws both paths over three level curves of ff (at 1, 5, and 24.2, the level through the start) and the valley floor y=x2y = x^2.

    Describes the figure; f(-1.2, 1) = 4.84 + 19.36 = 24.2 by arithmetic.

  391. not-checkable BFGS against gradient descent on the Rosenbrock valley

    Gradient descent's line shows its first 20 iterates, then every 200th: the long straight segment is the jump across the bend, and each later point stands for 200 small zigzags near (1,1)(1, 1).

    Describes the figure.

  392. not-checkable BFGS against gradient descent on the Rosenbrock valley

    BFGS lands on the floor and follows the curve of the valley around to the minimum.

    Describes the figure.

  393. not-checkable BFGS against gradient descent on the Rosenbrock valley

    The second figure is the distance to (1,1)(1, 1) against the iteration number, both on log axes.

    Describes the figure.

  394. plausible BFGS against gradient descent on the Rosenbrock valley

    Gradient descent's line bends down only slowly, a constant factor per step.

    Gradient descent converges linearly (a constant factor per step, set by the condition number) near the minimum; the sentence also describes the figure.

    Wikipedia, 'Gradient descent' (update x - eta grad f; zigzag in narrow valleys such as Rosenbrock; rate set by condition number), https://en.wikipedia.org/wiki/Gradient_descent

  395. not-checkable BFGS against gradient descent on the Rosenbrock valley

    BFGS's plunges in its last few steps.

    Describes the figure.

  396. verified Black-Scholes by Monte Carlo, against the closed form

    A call option is the right, not the obligation, to buy a stock at a fixed price KK, the strike, on a fixed date TT years away.

    Right but not obligation to buy at the strike; fixed-date exercise is the European style.

    Wikipedia, 'Call option' (right not obligation to buy at strike; payoff max(S_T - X, 0)), https://en.wikipedia.org/wiki/Call_option

  397. verified Black-Scholes by Monte Carlo, against the closed form

    If the stock then trades at ST>KS_T > K the holder buys at KK and gains ST−KS_T - K; otherwise the option expires unused.

    Payoff at expiry is S_T - K if S_T > K, otherwise zero (ignoring the premium).

    Wikipedia, 'Call option' (right not obligation to buy at strike; payoff max(S_T - X, 0)), https://en.wikipedia.org/wiki/Call_option

  398. verified Black-Scholes by Monte Carlo, against the closed form

    Its payoff is max⁡(ST−K,0)\max(S_T - K, 0).

    Call payoff max(S_T - X, 0).

    Wikipedia, 'Call option' (right not obligation to buy at strike; payoff max(S_T - X, 0)), https://en.wikipedia.org/wiki/Call_option

  399. verified Black-Scholes by Monte Carlo, against the closed form

    Black, Scholes and Merton (1973) showed that if the stock price follows geometric Brownian motion (random percentage changes, with volatility σ\sigma per square-root year), a portfolio of the stock and cash can reproduce the option's payoff exactly, so the option must cost what that portfolio costs.

    Black & Scholes (JPE 1973) and Merton (Bell J. Econ. 1973): under GBM a dynamically hedged stock/cash portfolio replicates the option, fixing its price.

    Wikipedia, 'Black-Scholes model' (call formula with d1, d2; GBM assumption; replication/hedging argument; risk-neutral valuation), https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model

  400. not-checkable Black-Scholes by Monte Carlo, against the closed form

    The answer is the formula above, with NN the standard normal cumulative distribution and

    Formula fragment introducing N and d1.

  401. verified Black-Scholes by Monte Carlo, against the closed form

    d1=ln⁡(S0/K)+(r+σ2/2)TσT,d2=d1−σT.d_1 = \frac{\ln(S_0/K) + (r + \sigma^2/2)T}{\sigma\sqrt T}, \qquad d_2 = d_1 - \sigma\sqrt T.

    Standard d1 and d2 = d1 - sigma sqrt(T).

    Wikipedia, 'Black-Scholes model' (call formula with d1, d2; GBM assumption; replication/hedging argument; risk-neutral valuation), https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model

  402. verified Black-Scholes by Monte Carlo, against the closed form

    The same argument gives a second way to compute it: the price is the average payoff, discounted at the interest rate rr, over stock prices that grow on average at rr rather than at the stock's actual expected return:

    Risk-neutral valuation: price = discounted expected payoff with the stock drifting at r.

    Wikipedia, 'Black-Scholes model' (call formula with d1, d2; GBM assumption; replication/hedging argument; risk-neutral valuation), https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model; Wikipedia, 'Monte Carlo methods in finance' (error ~ 1/sqrt(N), quadrupling paths halves error, rate independent of dimension, preferred with many state variables), https://en.wikipedia.org/wiki/Monte_Carlo_methods_in_finance

  403. verified Black-Scholes by Monte Carlo, against the closed form

    ST=S0exp⁡((r−12σ2)T+σT Z),Z∼N(0,1).S_T = S_0 \exp\left((r - \tfrac12\sigma^2)T + \sigma\sqrt T\, Z\right), \qquad Z \sim \mathcal N(0, 1).

    GBM under the risk-neutral measure: S_T = S_0 exp((r - sigma^2/2)T + sigma sqrt(T) Z).

    Wikipedia, 'Black-Scholes model' (call formula with d1, d2; GBM assumption; replication/hedging argument; risk-neutral valuation), https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model

  404. verified Black-Scholes by Monte Carlo, against the closed form

    The average is an unbiased estimate of the price, and by the central limit theorem its error is close to normal with standard deviation σY/N\sigma_Y/\sqrt N, the standard error, where σY\sigma_Y is the standard deviation of one payoff.

    Sample mean is unbiased and by the CLT its error is approximately normal with sd sigma_Y/sqrt(N).

    Wikipedia, 'Monte Carlo methods in finance' (error ~ 1/sqrt(N), quadrupling paths halves error, rate independent of dimension, preferred with many state variables), https://en.wikipedia.org/wiki/Monte_Carlo_methods_in_finance; Wikipedia, 'Central limit theorem', Lindeberg-Levy statement (finite variance), https://en.wikipedia.org/wiki/Central_limit_theorem

  405. verified Black-Scholes by Monte Carlo, against the closed form

    Quadrupling NN halves the error, whatever the dimension of the problem; that rate is the reason Monte Carlo is used for options on many assets, where grids cannot be.

    Error ~ 1/sqrt(N), quadrupling paths halves the error, rate independent of dimension, preferred with many state variables.

    Wikipedia, 'Monte Carlo methods in finance' (error ~ 1/sqrt(N), quadrupling paths halves error, rate independent of dimension, preferred with many state variables), https://en.wikipedia.org/wiki/Monte_Carlo_methods_in_finance

  406. plausible Black-Scholes by Monte Carlo, against the closed form

    σY\sigma_Y has a closed form too.

    The lognormal moments give sigma_Y in closed form (see next sentence); derived, not looked up in a separate source.

    Wikipedia, 'Black-Scholes model' (call formula with d1, d2; GBM assumption; replication/hedging argument; risk-neutral valuation), https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model

  407. plausible Black-Scholes by Monte Carlo, against the closed form

    The payoff's second moment needs E[ST2 1ST>K]=S02e(2r+σ2)TN(d1+σT)E[S_T^2\,1_{S_T > K}] = S_0^2 e^{(2r + \sigma^2)T} N(d_1 + \sigma\sqrt T), E[ST 1ST>K]=S0erTN(d1)E[S_T\,1_{S_T > K}] = S_0 e^{rT} N(d_1) and P(ST>K)=N(d2)P(S_T > K) = N(d_2), and σY2=E[Y2]−C2\sigma_Y^2 = E[Y^2] - C^2.

    Checked by derivation: E[S_T^2 1{S_T>K}] = S_0^2 e^{(2r+sigma^2)T} N(d2 + 2 sigma sqrt T) = ... N(d1 + sigma sqrt T); E[S_T 1] = S_0 e^{rT} N(d1); P = N(d2). Not accessed in a text; from general knowledge plus derivation.

    Wikipedia, 'Black-Scholes model' (call formula with d1, d2; GBM assumption; replication/hedging argument; risk-neutral valuation), https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model

  408. plausible Black-Scholes by Monte Carlo, against the closed form

    Here σY=14.719\sigma_Y = 14.719: one payoff varies by more than the price itself, since 44% of the time it is zero.

    sigma_Y is linked; the 44% is P(S_T < K) = N(-d2) = N(-0.15) = 0.440 for the post's d2 = 0.15 (computed, not a looked-up value).

    Wikipedia, 'Black-Scholes model' (call formula with d1, d2; GBM assumption; replication/hedging argument; risk-neutral valuation), https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model

  409. not-checkable Black-Scholes by Monte Carlo, against the closed form

    At each it compares the estimate with the formula.

    Describes this program.

  410. not-checkable Black-Scholes by Monte Carlo, against the closed form

    The reference repeated this with 2000 runs of numpy's generator and found slopes of −0.501±0.019-0.501 \pm 0.019, so the test allows ±0.057\pm 0.057.

    Reports the reference's run statistics and the test tolerance (3 x 0.019 = 0.057).

  411. not-checkable Burgers' equation in nonconservative form puts the shock in the wrong place

    Upwinding the second form moves it at 0.5132, on 400, 800 and 1600 cells alike, so refining the grid does not fix it.

    Program results linked to tests.

  412. verified Burgers' equation in nonconservative form puts the shock in the wrong place

    Burgers' equation is the simplest model of a nonlinear wave: each value of uu travels at speed uu, so faster parts catch up with slower ones and the profile steepens until it breaks into a jump, a shock.

    Inviscid Burgers: each value travels at speed u, characteristics cross and a shock forms; Cameron calls it a simplified model.

    Wikipedia, 'Burgers' equation' (inviscid form; wave with speed u; characteristics cross and form shocks), https://en.wikipedia.org/wiki/Burgers%27_equation; M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  413. verified Burgers' equation in nonconservative form puts the shock in the wrong place

    Past that point the derivative uxu_x does not exist and the differential equation says nothing.

    At the discontinuity only weak (integral-form) solutions make sense.

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  414. verified Burgers' equation in nonconservative form puts the shock in the wrong place

    What still holds is the integral form: the amount of uu between two points changes by what flows in at one end minus what flows out at the other, with flux f(u)=u2/2f(u) = u^2/2.

    Integral form: the amount of u in [L, R] changes only by boundary fluxes; for Burgers f(u) = u^2/2.

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  415. verified Burgers' equation in nonconservative form puts the shock in the wrong place

    Applied to a box around a jump from uLu_L to uRu_R moving at speed ss, it gives the Rankine-Hugoniot condition s (uL−uR)=f(uL)−f(uR)s\,(u_L - u_R) = f(u_L) - f(u_R), which for Burgers is s=(uL+uR)/2s = (u_L + u_R)/2.

    Rankine-Hugoniot s = (f(u_L) - f(u_R))/(u_L - u_R) = (u_L + u_R)/2 for Burgers.

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf; R.J. LeVeque, IPDE 2011 slides 'Burgers' equation' [FVMHP Sec. 12.3]: Godunov flux for convex f = min over [Q_{i-1},Q_i] of f if Q_{i-1}<=Q_i, else max; RH speed (u_l+u_r)/2, https://faculty.washington.edu/rjl/ipde/slides/leveque6nup3.pdf

  416. not-checkable Burgers' equation in nonconservative form puts the shock in the wrong place

    The Python reference, posts/refs/burgers-in-nonconservative-form-puts-the-shock-in-the-wrong-place.py, runs both schemes separately (output beside it).

    Describes the post's reference script.

  417. verified Burgers' equation in nonconservative form puts the shock in the wrong place

    A conservative scheme updates each cell by the difference of the fluxes through its two faces: ui←ui−(Δt/h)(Fi+1/2−Fi−1/2)u_i \leftarrow u_i - (\Delta t/h)(F_{i+1/2} - F_{i-1/2}).

    Conservative form U_j^{n+1} = U_j^n - (k/h)[F_{j+1/2} - F_{j-1/2}]; Godunov's method is of this form.

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  418. verified Burgers' equation in nonconservative form puts the shock in the wrong place

    Whatever leaves one cell enters its neighbor, so the total h∑uih\sum u_i changes only by the fluxes through the two ends of the domain.

    Summing a conservative method telescopes, leaving only boundary fluxes.

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  419. verified Burgers' equation in nonconservative form puts the shock in the wrong place

    Godunov's flux is the flux of the exact solution of the jump between the two neighbors; for Burgers it is max⁡(f(max⁡(uL,0)), f(min⁡(uR,0)))\max\bigl(f(\max(u_L, 0)),\ f(\min(u_R, 0))\bigr).

    LeVeque's convex-flux Godunov flux (min of f over [u_L,u_R] if u_L <= u_R, else max) reduces for f = u^2/2 to max(f(max(u_L,0)), f(min(u_R,0))).

    R.J. LeVeque, IPDE 2011 slides 'Burgers' equation' [FVMHP Sec. 12.3]: Godunov flux for convex f = min over [Q_{i-1},Q_i] of f if Q_{i-1}<=Q_i, else max; RH speed (u_l+u_r)/2, https://faculty.washington.edu/rjl/ipde/slides/leveque6nup3.pdf; M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  420. verified Burgers' equation in nonconservative form puts the shock in the wrong place

    Every uu here is positive, so information comes from the left and upwinding takes the left difference: ui←ui−(Δt/h) ui (ui−ui−1)u_i \leftarrow u_i - (\Delta t/h)\,u_i\,(u_i - u_{i-1}).

    Cameron's Example 1 uses exactly this left-upwind update U_j - (k/h) U_j (U_j - U_{j-1}) for positive u.

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  421. plausible Burgers' equation in nonconservative form puts the shock in the wrong place

    On smooth data this is a consistent first-order scheme.

    Cameron notes such schemes are consistent and stable yet propagate shocks at wrong speeds; first-order accuracy on smooth data is standard upwind theory (not separately accessed).

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  422. plausible Burgers' equation in nonconservative form puts the shock in the wrong place

    At a shock the product u uxu\,u_x is a value that jumps times a derivative that is infinite, and the scheme's answer depends on how it approximates that product.

    Informal explanation of why the nonconservative product is ill-defined at a shock; consistent with Cameron sec. 6.1 and Hou & LeFloch (1994), the latter not accessed.

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  423. not-checkable Burgers' equation in nonconservative form puts the shock in the wrong place

    The last cell repeats the nonconservative run on 400 and 1600 cells, and runs uR=0u_R = 0 as well.

    Describes this program's runs.

  424. not-checkable Burgers' equation in nonconservative form puts the shock in the wrong place

    The speeds on 400, 800 and 1600 cells agree to 3×10−63 \times 10^{-6} (S_SPREAD): the scheme converges, to a solution with the wrong shock speed.

    Program results; tested (S_SPREAD under 3e-6).

  425. plausible Burgers' equation in nonconservative form puts the shock in the wrong place

    A first-order error would halve with each refinement; this one does not change.

    A first-order error halves when h halves; the wrong-speed limit does not shrink, consistent with Cameron sec. 6.1. Not accessed as a separate source.

    M. Cameron, 'Notes on Burgers's equation' (UMD), eqs. (6)-(8) Rankine-Hugoniot, sec. 6.1 Example 1 (nonconservative upwind gives s = 0), sec. 6.2 telescoping, sec. 6.6 Godunov, https://www.math.umd.edu/~mariakc/burgers.pdf

  426. not-checkable Excitation energies of water from the Casida equation, with and without de-excitations

    Water in the 6-31G basis, from its Hartree-Fock ground state to all 40 singlet and 40 triplet excitation energies, two ways.

    Describes this program's calculation; 13 basis functions, 5 occupied, 8 virtual give 40 pairs.

  427. verified Excitation energies of water from the Casida equation, with and without de-excitations

    Time-dependent Hartree-Fock (the random-phase approximation) keeps the coupling BB between excitations and de-excitations; the Tamm-Dancoff approximation drops it and diagonalizes AA alone.

    TDHF (= RPA) keeps B; TDA sets Y = 0 and diagonalizes A (Herbert sec. 2.1, 2.1.3).

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  428. not-checkable Excitation energies of water from the Casida equation, with and without de-excitations

    The lowest singlet is at 0.344074 Ha (9.363 eV) in TDHF and 0.346161 Ha in TDA, and every one of the 160 energies matches PySCF's to 10−810^{-8} Ha.

    Program results linked to tests and the PySCF reference.

  429. plausible Excitation energies of water from the Casida equation, with and without de-excitations

    A molecule absorbs light at the energies of its excited states above the ground state, its excitation energies.

    Absorption energies are excitation energies (Bohr frequencies, Herbert sec. 2), though only dipole-allowed transitions absorb appreciably (triplets do not).

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  430. plausible Excitation energies of water from the Casida equation, with and without de-excitations

    Hartree-Fock gives only the ground state, a single set of occupied orbitals.

    HF is a single-determinant ground-state method; excited states need response or CI. Not accessed beyond Herbert's framing; from general knowledge.

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  431. verified Excitation energies of water from the Casida equation, with and without de-excitations

    Linear response asks how that state responds to a weak oscillating field: the response diverges at frequencies ω\omega that solve the eigenvalue problem above, the Casida equation.

    Linear-response TDHF/TDDFT: poles of the response give excitation energies solving the Casida (A,B) equation.

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  432. verified Excitation energies of water from the Casida equation, with and without de-excitations

    The unknowns are the amplitudes XiaX_{ia} for moving an electron from an occupied orbital ii to a virtual one aa, and YiaY_{ia} for the reverse.

    x_ia are occupied-to-virtual excitation amplitudes and y_ia de-excitation amplitudes.

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  433. not-checkable Excitation energies of water from the Casida equation, with and without de-excitations

    For a closed-shell molecule with real orbitals, orbital energies ε\varepsilon, and two-electron integrals (pq∣rs)(pq|rs) in the molecular-orbital basis (chemists' notation),

    Fragment introducing the formula that follows.

  434. verified Excitation energies of water from the Casida equation, with and without de-excitations

    Aia,jb=δijδab(εa−εi)+2(ia∣jb)−(ij∣ab),Bia,jb=2(ia∣jb)−(ib∣ja)A_{ia,jb} = \delta_{ij}\delta_{ab}(\varepsilon_a - \varepsilon_i) + 2(ia|jb) - (ij|ab), \qquad B_{ia,jb} = 2(ia|jb) - (ib|ja)

    Matches PySCF's singlet get_ab: A = diag(e_a - e_i) + 2(ia|jb) - (ij|ab), B = 2(ia|jb) - (ib|ja) for real orbitals.

    PySCF pyscf/tdscf/rhf.py get_ab (singlet A = diag(e_a - e_i) + 2(ai|bj) - (ij|ba); B = 2(ia|jb) - (ja|ib)), https://github.com/pyscf/pyscf/blob/master/pyscf/tdscf/rhf.py; J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  435. plausible Excitation energies of water from the Casida equation, with and without de-excitations

    For triplets the Coulomb terms 2(ia∣jb)2(ia|jb) drop out, since a spin flip moves no net charge.

    Herbert eqs. (30)-(31): the Coulomb term appears in the singlet but not the triplet matrices. 'Spin flip' is loose: the Ms = 0 triplet is an antisymmetric alpha/beta combination whose transition density carries no net charge.

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  436. verified Excitation energies of water from the Casida equation, with and without de-excitations

    With BB the equation is time-dependent Hartree-Fock (TDHF), also called the random-phase approximation (RPA).

    'TDHF is also known as the random phase approximation (RPA)' (Herbert sec. 2.1).

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  437. plausible Excitation energies of water from the Casida equation, with and without de-excitations

    The orbitals are the eigenvectors of the converged Fock matrix, and the integrals (pq∣rs)(pq|rs) over them come from four quarter-transformations of the atomic-orbital integrals.

    Canonical HF orbitals diagonalize the Fock matrix; the AO-to-MO integral transformation done one index at a time is standard. Not accessed; from general knowledge.

    PySCF pyscf/tdscf/rhf.py get_ab (singlet A = diag(e_a - e_i) + 2(ai|bj) - (ij|ba); B = 2(ia|jb) - (ja|ib)), https://github.com/pyscf/pyscf/blob/master/pyscf/tdscf/rhf.py

  438. not-checkable Excitation energies of water from the Casida equation, with and without de-excitations

    The pair iaia is stored at index i⋅nvir+(a−nocc)i \cdot n_\text{vir} + (a - n_\text{occ}).

    Describes this program's storage layout.

  439. verified Excitation energies of water from the Casida equation, with and without de-excitations

    TDA is one symmetric eigenvalue problem, A X=ωXA\,X = \omega X.

    TDA gives a conventional Hermitian eigenvalue problem A x = w x (Herbert sec. 2.1.3).

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  440. verified Excitation energies of water from the Casida equation, with and without de-excitations

    For TDHF the 2n×2n2n \times 2n problem is not symmetric, but it folds into a symmetric one of size nn.

    The non-Hermitian 2n problem is equivalent to a Hermitian problem of dimension n (Herbert eqs. 25-27).

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  441. verified Excitation energies of water from the Casida equation, with and without de-excitations

    Adding and subtracting its two block rows gives (A+B)(X+Y)=ω(X−Y)(A + B)(X + Y) = \omega(X - Y) and (A−B)(X−Y)=ω(X+Y)(A - B)(X - Y) = \omega(X + Y), so (A−B)(A+B)(X+Y)=ω2(X+Y)(A - B)(A + B)(X + Y) = \omega^2(X + Y).

    Herbert eq. (24): (A +- B)(x +- y) = w(x -+ y); multiplying gives (A - B)(A + B)(X + Y) = w^2 (X + Y).

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  442. verified Excitation energies of water from the Casida equation, with and without de-excitations

    When A−BA - B is positive definite, which holds when the Hartree-Fock state is stable against these rotations, it has a square root, and Z=(A−B)−1/2(X+Y)Z = (A - B)^{-1/2}(X + Y) turns the product into the symmetric matrix under the title.

    Replaces disputed 45362085f5b8. Eigenvector fixed from (X - Y) to (X + Y); the code computes only the eigenvalues, so no code change.

    Herbert, 'Density functional theory for electronic excited states', arXiv:2204.10135, eqs. 25-27 (read from the PDF): z_+ = sqrt(omega) (A - B)^{-1/2}(x + y) satisfies (A - B)^{1/2}(A + B)(A - B)^{1/2} z_+ = omega^2 z_+; Direct derivation from the post's (A + B)(X + Y) = omega(X - Y) and (A - B)(X - Y) = omega(X + Y)

  443. verified Excitation energies of water from the Casida equation, with and without de-excitations

    Its eigenvalues are ω2\omega^2.

    Omega z = w^2 z (Herbert eq. 26).

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  444. not-checkable Excitation energies of water from the Casida equation, with and without de-excitations

    All 160 energies agree with PySCF's to 3.7×10−93.7\times10^{-9} Ha, about what is left of the self-consistent field's convergence; the tests allow 10−810^{-8}.

    Program results against the PySCF reference; tested (160 energies, worst gap under 3.7e-9 Ha).

  445. plausible Excitation energies of water from the Casida equation, with and without de-excitations

    BB couples each excitation to the de-excitations, and its effect is to pull the energies down.

    Lowering holds for the lowest root (next sentence) and here for all roots, but is not a general theorem for every root. Not accessed; from general knowledge.

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  446. plausible Excitation energies of water from the Casida equation, with and without de-excitations

    For the lowest root this always holds.

    Thouless-type variational principle for the lowest RPA root, valid when the stability matrix is positive definite; setting Y = 0 recovers the TDA Rayleigh quotient. Not accessed; from general knowledge.

    J.M. Herbert, 'Density Functional Theory for Electronic Excited States', arXiv:2204.10135, sec. 2.1: TDHF also called RPA; eq. (24) (A+-B)(x+-y) = w(x-+y); eqs. (25)-(27) z+ = sqrt(w)(A-B)^{-1/2}(x+y), Omega+ = (A-B)^{1/2}(A+B)(A-B)^{1/2}, Omega z = w^2 z; eqs. (30)-(31) singlet/triplet stability matrices; sec. 2.1.3 TDA with HF is CIS, https://arxiv.org/abs/2204.10135

  447. not-checkable Excitation energies of water from the Casida equation, with and without de-excitations

    For water every root comes out lower in TDHF than in TDA, by 0.07 to 63 millihartree for the singlets and 0.01 to 19 for the triplets (posts/refs prints the same ranges from PySCF); the largest is the 25th singlet's, 63 millihartree.

    Program results against the reference; the ranges and the 25th-singlet value are program output.

  448. verified Excitation energies of water from the Casida equation, with and without de-excitations

    The 8 roots near 20 Ha, which move an electron out of the oxygen 1s orbital, shift by less than 0.25 millihartree.

    The last 8 singlet and 8 triplet roots lie at 20.18-21.59 Ha (1 core orbital x 8 virtuals); TDA-TDHF shifts there are 0.07-0.24 mHa (singlet) and 0.01-0.10 mHa (triplet), all below 0.25.

    posts/refs/casida-tdhf-and-tda-for-water.out (PySCF 2.5.0 TDHF/TDA roots, read)

  449. verified Excitation energies of water from the Casida equation, with and without de-excitations

    The triplets sit below the singlets.

    In the reference output every triplet root is below the singlet root of the same index, in both TDHF and TDA.

    posts/refs/casida-tdhf-and-tda-for-water.out (PySCF 2.5.0 TDHF/TDA roots, read)

  450. verified Excitation energies of water from the Casida equation, with and without de-excitations

    The singlet AA and BB carry the extra term 2(ia∣jb)2(ia|jb), whose diagonal 2(ia∣ia)2(ia|ia) is the Coulomb self-repulsion of the charge distribution ϕiϕa\phi_i\phi_a and is positive.

    The 2(ia|jb) term is present only in the singlet; (ia|ia) is the Coulomb self-energy of the real density phi_i phi_a and is positive because the Coulomb kernel is positive definite.

    PySCF 2.5.0 tdscf/rhf.py get_ab, add_hf_: singlet a += 2*(ia|jb) - (ij|ab), b += 2*(ia|jb) - (ib|ja) (read locally); Dreuw & Head-Gordon, Chem. Rev. 105, 4009 (2005), Sec. 2 (not accessed; from general knowledge)

  451. not-checkable Excitation energies of water from the Casida equation, with and without de-excitations

    The first figure shows the 32 valence excitation energies of each kind.

    Describes the post's figure; 4 valence occupied x 8 virtual = 32 is consistent with the reference's nocc=5, nvir=8.

  452. not-checkable Excitation energies of water from the Casida equation, with and without de-excitations

    The second shows, root by root, how far TDA lies above TDHF.

    Describes the post's figure.

  453. verified The double scroll of Chua's circuit

    Two capacitors, an inductor, a resistor and one diode whose current is a three-piece straight line.

    Two capacitors, one inductor, a resistor and Chua's diode with a piecewise-linear (three-segment) characteristic.

    Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986))

  454. verified The double scroll of Chua's circuit

    The voltages never settle and never repeat: they wind around two centers, hopping between them at irregular times.

    The double-scroll attractor winds around two outer equilibria with irregular switching; it is aperiodic.

    Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986)); L. O. Chua, 'The genesis of Chua's circuit', AEU 46(4):250-257 (1992), abstract via https://www.semanticscholar.org/paper/The-Genesis-of-Chua's-circuit-Chua/9e8622dcda32f95f1ecaa206a1f375ccd5b5d7da

  455. verified The double scroll of Chua's circuit

    The reference, in posts/refs/chuas-circuit-double-scroll.py, uses a different method and a different integrator: scipy's DOP853 at a tolerance of 10−1110^{-11}, carrying the linearized equations along the orbit, over 24000 time units.

    Describes the reference script, which does use DOP853 at 1e-11 with the variational equations over 24000 time units.

    posts/refs/chuas-circuit-double-scroll.py line 42: method='DOP853', rtol=1e-11, atol=1e-11 (read); posts/refs/chuas-circuit-double-scroll.out (read)

  456. verified The double scroll of Chua's circuit

    Chua's circuit is an electronic circuit designed by Leon Chua to be chaotic: its voltages follow a definite rule, with no randomness in it, yet never settle into a repeating pattern.

    Chua designed the circuit in 1983 by a systematic procedure specifically to obtain a chaotic, Lorenz-like system in a real circuit.

    L. O. Chua, 'The genesis of Chua's circuit', AEU 46(4):250-257 (1992), abstract via https://www.semanticscholar.org/paper/The-Genesis-of-Chua's-circuit-Chua/9e8622dcda32f95f1ecaa206a1f375ccd5b5d7da; Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986))

  457. verified The double scroll of Chua's circuit

    It has two capacitors, an inductor, a resistor, and one nonlinear part, a Chua diode: a small circuit whose current g(x)g(x) is a function of the voltage xx across it made of three straight pieces.

    Chua's diode is a piecewise-linear nonlinear resistor with three segments in the standard model.

    Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986))

  458. verified The double scroll of Chua's circuit

    In scaled units, with xx and yy the two capacitor voltages and zz the inductor current, the equations are the three above.

    In the dimensionless equations x and y are the voltages across C1 and C2 and z is the current through the inductor.

    Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986))

  459. plausible The double scroll of Chua's circuit

    The negative slopes make the origin unstable: a small voltage grows instead of dying away.

    The origin is indeed unstable, but what matters is the inner slope m0 being below -1 (term -alpha(1+m0) > 0), not merely negative; the outer slope m1 plays no role at the origin.

    Direct computation: Jacobian at the origin with alpha=9, beta=100/7, m0=-8/7 has eigenvalues 2.217 and -0.966 +/- 2.711i (numpy); Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986))

  460. plausible The double scroll of Chua's circuit

    Far out, the circuit's other parts win and push it back.

    Qualitative statement of the bounded, dissipative outer region; consistent with the equations.

    Direct computation: outer slope m1=-5/7 > -1 gives -alpha(1+m1) < 0, so the diode no longer overcomes the resistor far out (numpy check of Jacobian); Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986))

  461. verified The double scroll of Chua's circuit

    With nowhere stable to rest, the state keeps moving.

    All three equilibria are saddle-foci for these parameters, so there is no stable rest point.

    Direct computation (numpy): origin eigenvalues 2.217, -0.966+/-2.711i; outer equilibria -3.942, 0.185+/-3.047i, so all three equilibria are unstable; Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986))

  462. not-checkable The double scroll of Chua's circuit

    The program advances the state (x,y,z)(x, y, z) with the classical fourth-order Runge-Kutta method at a step of 0.0050.005, then runs 20000 steps (100 time units) so the state reaches the set it keeps returning to, the attractor, before anything is measured.

    Describes the program's integrator and settling run; 20000 x 0.005 = 100 is correct.

  463. plausible The double scroll of Chua's circuit

    That irregular count is the visible sign of chaos.

    Irregular switching between lobes is the usual visual signature of the double scroll; by itself it is not a proof of chaos, which the post then measures.

    Wikipedia, Chua's circuit, https://en.wikipedia.org/wiki/Chua%27s_circuit (pointer to Chua, Komuro, Matsumoto, 'The double scroll family', IEEE Trans. Circuits Syst. 33 (1986))

  464. not-checkable The double scroll of Chua's circuit

    Chaos has a measurable rate.

    Transition to the Lyapunov-exponent section.

  465. verified The double scroll of Chua's circuit

    On average the distance grows like d0eλtd_0 e^{\lambda t}; λ\lambda is the largest Lyapunov exponent, and a positive λ\lambda is what chaos means in numbers.

    Standard definition; a positive largest Lyapunov exponent is the usual quantitative criterion for chaos on a bounded attractor.

    Wikipedia, Lyapunov exponent, https://en.wikipedia.org/wiki/Lyapunov_exponent (pointer to Benettin et al., Meccanica 15 (1980); Wolf et al., Physica D 16 (1985)); S. Strogatz, Nonlinear Dynamics and Chaos, Sec. 9.3 (not accessed; from general knowledge)

  466. verified The double scroll of Chua's circuit

    The two copies cannot be left alone for long, since once their distance is as large as the attractor it stops growing.

    The separation saturates at the attractor's size, which is why Benettin's method renormalizes.

    Wikipedia, Lyapunov exponent, https://en.wikipedia.org/wiki/Lyapunov_exponent (pointer to Benettin et al., Meccanica 15 (1980); Wolf et al., Physica D 16 (1985)); Strogatz, Nonlinear Dynamics and Chaos, Sec. 9.3 (not accessed; from general knowledge)

  467. verified The double scroll of Chua's circuit

    The exponent is the sum divided by the elapsed time.

    Benettin-style estimate: sum of ln(d/d0) over renormalizations divided by elapsed time.

    Wikipedia, Lyapunov exponent, https://en.wikipedia.org/wiki/Lyapunov_exponent (pointer to Benettin et al., Meccanica 15 (1980); Wolf et al., Physica D 16 (1985))

  468. not-checkable The double scroll of Chua's circuit

    The estimate wanders early, while one or two passes near the center of a lobe can move it, and settles as the time grows.

    Describes the running estimate in this post's plot.

  469. verified The double scroll of Chua's circuit

    Past that time the equations are still exact, but a measurement of the starting voltage to eight digits no longer predicts which lobe the circuit is on.

    This is the predictability horizon t ~ ln(a/delta0)/lambda; ln(1e8)/0.3277 = 56.

    Wikipedia, Lyapunov exponent, https://en.wikipedia.org/wiki/Lyapunov_exponent (pointer to Benettin et al., Meccanica 15 (1980); Wolf et al., Physica D 16 (1985)); Strogatz, Nonlinear Dynamics and Chaos, Sec. 9.3 predictability horizon (not accessed; from general knowledge)

  470. verified Crank-Nicolson is second order in time, backward Euler first

    Each halving cuts the Crank-Nicolson error by a factor of 4.0 to 4.7 (measured order 2.09 to 2.23, then 2.000) and the backward Euler error by 1.9 to 2.0 (order 0.94 to 0.996).

    Reference orders: CN 2.142, 2.093, 2.113, 2.230, 2.000 (factors 4.0-4.7); BE 0.940-0.996 (factors 1.92-1.99).

    posts/refs/crank-nicolson-is-second-order-in-time.out (read)

  471. verified Crank-Nicolson is second order in time, backward Euler first

    The errors are measured against the exact solution of the space-discretized equation, a discrete sine series.

    The semi-discrete system's exact solution is an expansion in the discrete sine eigenvectors; the reference confirms it against a matrix exponential to 7e-14.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative (discrete Dirichlet case), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative; posts/refs/crank-nicolson-is-second-order-in-time.out (read)

  472. verified Crank-Nicolson is second order in time, backward Euler first

    The PDE's solution is the Fourier sine series

    Correct; the solution is a Fourier sine series.

    Standard separation of variables for u_t=u_xx with Dirichlet ends; W. Strauss, PDE: An Introduction, Sec. 4.1 (not accessed; from general knowledge); Direct integration: 2*int_0^1 x(1-x) sin(k pi x) dx = 4(1-(-1)^k)/(k pi)^3

  473. verified Crank-Nicolson is second order in time, backward Euler first

    u(x,t)=∑k odd8π3k3 sin⁡kπx  e−k2π2t,u(x, t) = \sum_{k\ \text{odd}} \frac{8}{\pi^3 k^3}\,\sin k\pi x\; e^{-k^2 \pi^2 t},

    Coefficients and decay rates are correct.

    Direct integration: 2*int_0^1 x(1-x) sin(k pi x) dx = 4(1-(-1)^k)/(k pi)^3 = 8/(pi^3 k^3) for odd k; Strauss, PDE: An Introduction, Sec. 4.1 (not accessed; from general knowledge)

  474. verified Crank-Nicolson is second order in time, backward Euler first

    since x(1−x)x(1 - x) has sine coefficients 8/(π3k3)8/(\pi^3 k^3) for odd kk and zero for even kk, and each mode decays at its own rate k2π2k^2\pi^2.

    Coefficients are 8/(pi^3 k^3) for odd k and 0 for even k; mode k decays as exp(-k^2 pi^2 t).

    Direct integration: 2*int_0^1 x(1-x) sin(k pi x) dx = 4(1-(-1)^k)/(k pi)^3

  475. not-checkable Crank-Nicolson is second order in time, backward Euler first

    The time steps are then the only error left to measure.

    Describes the post's measurement design.

  476. not-checkable Crank-Nicolson is second order in time, backward Euler first

    The Python reference, posts/refs/crank-nicolson-is-second-order-in-time.py, steps the same equations with scipy's banded solver and computes the exact space-discretized solution with a matrix exponential (output beside it).

    Describes the reference script.

  477. verified Crank-Nicolson is second order in time, backward Euler first

    Both schemes average the space difference between the old and the new time level, with weight θ\theta on the new one:

    The theta method weights the spatial operator by theta at the new level and 1-theta at the old; CN is theta=1/2, backward Euler theta=1.

    Wikipedia, Crank-Nicolson method, https://en.wikipedia.org/wiki/Crank%E2%80%93Nicolson_method (pointer to Crank & Nicolson 1947)

  478. verified Crank-Nicolson is second order in time, backward Euler first

    un+1−θ Δt δ2un+1=un+(1−θ) Δt δ2un.u^{n+1} - \theta\,\Delta t\,\delta^2 u^{n+1} = u^n + (1 - \theta)\,\Delta t\,\delta^2 u^n.

    Standard theta scheme for u_t = delta^2 u.

    Wikipedia, Crank-Nicolson method, https://en.wikipedia.org/wiki/Crank%E2%80%93Nicolson_method (pointer to Crank & Nicolson 1947)

  479. verified Crank-Nicolson is second order in time, backward Euler first

    The left side is a tridiagonal system, with 1+2θr1 + 2\theta r on the diagonal and −θr-\theta r beside it, r=Δt/h2r = \Delta t/h^2.

    Correct.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative (discrete Dirichlet case), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative; Derived from the theta scheme: (I - theta dt delta^2) has diagonal 1+2 theta r and off-diagonals -theta r

  480. verified Crank-Nicolson is second order in time, backward Euler first

    The Thomas algorithm solves it in one sweep down and one back up.

    The Thomas algorithm is a forward elimination sweep followed by back substitution.

    Wikipedia, Tridiagonal matrix algorithm, https://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm

  481. verified Crank-Nicolson is second order in time, backward Euler first

    The trapezoidal rule evaluates it at both ends, the first-order error terms of the two ends cancel, and what remains is Δt3\Delta t^3 per step and Δt2\Delta t^2 in total.

    The trapezoidal rule has local error O(dt^3) and global error O(dt^2).

    Wikipedia, Crank-Nicolson method, https://en.wikipedia.org/wiki/Crank%E2%80%93Nicolson_method (pointer to Crank & Nicolson 1947); E. Hairer, S. Norsett, G. Wanner, Solving ODEs I, Sec. II.1 (not accessed; from general knowledge)

  482. verified Crank-Nicolson is second order in time, backward Euler first

    The error of a time-stepping scheme is measured against the exact solution of the equations it steps, duj/dt=δ2ujdu_j/dt = \delta^2 u_j, which differs from the PDE's solution by the space error.

    The reference prints the space error max|semi-discrete - PDE series| = 1.95e-6, the difference between the two exact solutions.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative (discrete Dirichlet case), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative; posts/refs/crank-nicolson-is-second-order-in-time.out (read)

  483. verified Crank-Nicolson is second order in time, backward Euler first

    That solution is also a sine series.

    The discrete Dirichlet Laplacian has eigenvectors sin(k pi x_j) and eigenvalues -(4/h^2) sin^2(k pi h/2), which tend to -k^2 pi^2.

    Wikipedia, Eigenvalues and eigenvectors of the second derivative (discrete Dirichlet case), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative

  484. verified Crank-Nicolson is second order in time, backward Euler first

    uj(t)=∑k oddcksin⁡(kπxj) e−λkt,ck=4hcot⁡(kπh/2)λk,u_j(t) = \sum_{k\ \text{odd}} c_k \sin(k\pi x_j)\,e^{-\lambda_k t}, \qquad c_k = \frac{4h\cot(k\pi h/2)}{\lambda_k},

    Closed form checks out; the reference matches it to 2.8e-16 at t=0, and it tends to 8/(pi^3 k^3) as h -> 0.

    Derivation: -delta^2 u0 = 2 exactly for u0 = x(1-x); discrete sine coefficient of 2 is 4h sum_j sin(k pi j h) = 4h cot(k pi h/2) for odd k, 0 for even; Wikipedia, Eigenvalues and eigenvectors of the second derivative (discrete Dirichlet case), https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative; posts/refs/crank-nicolson-is-second-order-in-time.out (read)

  485. verified Crank-Nicolson is second order in time, backward Euler first

    Terms past k = 21 are below 10−190 at t = 0.1.

    True with a wide margin; even the k=21 term is ~1e-194.

    Direct evaluation: the k=23 term is 8/(pi^3 23^3) exp(-529 pi^2 0.1) ~ 1e-231, and later terms are smaller

  486. not-checkable Crank-Nicolson is second order in time, backward Euler first

    The cell runs both schemes at Δt=0.02,0.01,…,0.000625\Delta t = 0.02, 0.01, \ldots, 0.000625 (5 to 160 steps) and takes the largest error over the grid at t=0.1t = 0.1.

    Describes the cell; 0.1/0.02 = 5 and 0.1/0.000625 = 160 steps are consistent.

  487. verified Crank-Nicolson is second order in time, backward Euler first

    The measured order between two runs is log⁡2\log_2 of the ratio of their errors.

    Standard observed-order formula for step halving; the reference output uses it.

    R. LeVeque, Finite Difference Methods for ODEs and PDEs (SIAM 2007), Appendix A.6 on estimating order from error ratios (not accessed; from general knowledge); posts/refs/crank-nicolson-is-second-order-in-time.out (read)

  488. verified Crank-Nicolson is second order in time, backward Euler first

    At Δt=0.02\Delta t = 0.02 that is every mode from k=5k = 5 up, and it adds 47% (fast_share) to the error of the slowest mode alone.

    Reference: at dt=0.02 modes with dt*lambda_k > 2 (where the CN factor is negative) are k >= 5, and total CN error 4.555e-4 vs k=1 mode 3.095e-4 is 47% more.

    posts/refs/crank-nicolson-is-second-order-in-time.out (read); Wikipedia, Crank-Nicolson method, https://en.wikipedia.org/wiki/Crank%E2%80%93Nicolson_method (pointer to Crank & Nicolson 1947)

  489. plausible Crank-Nicolson is second order in time, backward Euler first

    After that the total is the space error.

    Approximate: at dt=0.000625 the CN-vs-PDE error is 1.65e-6 against a space error of 1.95e-6, so the total is the space error only to about 15%.

    posts/refs/crank-nicolson-is-second-order-in-time.out (read)

  490. verified Crank-Nicolson is second order in time, backward Euler first

    Refining Δt\Delta t further buys nothing unless hh is refined with it.

    Once the time error is below the O(h^2) space error, only refining h lowers the total.

    posts/refs/crank-nicolson-is-second-order-in-time.out (read); LeVeque, Finite Difference Methods, Ch. 9 (heat equation global error O(k^2 + h^2) for CN) (not accessed; from general knowledge)

  491. verified Electron mobility fitted to NIST's certified digits

    A seven-parameter rational model fitted to NIST's semiconductor electron-mobility data by lmder, the Levenberg-Marquardt routine of MINPACK, translated to Viv step by step.

    Thurber is a 7-parameter rational model on semiconductor electron mobility; lmder is MINPACK's Levenberg-Marquardt driver with analytic Jacobian.

    NIST StRD, Thurber.dat, https://www.itl.nist.gov/div898/strd/nls/data/LINKS/DATA/Thurber.dat (read); MINPACK lmder.f documentation (Garbow, Hillstrom, More, Argonne, March 1980), https://www.netlib.org/minpack/lmder.f (read)

  492. verified Electron mobility fitted to NIST's certified digits

    The data are 37 measurements from a NIST study of electron mobility in a semiconductor, as a function of the natural log of the carrier density (the Thurber data set of NIST's Statistical Reference Datasets).

    37 observations, response electron mobility, predictor natural log of density, NIST study (Thurber).

    NIST StRD, Thurber.dat, https://www.itl.nist.gov/div898/strd/nls/data/LINKS/DATA/Thurber.dat (read)

  493. verified Electron mobility fitted to NIST's certified digits

    NIST rates the fit "higher difficulty" and publishes certified parameter values to 11 digits.

    Listed as 'Higher Level of Difficulty'; certified values are given to 11 significant digits (e.g. 1.2881396800E+03).

    NIST StRD, Thurber.dat, https://www.itl.nist.gov/div898/strd/nls/data/LINKS/DATA/Thurber.dat (read)

  494. verified Electron mobility fitted to NIST's certified digits

    The model is a ratio of two cubics in x with seven parameters,

    Cubic/cubic rational class, 7 parameters.

    NIST StRD, Thurber.dat, https://www.itl.nist.gov/div898/strd/nls/data/LINKS/DATA/Thurber.dat (read)

  495. verified Electron mobility fitted to NIST's certified digits

    y(x)=b1+b2x+b3x2+b4x31+b5x+b6x2+b7x3,y(x) = \frac{b_1 + b_2 x + b_3 x^2 + b_4 x^3}{1 + b_5 x + b_6 x^2 + b_7 x^3},

    Matches NIST's model formula.

    NIST StRD, Thurber.dat, https://www.itl.nist.gov/div898/strd/nls/data/LINKS/DATA/Thurber.dat (read)

  496. verified Electron mobility fitted to NIST's certified digits

    and the fit minimizes the sum of squares of the 37 residuals fi=y(xi)−yif_i = y(x_i) - y_i.

    Least squares on 37 residuals.

    NIST StRD, Thurber.dat, https://www.itl.nist.gov/div898/strd/nls/data/LINKS/DATA/Thurber.dat (read)

  497. verified Electron mobility fitted to NIST's certified digits

    The fit is done by lmder from lib/minpack: a port of MINPACK's Levenberg-Marquardt code (Moré, Garbow and Hillstrom, Argonne, 1980), the same code scipy.optimize.leastsq calls.

    lmder is credited to Garbow, Hillstrom and More, Argonne, March 1980; scipy's leastsq calls lmder when a Jacobian (Dfun) is supplied, lmdif otherwise.

    MINPACK lmder.f documentation (Garbow, Hillstrom, More, Argonne, March 1980), https://www.netlib.org/minpack/lmder.f (read); SciPy docs, scipy.optimize.leastsq: 'leastsq is a wrapper around MINPACK's lmdif and lmder algorithms' (not accessed this session; from general knowledge)

  498. verified Electron mobility fitted to NIST's certified digits

    Each pass computes the Jacobian Jik=∂fi/∂bkJ_{ik} = \partial f_i / \partial b_k, factors it, and tries steps pp inside a trust region ∥Dp∥≤Δ\lVert D p \rVert \le \Delta, a radius around the current parameters where the linear model f(b+p)≈f(b)+Jpf(b + p) \approx f(b) + J p of the residuals is trusted.

    lmder uses a QR factorization of the Jacobian and a scaled step bound ||D p|| <= Delta, with diag scaling and factor setting the initial bound.

    MINPACK lmder.f documentation (Garbow, Hillstrom, More, Argonne, March 1980), https://www.netlib.org/minpack/lmder.f (read); J. J. More, 'The Levenberg-Marquardt algorithm: implementation and theory', Lecture Notes in Math. 630 (1978) (not accessed; from general knowledge)

  499. not-checkable Electron mobility fitted to NIST's certified digits

    Three references check the result:

    Transition.

  500. not-checkable Electron mobility fitted to NIST's certified digits

    the original Fortran, built with gfortran and instrumented to record every trial step (lib/minpack/oracle); the port does the same operations in the same order, and on this problem, which uses only arithmetic, every recorded number agrees to the last bit;

    Describes this program's cross-check against the instrumented Fortran.

  501. not-checkable Electron mobility fitted to NIST's certified digits

    scipy.optimize.leastsq, with the same settings;

    Describes this program's cross-check.

  502. verified Electron mobility fitted to NIST's certified digits

    info 1 means lmder stopped because both the actual and the predicted relative reduction of the sum of squares fell below the tolerance ε≈1.5×10−8\sqrt{\varepsilon} \approx 1.5 \times 10^{-8}, where ε\varepsilon is the machine precision.

    lmder docs: info=1 means 'both actual and predicted relative reductions in the sum of squares are at most ftol'; ftol = sqrt(machine eps) = 1.49e-8 is the setting used (also scipy's default).

    MINPACK lmder.f documentation (Garbow, Hillstrom, More, Argonne, March 1980), https://www.netlib.org/minpack/lmder.f (read)

  503. not-checkable Electron mobility fitted to NIST's certified digits

    It took 33 evaluations of the residuals and 27 of the Jacobian; each of the 32 trial steps after the first evaluation is one row of hist.

    Run statistics of this program, checked by the linker; 32 = 33 - 1.

  504. not-checkable Electron mobility fitted to NIST's certified digits

    The first two trial steps, starting with the Gauss-Newton step, make the fit worse and are rejected, and each rejection shrinks the trust radius.

    Describes this run's iteration history.

  505. not-checkable Electron mobility fitted to NIST's certified digits

    Three more are rejected in the next few passes, 5 of the 32 in all.

    Describes this run's iteration history, checked by the linker.

  506. plausible Forward and backward Euler on either side of h = 2/λ

    An equation is stiff when it has a component that decays much faster than the solution you want changes.

    A common informal definition based on separated time scales; Hairer and Wanner define it operationally (explicit methods need tiny steps), and the two agree for this problem.

    Wikipedia, Stiff equation, https://en.wikipedia.org/wiki/Stiff_equation (pointer to Dahlquist 1963; Hairer & Wanner, Solving ODEs II); LeVeque, Finite Difference Methods, Ch. 8 (not accessed; from general knowledge)

  507. not-checkable Forward and backward Euler on either side of h = 2/λ

    The Python reference, posts/refs/forward-euler-blows-up-past-h-equals-2-over-lambda.py, runs the same steps separately (output beside it).

    Describes the reference script.

  508. not-checkable Forward and backward Euler on either side of h = 2/λ

    Let yny_n be the computed solution and en=yn−cos⁡tne_n = y_n - \cos t_n its error.

    Notation.

  509. verified Forward and backward Euler on either side of h = 2/λ

    Forward Euler is yn+1=yn+hf(tn,yn)y_{n+1} = y_n + h f(t_n, y_n), and since ff depends on yy through −λy-\lambda y only,

    Forward Euler step; f = -lambda(y - cos t) - sin t depends on y only through -lambda y.

    Wikipedia, Stiff equation, https://en.wikipedia.org/wiki/Stiff_equation (pointer to Dahlquist 1963; Hairer & Wanner, Solving ODEs II)

  510. verified Forward and backward Euler on either side of h = 2/λ

    en+1=(1−hλ) en+τn,e_{n+1} = (1 - h\lambda)\,e_n + \tau_n,

    The error recursion follows directly; tau_n here is the undivided one-step error.

    Derivation from the forward Euler step and f = -lambda(y - cos t) - sin t, with tau_n = (one step from the exact value) - exact

  511. verified Forward and backward Euler on either side of h = 2/λ

    where τn\tau_n, the local truncation error, is what one step of the method gets wrong starting from the exact solution.

    This is the one-step (local) error; for forward Euler it is h^2/2 y''(xi). Note h^2/2 at h=0.0021 is 2.2e-6, so 'at most 2e-6' holds only to one significant figure.

    LeVeque, Finite Difference Methods, Sec. 5.5 local truncation error (not accessed; from general knowledge)

  512. verified Forward and backward Euler on either side of h = 2/λ

    Every error made earlier is multiplied by g=1−hλg = 1 - h\lambda at every later step.

    Correct.

    Follows from e_{n+1} = g e_n + tau_n by induction

  513. plausible Forward and backward Euler on either side of h = 2/λ

    Accuracy would allow a far larger step: the solution is cos⁡t\cos t.

    The solution cos t varies on a time scale of 1, so accuracy alone would allow steps far above 0.002; qualitative.

    Wikipedia, Stiff equation, https://en.wikipedia.org/wiki/Stiff_equation (pointer to Dahlquist 1963; Hairer & Wanner, Solving ODEs II)

  514. verified Forward and backward Euler on either side of h = 2/λ

    That is A-stability: the method is stable for every step size on every decaying mode.

    A-stability (Dahlquist 1963): the stability region contains the whole left half-plane, i.e. stable for every step on every decaying mode.

    Wikipedia, Stiff equation, https://en.wikipedia.org/wiki/Stiff_equation (pointer to Dahlquist 1963; Hairer & Wanner, Solving ODEs II)

  515. verified Forward and backward Euler on either side of h = 2/λ

    The cost is a solve per step (here a division, since the equation is linear in yy).

    Implicit methods require solving an equation per step; for a linear scalar equation it is a division.

    Wikipedia, Stiff equation, https://en.wikipedia.org/wiki/Stiff_equation (pointer to Dahlquist 1963; Hairer & Wanner, Solving ODEs II)

  516. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    On exe^x seven points reach rounding.

    Reference: e^x error 8.9e-16 at n=7, i.e. at rounding.

    posts/refs/gauss-legendre-quadrature-and-where-tanh-sinh-wins.out (read)

  517. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    A quadrature rule replaces an integral by a weighted sum of the integrand's values: ∫−11f(x) dx≈∑iwif(xi)\int_{-1}^1 f(x)\,dx \approx \sum_i w_i f(x_i).

    Definition of an interpolatory quadrature rule.

    DLMF 3.5.19-3.5.21 (Gauss-Legendre nodes, exactness, remainder), https://dlmf.nist.gov/3.5

  518. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    With nn points there are 2n2n numbers to choose, the nodes xix_i and the weights wiw_i.

    n nodes and n weights.

    DLMF 3.5.19-3.5.21 (Gauss-Legendre nodes, exactness, remainder), https://dlmf.nist.gov/3.5

  519. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The Gauss-Legendre rule chooses them so that the sum is exact for every polynomial of degree up to 2n−12n - 1, which is as high as 2n2n free numbers can reach.

    Gauss-Legendre is exact through degree 2n-1 (DLMF 3.5.20); no n-point rule can integrate prod(x-x_i)^2 of degree 2n exactly.

    DLMF 3.5.19-3.5.21 (Gauss-Legendre nodes, exactness, remainder), https://dlmf.nist.gov/3.5

  520. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The nodes turn out to be the roots of the Legendre polynomial PnP_n.

    Nodes are the zeros of P_n (DLMF 3.5.21).

    DLMF 3.5.19-3.5.21 (Gauss-Legendre nodes, exactness, remainder), https://dlmf.nist.gov/3.5

  521. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    On the second one a different rule, tanh-sinh, does far better.

    Tanh-sinh is designed for endpoint singularities; the reference shows it reaching rounding on 1/sqrt(1-x^2).

    Wikipedia, Tanh-sinh quadrature, https://en.wikipedia.org/wiki/Tanh-sinh_quadrature (pointer to Takahasi & Mori, Publ. RIMS Kyoto Univ. 9 (1974) 721-741); posts/refs/gauss-legendre-quadrature-and-where-tanh-sinh-wins.out (read)

  522. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The reference is posts/refs/gauss-legendre-quadrature-and-where-tanh-sinh-wins.py (output beside it): numpy's leggauss, which gets the nodes from the eigenvalues of a tridiagonal matrix rather than by Newton's method as here, closed-form integrals, and the tanh-sinh rule written in numpy.

    Nodes come from the eigenvalues of the symmetric tridiagonal companion matrix; numpy then applies a single Newton correction, so 'rather than by Newton's method' is right about the main method.

    NumPy source, numpy/polynomial/legendre.py leggauss: x = eigvalsh(legcompanion(c)) then 'improve roots by one application of Newton' (read locally)

  523. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The cell integrates (1+x)k(1 + x)^k for k=0,1,…,13k = 0, 1, \dots, 13, whose exact integral is 2k+1/(k+1)2^{k+1}/(k + 1), with the 5-point rule and with the 3-point rule.

    Correct formula; the reference tabulates the same test.

    int_{-1}^{1} (1+x)^k dx = 2^{k+1}/(k+1) (elementary); posts/refs/gauss-legendre-quadrature-and-where-tanh-sinh-wins.out (read)

  524. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    At degree 2n2n the miss is known exactly.

    For a degree-2n polynomial f^(2n) is constant, so the remainder formula gives the error exactly.

    DLMF 3.5.19-3.5.21 (Gauss-Legendre nodes, exactness, remainder), https://dlmf.nist.gov/3.5

  525. not-checkable Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The error of the nn-point rule is

    Lead-in to a formula.

  526. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    ∫−11f dx−∑iwif(xi)=22n+1(n!)4(2n+1) ((2n)!)3 f(2n)(ξ)\int_{-1}^1 f\,dx - \sum_i w_i f(x_i) = \frac{2^{2n+1} (n!)^4}{(2n+1)\,((2n)!)^3}\, f^{(2n)}(\xi)

    DLMF 3.5.19 with gamma_n = 2^{2n+1}(n!)^4/((2n+1)((2n)!)^2) and division by (2n)! gives this formula; the reference's n=5, degree-10 miss matches it.

    DLMF 3.5.19-3.5.21 (Gauss-Legendre nodes, exactness, remainder), https://dlmf.nist.gov/3.5; posts/refs/gauss-legendre-quadrature-and-where-tanh-sinh-wins.out (read)

  527. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    exe^x is not a polynomial, but it is smooth everywhere, including off the real line, and polynomials approximate it well.

    e^x is entire; the reference shows super-geometric error decay to rounding at n=7.

    L. N. Trefethen, Approximation Theory and Approximation Practice, Ch. 19 (Gauss quadrature converges geometrically for analytic integrands) (not accessed; from general knowledge); posts/refs/gauss-legendre-quadrature-and-where-tanh-sinh-wins.out (read)

  528. not-checkable Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    1/1−x21/\sqrt{1 - x^2} is a different case.

    Transition.

  529. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The rule never evaluates at ±1\pm 1, which is good, since the value there is infinite; but its outermost node sits a distance of order 1/n21/n^2 from the end, and the integral over that last stretch, ∫dx/2(1−x)\int dx / \sqrt{2(1 - x)} over a length of order 1/n21/n^2, is of order 1/n1/n.

    The outermost node is O(1/n^2) from the end and the error is O(1/n), with n*error = 1.64-1.74.

    Direct computation with numpy leggauss: n^2(1 - x_max) = 2.54, 2.71, 2.80, 2.85, 2.87 for n = 8..128 (limit j_{0,1}^2/2 = 2.89); posts/refs/gauss-legendre-quadrature-and-where-tanh-sinh-wins.out (read)

  530. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    At that rate each further digit costs ten times as many points.

    With error ~ c/n, a tenfold smaller error needs tenfold more points.

    posts/refs/gauss-legendre-quadrature-and-where-tanh-sinh-wins.out (read)

  531. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The tanh-sinh rule, from Takahasi and Mori (1974), changes variables first:

    Takahasi and Mori, 'Double exponential formulas for numerical integration', Publ. RIMS 9 (1974).

    Wikipedia, Tanh-sinh quadrature, https://en.wikipedia.org/wiki/Tanh-sinh_quadrature (pointer to Takahasi & Mori, Publ. RIMS Kyoto Univ. 9 (1974) 721-741)

  532. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    x=tanh⁡ ⁣(π2sinh⁡t),dx=π2cosh⁡t sech⁡2 ⁣(π2sinh⁡t) dt.x = \tanh\!\big(\tfrac{\pi}{2} \sinh t\big), \qquad dx = \tfrac{\pi}{2} \cosh t\,\operatorname{sech}^2\!\big(\tfrac{\pi}{2} \sinh t\big)\, dt.

    Correct substitution and Jacobian.

    Wikipedia, Tanh-sinh quadrature, https://en.wikipedia.org/wiki/Tanh-sinh_quadrature (pointer to Takahasi & Mori, Publ. RIMS Kyoto Univ. 9 (1974) 721-741); Differentiation: d/dt tanh(pi/2 sinh t) = (pi/2) cosh t sech^2(pi/2 sinh t)

  533. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    As tt runs over the whole line, xx runs over (−1,1)(-1, 1), and the endpoints move off to t=±∞t = \pm\infty.

    tanh(pi/2 sinh t) maps R onto (-1, 1).

    Wikipedia, Tanh-sinh quadrature, https://en.wikipedia.org/wiki/Tanh-sinh_quadrature (pointer to Takahasi & Mori, Publ. RIMS Kyoto Univ. 9 (1974) 721-741)

  534. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The factor dx/dtdx/dt falls like exp⁡(−π2e∣t∣)\exp(-\tfrac{\pi}{2} e^{|t|}), a double exponential, which is faster than 1/1−x21/\sqrt{1 - x^2} grows.

    dx/dt decays like exp(-(pi/2) e^{|t|}) up to a single-exponential factor, faster than the integrand grows.

    Wikipedia, Tanh-sinh quadrature, https://en.wikipedia.org/wiki/Tanh-sinh_quadrature (pointer to Takahasi & Mori, Publ. RIMS Kyoto Univ. 9 (1974) 721-741); Asymptotics: sech^2(u) ~ 4 exp(-2u), u ~ (pi/4) e^{|t|}, while 1/sqrt(1-x^2) = cosh(u) ~ exp((pi/4) e^{|t|})/2

  535. not-checkable Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    There is one trap.

    Transition.

  536. not-checkable Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    With h=1/4h = 1/4 that happens at 12 of the 37 nodes, and the sum is infinite.

    Describes this program's run at h = 1/4; the count is checked by the linked test.

  537. plausible Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    Halving hh doubles the points.

    Roughly true: with a fixed truncation range the rule has about 2T/h + 1 points, so halving h gives 2N - 1 (19 -> 37 -> 73), not exactly double.

    Wikipedia, 'Tanh-sinh quadrature' (pointer): 'not as efficient as Gaussian quadrature for smooth integrands', https://en.wikipedia.org/wiki/Tanh-sinh_quadrature; Post's own counts: 9, 19, 37, 73 points at h = 1, 1/2, 1/4, 1/8

  538. verified Gauss-Legendre quadrature against tanh-sinh on a smooth and a singular integral

    The substitution spends most of its points near the ends, and a smooth integrand has nothing there that needs them.

    Tanh-sinh clusters its nodes double-exponentially toward the endpoints and is less efficient than Gauss-Legendre on smooth integrands, as the sources state.

    Wikipedia, 'Tanh-sinh quadrature' (pointer): 'not as efficient as Gaussian quadrature for smooth integrands', https://en.wikipedia.org/wiki/Tanh-sinh_quadrature; Bailey, Jeyabalan, Li, 'A comparison of three high-precision quadrature schemes', Experimental Mathematics 14(3), 2005, https://www.osti.gov/servlets/purl/822964

  539. not-checkable Grad-Shafranov by finite differences, against Solov'ev's closed form

    A tokamak equilibrium solved on a grid and graded against an exact one.

    Describes this post.

  540. plausible Grad-Shafranov by finite differences, against Solov'ev's closed form

    A tokamak holds its plasma in a magnetic field shaped like nested doughnuts.

    Informal but correct: tokamak field lines lie on nested toroidal flux surfaces. Not accessed; from general knowledge.

    Not accessed; from general knowledge (nested toroidal flux surfaces, e.g. Freidberg, Ideal MHD); Wikipedia, 'Grad-Shafranov equation' (pointer; derives from grad p = J x B, psi and p(psi), F(psi) constant along field lines), https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation

  541. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    In equilibrium the magnetic force balances the pressure gradient, J×B=∇p\mathbf J \times \mathbf B = \nabla p.

    Ideal MHD static equilibrium is grad p = J x B.

    Wikipedia, 'Grad-Shafranov equation' (pointer; derives from grad p = J x B, psi and p(psi), F(psi) constant along field lines), https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation

  542. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    With the machine's rotational symmetry about its vertical axis, that balance reduces to one equation for one function, the poloidal flux ψ(R,Z)\psi(R, Z), where RR is the distance from the axis of symmetry and ZZ the height.

    Axisymmetry reduces force balance to the Grad-Shafranov equation for the poloidal flux psi(R, Z).

    Wikipedia, 'Grad-Shafranov equation' (pointer; derives from grad p = J x B, psi and p(psi), F(psi) constant along field lines), https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation

  543. not-checkable Grad-Shafranov by finite differences, against Solov'ev's closed form

    The equation is the Grad-Shafranov equation above.

    Transition referring to the equation shown in the post.

  544. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    Its right side holds two free functions of ψ\psi, the pressure pp and F=RBϕF = RB_\phi.

    The source terms are the free functions p(psi) and F(psi) = R B_phi (toroidal field).

    Wikipedia, 'Grad-Shafranov equation' (pointer; derives from grad p = J x B, psi and p(psi), F(psi) constant along field lines), https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation

  545. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    When p′p' and FF′FF' are constants the equation is linear, and Solov'ev (1968) wrote down exact solutions.

    With p' and FF' constant the right side no longer depends on psi, so the equation is linear; Solov'ev's 1968 exact solutions are the basis of Cerfon and Freidberg's analytic equilibria.

    Cerfon and Freidberg, '"One size fits all" analytic solutions to the Grad-Shafranov equation', Phys. Plasmas 17, 032502 (2010), built on Solov'ev profiles (constant p' and FF'), https://pubs.aip.org/aip/pop/article/17/3/032502/106623

  546. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    ψ(R,Z)=(R2−1)28+R2Z22κ2\psi(R, Z) = \frac{(R^2-1)^2}{8} + \frac{R^2Z^2}{2\kappa^2}

    Satisfies the GS equation with FF' = 0 and -mu0 p' = 1 + 1/kappa^2; near (1,0) psi ~ (R-1)^2/2 + Z^2/(2 kappa^2), ellipses of elongation kappa.

    Direct sympy check in this session: Delta* psi = psi_RR - psi_R/R + psi_ZZ = (1 + 1/kappa^2) R^2 for this psi; Wikipedia, 'Grad-Shafranov equation' (pointer; derives from grad p = J x B, psi and p(psi), F(psi) constant along field lines), https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation

  547. not-checkable Grad-Shafranov by finite differences, against Solov'ev's closed form

    posts/refs/grad-shafranov-solovev.py checks the closed form with sympy, then solves the same finite-difference equations directly with scipy's sparse LU, which shares no code or method with the SOR iteration here.

    Describes the reference script.

  548. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    On a grid with spacing hRh_R in RR and hZh_Z in ZZ, the centered differences for ψRR\psi_{RR}, ψR\psi_R and ψZZ\psi_{ZZ} give at each interior node

    The stencil in the next line is the standard centered discretization of the GS operator.

    Wikipedia, 'Grad-Shafranov equation' (pointer; derives from grad p = J x B, psi and p(psi), F(psi) constant along field lines), https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation; Direct sympy check in this session: centered differences of psi_RR - psi_R/R + psi_ZZ give coefficients 1/h^2 -/+ 1/(2Rh) on psi_{i+/-1,j}

  549. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    (1hR2−12RhR)ψi+1,j+(1hR2+12RhR)ψi−1,j+ψi,j+1+ψi,j−1hZ2−(2hR2+2hZ2)ψi,j=(1+κ−2)Ri2,\Big(\tfrac{1}{h_R^2} - \tfrac{1}{2Rh_R}\Big)\psi_{i+1,j} + \Big(\tfrac{1}{h_R^2} + \tfrac{1}{2Rh_R}\Big)\psi_{i-1,j} + \frac{\psi_{i,j+1} + \psi_{i,j-1}}{h_Z^2} - \Big(\tfrac{2}{h_R^2} + \tfrac{2}{h_Z^2}\Big)\psi_{i,j} = (1 + \kappa^{-2})R_i^2 ,

    Correct discretization of Delta* psi = (1 + 1/kappa^2) R^2.

    Wikipedia, 'Grad-Shafranov equation' (pointer; derives from grad p = J x B, psi and p(psi), F(psi) constant along field lines), https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation; Direct sympy check in this session: coefficients follow from (psi_{i+1}-2psi_i+psi_{i-1})/h^2 - (psi_{i+1}-psi_{i-1})/(2Rh) + Z terms

  550. not-checkable Grad-Shafranov by finite differences, against Solov'ev's closed form

    with ψ\psi fixed to the closed form on the edge of the box.

    Describes this program's boundary condition.

  551. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    The −ψR/R-\psi_R/R term makes the equation unsymmetric in RR; that is the only difference from Poisson's equation.

    Delta* = d2/dR2 - (1/R) d/dR + d2/dZ2 differs from the 2D Laplacian only by -psi_R/R, which makes the discrete operator nonsymmetric.

    Wikipedia, 'Grad-Shafranov equation' (pointer; derives from grad p = J x B, psi and p(psi), F(psi) constant along field lines), https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation

  552. not-checkable Grad-Shafranov by finite differences, against Solov'ev's closed form

    The three grids have 8, 16 and 32 intervals across RR and 14, 28 and 56 across ZZ, so hR=hZ=hh_R = h_Z = h = 0.1, 0.05 and 0.025.

    Describes this program's grids; consistent with the reference's 9x15, 17x29, 33x57 grids.

  553. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    The error of the difference equations is second order, and here it can be written down.

    Centered differences are second order; the derivation in the following sentences checks out.

    LeVeque, Finite Difference Methods for ODEs and PDEs (SIAM 2007), Ch. 1-2 (centered differences are O(h^2)); not accessed, from general knowledge; Direct sympy check in this session: truncation error computed below is -h^2/4

  554. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    The closed form's R2Z2R^2Z^2 term is a quadratic in each variable, so the centered differences are exact on it.

    Correct: truncation terms involve third and fourth derivatives, which vanish for R^2 and Z^2.

    Direct sympy check in this session: centered first and second differences are exact on quadratics; R^2 Z^2 is quadratic in R and in Z

  555. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    On (R2−1)2/8(R^2-1)^2/8 the second difference is off by h2ψRRRR/12=h2/4h^2\psi_{RRRR}/12 = h^2/4 and the first difference over RR by h2ψRRR/(6R)=h2/2h^2\psi_{RRR}/(6R) = h^2/2, so the difference operator applied to the exact ψ\psi misses the source by −h2/4-h^2/4, the same constant at every node.

    The arithmetic is correct: the difference operator applied to the exact psi misses the source by -h^2/4 everywhere.

    Direct sympy check in this session: psi_RRRR = 3, psi_RRR = 3R for (R^2-1)^2/8; errors h^2*3/12 = h^2/4 and h^2*3R/(6R) = h^2/2; net h^2/4 - h^2/2 = -h^2/4

  556. verified Grad-Shafranov by finite differences, against Solov'ev's closed form

    The error e=ψh−ψe = \psi_h - \psi therefore solves the difference equation with source h2/4h^2/4 and zero boundary values: it is h2h^2 times a fixed function, up to that function's own discretization, and each halving of hh divides it by 4.

    Correct consequence; the run's errors 1.68e-4, 4.21e-5, 1.06e-5 fall by about 4.

    Direct sympy check in this session: L_h psi_h = f, L_h psi = f - h^2/4 so L_h e = h^2/4 with e = 0 on the boundary

  557. plausible Grad-Shafranov by finite differences, against Solov'ev's closed form

    That offset is the Shafranov shift, and it appears whenever there is pressure: the plasma pushes itself outward, where the field is weaker.

    True for this pressure-only equilibrium, but in general the toroidal current's hoop force also shifts the axis outward even without pressure; 'whenever there is pressure' is correct as a sufficient condition.

    CIEMAT FusionWiki, 'Shafranov shift': outward displacement of flux-surface centers 'induced by plasma pressure and the hoop force' (search snippet read; page itself failed TLS), https://wiki.fusion.ciemat.es/fusionwiki/index.php?title=Shafranov_shift

  558. verified Graphene's Dirac cones

    An electron hopping between neighboring carbon atoms of a honeycomb has two energy bands, and they touch at the corners of the Brillouin zone.

    Nearest-neighbor tight binding on the honeycomb gives two bands touching at K and K', the corners of the Brillouin zone.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  559. verified Graphene's Dirac cones

    Near a corner the energy rises in a straight line in every direction, a cone, with slope vF=3ta/2ℏv_F = 3ta/2\hbar.

    Castro Neto Eq. (7): E = +/- v_F |q| with v_F = 3ta/2 (hbar = 1).

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  560. not-checkable Graphene's Dirac cones

    The reference, in posts/refs/graphenes-dirac-cones.py, builds the 2 by 2 Hamiltonian as a complex matrix and diagonalizes it with numpy.linalg.eigvalsh, where the post uses the closed form ±∣f∣\pm|f|; it finds the slope at K by a least-squares line through 20 points in each of 12 directions.

    Describes the reference script.

  561. verified Graphene's Dirac cones

    The geometry follows Castro Neto et al., Rev. Mod. Phys. 81, 109 (2009).

    Citation is correct, and the post's delta vectors match Castro Neto Eq. (2): delta_{1,2} = (a/2)(1, +/-sqrt3), delta_3 = -a(1,0).

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  562. verified Graphene's Dirac cones

    Graphene is a single sheet of carbon atoms in a honeycomb.

    Castro Neto Sec. II: graphene is a one-atom-thick sheet of carbon in a honeycomb lattice.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  563. verified Graphene's Dirac cones

    The honeycomb is not itself a lattice with one atom per cell: its atoms come in two kinds, A and B, and every A atom has three B neighbors, at the vectors δ1=(12,32)\boldsymbol\delta_1 = (\tfrac12, \tfrac{\sqrt3}{2}), δ2=(12,−32)\boldsymbol\delta_2 = (\tfrac12, -\tfrac{\sqrt3}{2}) and δ3=(−1,0)\boldsymbol\delta_3 = (-1, 0) in units of aa.

    Castro Neto Sec. II.A: the honeycomb is two interpenetrating triangular sublattices A and B, with nearest-neighbor vectors as given (Eq. 2).

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  564. verified Graphene's Dirac cones

    Tight binding keeps one orbital per atom and lets an electron hop only to a nearest neighbor, with energy −t-t.

    Castro Neto Eq. (5) with t' = 0: nearest-neighbor hopping -t between A and B sites, one pi orbital per atom.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  565. verified Graphene's Dirac cones

    H(k)=(0f(k)f∗(k)0),f(k)=−t∑jeik⋅δj.H(\mathbf k) = \begin{pmatrix} 0 & f(\mathbf k) \\ f^*(\mathbf k) & 0 \end{pmatrix}, \qquad f(\mathbf k) = -t\sum_j e^{i\mathbf k\cdot\boldsymbol\delta_j}.

    Standard 2x2 Bloch Hamiltonian for nearest-neighbor hopping; |f| reproduces Castro Neto Eq. (6) with t' = 0.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  566. verified Graphene's Dirac cones

    Its eigenvalues are ±∣f(k)∣\pm|f(\mathbf k)|: two bands, mirror images of each other.

    Castro Neto: the spectrum is symmetric about zero energy when t' = 0.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  567. verified Graphene's Dirac cones

    With one electron per carbon, the lower band is full and the upper one empty, so everything interesting happens where they come closest.

    One pi electron per carbon fills the lower (pi) band; Castro Neto describes graphene at half filling with the Fermi level at the Dirac points.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  568. verified Graphene's Dirac cones

    At the middle of an edge, M, they are at ±t\pm t.

    At M the phases are e^{i pi/3} twice and e^{-2 pi i/3}, summing to modulus 1.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163; Direct numerical check in this session: |f(M)|/t = 1.000 at M = (2pi/3a, 0)

  569. verified Graphene's Dirac cones

    At the corner K the three phases are 11, e2πi/3e^{2\pi i/3} and e−2πi/3e^{-2\pi i/3}, three unit arrows at 120° to each other, which add to zero: the bands touch.

    Correct: three unit phasors 120 degrees apart sum to zero.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163; Direct check: with K = (2pi/3a, 2pi/(3 sqrt3 a)) the phases k.delta_j are 2pi/3, 0, -2pi/3; |f(K)| = 4e-16

  570. verified Graphene's Dirac cones

    The standard picture follows the straight lines Γ→\Gamma \to K →\to M →Γ\to \Gamma through the zone.

    Castro Neto Fig. 2-3 label Gamma, K, M; band plots along Gamma-K-M-Gamma are the standard path.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  571. verified Graphene's Dirac cones

    At K the two bands meet in a V: the energy rises linearly with the distance from K, not quadratically.

    Castro Neto Eq. (7): the dispersion near K is linear, E = +/- v_F |q|.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  572. verified Graphene's Dirac cones

    The same happens in every direction, so in the plane of k\mathbf k the two bands form a pair of cones touching at their tips, called Dirac cones because a massless relativistic particle obeying the Dirac equation has the same linear relation between energy and momentum.

    Castro Neto: the low-energy excitations are 'Dirac-like', massless with linear E(q) like a massless Dirac particle.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  573. not-checkable Graphene's Dirac cones

    The map below shows the upper band over the plane.

    Describes the post's figure.

  574. verified Graphene's Dirac cones

    The Brillouin zone is the hexagon of momenta closer to Γ\Gamma, the center of the map, than to any other point of the reciprocal lattice, drawn dashed, and the band reaches zero at its six corners, the dark spots around the center.

    The first Brillouin zone of the triangular reciprocal lattice is a hexagon whose six corners are K and K' points where the bands touch.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163; Ashcroft and Mermin, Solid State Physics, Ch. 5 (first Brillouin zone = Wigner-Seitz cell of the reciprocal lattice); not accessed, from general knowledge

  575. not-checkable Graphene's Dirac cones

    The four dark spots near the map's left and right edges are corners of the neighboring hexagons.

    Describes the post's figure.

  576. not-checkable Graphene's Dirac cones

    Near K, write k=K+q\mathbf k = \mathbf K + \mathbf q.

    Definition of notation.

  577. verified Graphene's Dirac cones

    Expanding each phase to first order in q\mathbf q gives ∣f∣≈32ta∣q∣|f| \approx \tfrac{3}{2} t a |\mathbf q|, so E=±ℏvF∣q∣E = \pm \hbar v_F |\mathbf q| with vF=3ta/2ℏv_F = 3ta/2\hbar, the Fermi velocity: the speed of the electrons at the energy where the full band meets the empty one.

    Castro Neto Eq. (7): v_F = 3ta/2 (hbar = 1); v_F is the group velocity at the Dirac point.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  578. verified Graphene's Dirac cones

    The next term of the expansion is proportional to q2cos⁡3φq^2\cos 3\varphi, which changes sign between u\mathbf u and −u-\mathbf u, so the centered difference cancels it and leaves an error of order h2h^2.

    Castro Neto Eq. (8): second-order term is (3ta^2/8) sin(3 theta_q) q^2 (angle convention differs from cos 3 phi); it flips sign under q -> -q, so the centered difference cancels it.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  579. verified Graphene's Dirac cones

    Every direction gives 1.51.5, the worst off by 1.9×10−91.9\times10^{-9} (worst): the cone is round to first order, and its slope is 3ta/2ℏ3ta/2\hbar.

    Linear term is isotropic with slope 3ta/2 (Eq. 7); 1.5 and the worst deviation 1.87e-9 are computed by the program.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  580. verified Graphene's Dirac cones

    It is not round to second order.

    Castro Neto Eq. (8): trigonal warping, a sin(3 theta) q^2 term, makes the cone anisotropic at second order.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163

  581. verified Graphene's Dirac cones

    Going one way from K, toward M, the band rises a little slower than the straight line, and going toward Γ\Gamma a little faster.

    Matches Eq. (8)'s +/- 3/8 coefficient: slower toward M, faster toward Gamma.

    Castro Neto, Guinea, Peres, Novoselov, Geim, 'The electronic properties of graphene', Rev. Mod. Phys. 81, 109 (2009), Sec. II.A, Eqs. (1)-(8), https://arxiv.org/abs/0709.1163; Direct numerical check in this session: (E - 1.5 q)/q^2 = -0.3752 toward M and +0.3748 toward Gamma at q = 1e-3

  582. not-checkable RHF, UHF and full CI for H₂ in STO-3G along the bond

    Pull the two atoms of H₂ apart in the smallest basis there is, and compute its energy three ways.

    Introduces the post.

  583. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Full CI is exact in this basis.

    Hait et al.: FCI is exact within the basis (and invariant to orbital choice).

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  584. not-checkable RHF, UHF and full CI for H₂ in STO-3G along the bond

    The program is self-contained: the STO-3G basis, the integrals over Gaussian functions, the Hartree-Fock and full-CI energies, all in this file.

    Describes this program.

  585. not-checkable RHF, UHF and full CI for H₂ in STO-3G along the bond

    The reference is PySCF 2.5.0 (posts/refs/h2-rhf-uhf-and-full-ci-along-the-bond.py), which shares no code with it: its own basis library, integrals, SCF solvers, stability analysis and full-CI solver.

    Describes the reference script and PySCF's role.

  586. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Units are atomic: energies in hartree (1 Ha = 27.211 eV), lengths in bohr (1 bohr = 0.5292 Å), both from CODATA 2022.

    27.211 eV and 0.5292 Angstrom are the 2022 CODATA values rounded.

    NIST CODATA 2022: hartree energy in eV = 27.211 386 245 981(30) eV, https://physics.nist.gov/cgi-bin/cuu/Value?hrev (read in this session); NIST CODATA 2022: Bohr radius = 5.291 772 105 44(82) x 10^-11 m, https://physics.nist.gov/cgi-bin/cuu/Value?bohrrada0 (read in this session)

  587. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    A hydrogen molecule has two electrons and two protons.

    Minimal-basis H2 is a two-electron system (Hait et al.); two protons trivially.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  588. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Its electrons' wave function has to be built out of something, and the smallest choice is one function per atom.

    Minimal basis STO-3G H2 has one 1s function per atom, two spatial orbitals.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  589. plausible RHF, UHF and full CI for H₂ in STO-3G along the bond

    Gaussians are used because every integral the calculation needs has a closed form for them.

    Standard reason (Gaussian product theorem gives closed forms, Boys 1950). Book not accessed; from general knowledge, but the closed forms were checked against PySCF here.

    Szabo and Ostlund, Modern Quantum Chemistry, Sec. 3.5 and Appendix A; not accessed, from general knowledge; Direct check in this session: the S, T, V_C and ERI formulas for unnormalized s Gaussians, times primitive normalizations, reproduce PySCF 2.5.0 int1e_ovlp/int1e_kin/int1e_nuc/int2e to 3e-14

  590. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    For two s Gaussians with exponents aa and bb, the product is one Gaussian of exponent p=a+bp = a + b centered between them, and the standard results (Szabo and Ostlund, Modern Quantum Chemistry, Appendix A) are

    Gaussian product theorem: product is a Gaussian of exponent a+b centered between. Szabo-Ostlund Appendix A attribution not accessed directly.

    Ho and Hernandez-Perez, 'Evaluation of Gaussian molecular integrals', The Mathematica Journal 14 (2012), Gaussian product theorem and Eq. (6), https://www.mathematica-journal.com/2012/02/16/evaluation-of-gaussian-molecular-integrals/; Direct check in this session: the S, T, V_C and ERI formulas for unnormalized s Gaussians, times primitive normalizations, reproduce PySCF 2.5.0 int1e_ovlp/int1e_kin/int1e_nuc/int2e to 3e-14

  591. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    S=(πp)3/2e−abpRAB2,T=abp(3−2abpRAB2)S,VC=−2πpe−abpRAB2F0(pRPC2),S = \left(\tfrac{\pi}{p}\right)^{3/2} e^{-\frac{ab}{p} R_{AB}^2}, \quad T = \tfrac{ab}{p}\left(3 - \tfrac{2ab}{p}R_{AB}^2\right) S, \quad V_C = -\tfrac{2\pi}{p} e^{-\frac{ab}{p} R_{AB}^2} F_0(p R_{PC}^2),

    Formulas reproduce PySCF integrals to 3e-14.

    Direct check in this session: the S, T, V_C and ERI formulas for unnormalized s Gaussians, times primitive normalizations, reproduce PySCF 2.5.0 int1e_ovlp/int1e_kin/int1e_nuc/int2e to 3e-14; Ho and Hernandez-Perez, Mathematica Journal (2012), Eq. (6) for S

  592. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    and for the repulsion between two such products, with exponents pp and qq and centers PP and QQ, (ab∣cd)=2π5/2pqp+q e−abpRAB2−cdqRCD2 F0 ⁣(pqp+qRPQ2)(ab|cd) = \frac{2\pi^{5/2}}{pq\sqrt{p+q}}\,e^{-\frac{ab}{p}R_{AB}^2 - \frac{cd}{q}R_{CD}^2}\,F_0\!\left(\tfrac{pq}{p+q}R_{PQ}^2\right), each times the primitives' normalizations.

    ERI formula reproduces PySCF int2e to 3e-14.

    Direct check in this session: the S, T, V_C and ERI formulas for unnormalized s Gaussians, times primitive normalizations, reproduce PySCF 2.5.0 int1e_ovlp/int1e_kin/int1e_nuc/int2e to 3e-14

  593. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Restricted Hartree-Fock (RHF) puts both electrons, spin up and spin down, in the same orbital.

    RHF: the ground determinant |sigma sigma-bar> puts both spins in one spatial orbital.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  594. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    For H₂ in this basis that orbital must be σg\sigma_g, so nothing needs iterating, and the energy is ERHF=2hgg+(gg∣gg)+1/RE_\text{RHF} = 2h_{gg} + (gg|gg) + 1/R in molecular-orbital integrals.

    In a minimal basis the only gerade orbital is sigma_g, fixed by symmetry; 2h_gg + (gg|gg) + 1/R is the closed-shell RHF energy.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081; Standard closed-shell energy E = 2h_11 + J_11 (Szabo and Ostlund Sec. 3.8; not accessed) plus 1/R

  595. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Unrestricted Hartree-Fock (UHF) lets the spin-up electron have one orbital and the spin-down electron another.

    UHF allows different spatial orbitals for alpha and beta spins.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  596. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Here they can only be mixtures of σg\sigma_g and σu\sigma_u; the lowest-energy pair has the form cos⁡θ σg±sin⁡θ σu\cos\theta\,\sigma_g \pm \sin\theta\,\sigma_u, which leans the spin-up electron toward one atom and the spin-down electron toward the other.

    Hait et al.: UHF orbitals A = sigma cos(theta) + sigma* sin(theta), B = sigma cos(theta) - sigma* sin(theta), localizing toward opposite atoms.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  597. not-checkable RHF, UHF and full CI for H₂ in STO-3G along the bond

    The program minimizes the energy over θ\theta.

    Describes this program.

  598. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Full configuration interaction (FCI) is the exact answer within the basis: the lowest eigenvalue of the Hamiltonian over every two-electron state the two orbitals allow.

    FCI diagonalizes over all determinants the orbitals allow; Hait et al. list six for minimal-basis H2.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  599. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    It is 1.8% of the total energy and 0.56 eV, the same size as the energy differences chemistry cares about.

    Arithmetic checks; 'same size as chemistry's energy differences' is informal (reaction energies are tenths of an eV to eV).

    NIST CODATA 2022 hartree = 27.211386 eV, https://physics.nist.gov/cgi-bin/cuu/Value?hrev; Arithmetic: 0.02056/1.13728 = 1.81%, 0.02056 x 27.2114 = 0.5595 eV

  600. not-checkable RHF, UHF and full CI for H₂ in STO-3G along the bond

    The reason is in its one orbital.

    Transition.

  601. plausible RHF, UHF and full CI for H₂ in STO-3G along the bond

    σg2\sigma_g^2 written out in the atoms' functions is 12(χ1χ2+χ2χ1)+12(χ1χ1+χ2χ2)\tfrac12(\chi_1\chi_2 + \chi_2\chi_1) + \tfrac12(\chi_1\chi_1 + \chi_2\chi_2): half the time the two electrons are on different atoms, and half the time they are both on one, H⁻ next to a bare proton.

    Hait et al. confirm the ionic terms make up 50% of the RHF wave function at dissociation; the exact coefficient is 1/(2(1+S)), which equals 1/2 only when the overlap S vanishes, as the next sentence assumes.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  602. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Once the atoms' functions stop overlapping, that ionic half costs the repulsion (11∣11)(11|11) of two electrons on one atom and gains the attraction 1/R1/R between H⁻ and the proton, each weighted by one half.

    Consistent with the run: excess at R = 20 equals (11|11)/2 - 1/(2R).

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081; Direct derivation: ionic H-/H+ minus two H atoms = (11|11) - 1/R when overlap vanishes; weighted by 1/2

  603. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    At R=20R = 20 bohr the excess is 0.362300.36230 Ha (excess_20), which is 12(11∣11)−12R\tfrac12(11|11) - \tfrac{1}{2R} to nine digits, and at R=1000R = 1000 it is 0.38680.3868 (excess_limit), on its way to 12(11∣11)=0.3873\tfrac12(11|11) = 0.3873 Ha.

    The numbers are mutually consistent and the 20-bohr value is checked against PySCF by the linked test.

    Szabo and Ostlund Table 3.x STO-3G H2 (11|11) = 0.7746 Ha; not accessed, from general knowledge; Arithmetic: 0.7746/2 = 0.3873; 0.3873 - 1/40 = 0.3623; 0.3873 - 1/2000 = 0.3868

  604. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    RHF describes the separated atoms as half atoms and half ions.

    Hait et al.: spurious ionic contributions make up 50% of the RHF wave function at dissociation.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  605. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    UHF avoids this by letting the spin-up electron sit on one atom and the spin-down electron on the other.

    Hait et al.: the stable UHF ground state at dissociation has one electron localized on each atom.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  606. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Close to equilibrium that costs more than it gains, and UHF's lowest state is the RHF one.

    Below the Coulson-Fischer point the stable HF ground state is the unpolarized |sigma sigma-bar>.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  607. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Past a bond length called the Coulson-Fischer point it pays, and the two curves split.

    The CF point is where the RHF solution becomes unstable and a lower UHF solution appears.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  608. not-checkable RHF, UHF and full CI for H₂ in STO-3G along the bond

    The price is the spin.

    Transition introducing spin contamination.

  609. verified RHF, UHF and full CI for H₂ in STO-3G along the bond

    Full CI stays a pure singlet and goes to the right limit smoothly: it mixes in σu2\sigma_u^2, which cancels the ionic half of σg2\sigma_g^2, a little near equilibrium and half and half at large RR.

    FCI is spin-pure; the ground state mixes the doubly excited sigma_u^2 determinant, which removes the ionic part and gives equal weights at dissociation.

    Hait, Rettig, Head-Gordon, 'Beyond the Coulson-Fischer point', PCCP 2019, arXiv:1908.07081, Sec. on minimal-basis (STO-3G) H2: RHF 50% ionic, UHF orbitals sigma cos(theta) +/- sigma* sin(theta), <S^2> = sin^2(2 theta), https://arxiv.org/abs/1908.07081

  610. verified The Hasegawa-Wakatani drift-wave model

    The Hasegawa-Wakatani equations are the simplest model of drift-wave turbulence at the edge of a tokamak that contains the instability driving it.

    Replaces disputed 45f9a53ebe36.

    'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, abstract: 'a minimal model of beta-plane-like drift-wave turbulence with an intrinsic instability'; Sec. 2: the C -> infinity Hasegawa-Mima limit has no linear instability, https://arxiv.org/abs/2410.01406

  611. verified The Hasegawa-Wakatani drift-wave model

    The edge of a magnetically confined plasma has a steep density gradient, and the gradient drives drift waves: ripples in density and electric potential that travel across the magnetic field, along the surfaces of constant density.

    The equations have kappa = -(1/n0) dn0/dx as drive and the drift wave propagates in y, perpendicular to both B and the gradient, i.e. within constant-density surfaces.

    'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, Sec. 2 (equations, C = adiabaticity, kappa = -(1/n0) dn0/dx, lengths in rho_s, C -> infinity gives Hasegawa-Mima 'without linear instability'), https://arxiv.org/html/2410.01406; Hasegawa and Wakatani, 'Plasma Edge Turbulence', Phys. Rev. Lett. 50, 682 (1983), https://doi.org/10.1103/PhysRevLett.50.682

  612. verified The Hasegawa-Wakatani drift-wave model

    The Hasegawa-Wakatani equations (1983) describe them with two fields in the plane perpendicular to B\mathbf B: the density fluctuation nn and the electric potential ϕ\phi, whose Laplacian ζ=∇2ϕ\zeta = \nabla^2\phi is the vorticity of the E×BE \times B flow.

    HW (PRL 1983) is a two-field model for n and phi; the vorticity is laplacian phi of the E x B flow.

    Hasegawa and Wakatani, 'Plasma Edge Turbulence', Phys. Rev. Lett. 50, 682 (1983), https://doi.org/10.1103/PhysRevLett.50.682; 'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, Sec. 2 (equations, C = adiabaticity, kappa = -(1/n0) dn0/dx, lengths in rho_s, C -> infinity gives Hasegawa-Mima 'without linear instability'), https://arxiv.org/html/2410.01406

  613. verified The Hasegawa-Wakatani drift-wave model

    ∂tζ+[ϕ,ζ]=C(ϕ−n),∂tn+[ϕ,n]=−κ ∂yϕ+C(ϕ−n).\partial_t \zeta + [\phi, \zeta] = C(\phi - n), \qquad \partial_t n + [\phi, n] = -\kappa\,\partial_y\phi + C(\phi - n).

    Matches the standard form with dissipation dropped: dt zeta + [phi,zeta] = C(phi - n), dt n + [phi,n] + kappa dy phi = C(phi - n).

    'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, Sec. 2 (equations, C = adiabaticity, kappa = -(1/n0) dn0/dx, lengths in rho_s, C -> infinity gives Hasegawa-Mima 'without linear instability'), https://arxiv.org/html/2410.01406

  614. verified The Hasegawa-Wakatani drift-wave model

    κ\kappa is the density gradient, the drive.

    kappa = -(1/n0) dn0/dx, the free-energy source driving the instability.

    'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, Sec. 2 (equations, C = adiabaticity, kappa = -(1/n0) dn0/dx, lengths in rho_s, C -> infinity gives Hasegawa-Mima 'without linear instability'), https://arxiv.org/html/2410.01406

  615. verified The Hasegawa-Wakatani drift-wave model

    CC is the adiabaticity: how fast electrons stream along the field line to keep the density in step with the potential.

    C = k_par^2 rho_s B/(e n0 eta_par) is the adiabaticity; C -> infinity gives Boltzmann electrons, n = phi.

    'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, Sec. 2 (equations, C = adiabaticity, kappa = -(1/n0) dn0/dx, lengths in rho_s, C -> infinity gives Hasegawa-Mima 'without linear instability'), https://arxiv.org/html/2410.01406

  616. verified The Hasegawa-Wakatani drift-wave model

    The brackets [ϕ,⋅][\phi, \cdot] are the nonlinear advection; every rung here is linear, so they drop out.

    [phi, A] = (z x grad phi).grad A is the nonlinear E x B advection, quadratic in fluctuations, so it drops from the linearized equations.

    'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, Sec. 2 (equations, C = adiabaticity, kappa = -(1/n0) dn0/dx, lengths in rho_s, C -> infinity gives Hasegawa-Mima 'without linear instability'), https://arxiv.org/html/2410.01406

  617. verified The Hasegawa-Wakatani drift-wave model

    ω=κky1+kx2+ky2.\omega = \frac{\kappa k_y}{1 + k_x^2 + k_y^2}.

    Standard Hasegawa-Mima drift-wave dispersion relation.

    'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, Sec. 2 (equations, C = adiabaticity, kappa = -(1/n0) dn0/dx, lengths in rho_s, C -> infinity gives Hasegawa-Mima 'without linear instability'), https://arxiv.org/html/2410.01406; Direct sympy check in this session: linearizing dt(lap phi - phi) = kappa dy phi gives omega (1 + k^2) = kappa k_y

  618. verified The Hasegawa-Wakatani drift-wave model

    γ≈ωHM2 k2C(1+k2),1−ωωHM≈2 ωHM2 k4C2(1+k2)2.\gamma \approx \frac{\omega_{HM}^2\, k^2}{C(1 + k^2)}, \qquad 1 - \frac{\omega}{\omega_{HM}} \approx \frac{2\,\omega_{HM}^2\, k^4}{C^2 (1 + k^2)^2}.

    Both the growth rate and the relative frequency shift follow from the linear HW system.

    Direct sympy check in this session: linear dispersion omega - i eps omega^2 = omega_HM with eps = k^2/(C(1+k^2)) expands to omega_HM + i eps omega_HM^2 - 2 eps^2 omega_HM^3

  619. verified The Hasegawa-Wakatani drift-wave model

    ζ(t)ζ(0)=k21+k2+e−C(1+1/k2)t1+k2,\frac{\zeta(t)}{\zeta(0)} = \frac{k^2}{1 + k^2} + \frac{e^{-C(1 + 1/k^2)t}}{1 + k^2},

    Solution is correct for unmodified HW; at k = 0.5 the limit is 0.25/1.25 = 0.2.

    'Phase transition from turbulence to zonal flows in the Hasegawa-Wakatani system', arXiv:2410.01406, Sec. 2 (equations, C = adiabaticity, kappa = -(1/n0) dn0/dx, lengths in rho_s, C -> infinity gives Hasegawa-Mima 'without linear instability'), https://arxiv.org/html/2410.01406; Direct sympy check in this session: with k_y = 0, zeta - n is conserved and d zeta/dt = C(1 - zeta(1 + 1/k^2))

  620. verified Jacobi's eigenvalue method

    Jacobi's method diagonalizes a symmetric matrix by plane rotations, each of which zeroes one off-diagonal pair.

    Each Jacobi rotation zeroes one symmetric off-diagonal pair (a_pq, a_qp).

    Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm; J. Lambers, CME 335 Lecture 7 Notes: Jacobi Methods (off(B)^2 = off(A)^2 - 2a_pq^2; Frobenius invariance; |θ| ≤ π/4 minimizes ||B - A||_F; cyclic sweeps; quadratic convergence), https://web.stanford.edu/class/cme335/lecture7.pdf

  621. verified Jacobi's eigenvalue method

    A symmetric matrix AA has an orthogonal matrix of eigenvectors VV with VTAVV^T A V diagonal.

    Spectral theorem for real symmetric matrices, which the Jacobi method constructs.

    J. Lambers, CME 335 Lecture 7 Notes: Jacobi Methods (off(B)^2 = off(A)^2 - 2a_pq^2; Frobenius invariance; |θ| ≤ π/4 minimizes ||B - A||_F; cyclic sweeps; quadratic convergence), https://web.stanford.edu/class/cme335/lecture7.pdf; Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm

  622. verified Jacobi's eigenvalue method

    Jacobi's method (1846) builds VV out of plane rotations.

    Jacobi proposed the method in 1846 (Crelle's Journal 30); V is the product of the plane rotations.

    Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm

  623. verified Jacobi's eigenvalue method

    A later rotation can make an earlier zero nonzero again, so one sweep does not finish the job, but the size of the off-diagonal part, off(A)=(∑i≠jaij2)1/2\mathrm{off}(A) = (\sum_{i \ne j} a_{ij}^2)^{1/2}, falls with every rotation.

    off(B)^2 = off(A)^2 - 2a_pq^2, so off falls with each rotation (strictly when a_pq ≠ 0) even though earlier zeros are refilled.

    J. Lambers, CME 335 Lecture 7 Notes: Jacobi Methods (off(B)^2 = off(A)^2 - 2a_pq^2; Frobenius invariance; |θ| ≤ π/4 minimizes ||B - A||_F; cyclic sweeps; quadratic convergence), https://web.stanford.edu/class/cme335/lecture7.pdf; Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm

  624. not-checkable Jacobi's eigenvalue method

    The reference is numpy: the same sweeps in Python and numpy.linalg.eigh on the same matrix (posts/refs/jacobi-eigenvalue-sweeps.py, output beside it).

    Describes the post's reference script.

  625. verified Jacobi's eigenvalue method

    Rotating the pp and qq rows and columns through θ\theta changes only those two rows and columns.

    J^T A J with a rotation in the (p, q) plane alters only rows and columns p and q.

    Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm

  626. not-checkable Jacobi's eigenvalue method

    The new (p,q)(p, q) entry is

    Lead-in to a formula.

  627. verified Jacobi's eigenvalue method

    apq′=12sin⁡2θ (aqq−app)+cos⁡2θ apq,a'_{pq} = \tfrac12 \sin 2\theta\,(a_{qq} - a_{pp}) + \cos 2\theta\, a_{pq},

    Matches Wikipedia's S'_ij = cos 2θ S_ij + ½ sin 2θ (S_ii - S_jj) up to the sign convention for θ (rotation direction); the post's version is consistent with its own tan 2θ condition.

    Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm

  628. verified Jacobi's eigenvalue method

    which is zero when tan⁡2θ=2apq/(app−aqq)\tan 2\theta = 2 a_{pq} / (a_{pp} - a_{qq}).

    Setting the formula to zero gives tan 2θ = 2a_pq/(a_pp - a_qq) in the post's sign convention.

    Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm

  629. verified Jacobi's eigenvalue method

    atan2 picks the angle with ∣θ∣≤π/4|\theta| \le \pi/4 when app>aqqa_{pp} > a_{qq}, the smaller rotation, which disturbs the rest of the matrix least.

    θ = ½ atan2(2a_pq, a_pp - a_qq) lies in (-π/4, π/4) when a_pp > a_qq; Lambers notes |θ| ≤ π/4 minimizes ||B - A||_F.

    J. Lambers, CME 335 Lecture 7 Notes: Jacobi Methods (off(B)^2 = off(A)^2 - 2a_pq^2; Frobenius invariance; |θ| ≤ π/4 minimizes ||B - A||_F; cyclic sweeps; quadratic convergence), https://web.stanford.edu/class/cme335/lecture7.pdf

  630. verified Jacobi's eigenvalue method

    A rotation leaves the sum of squares of all entries unchanged, and it moves exactly 2apq22 a_{pq}^2 of it from off the diagonal onto it.

    Orthogonal similarity preserves the Frobenius norm and off(B)^2 = off(A)^2 - 2a_pq^2.

    J. Lambers, CME 335 Lecture 7 Notes: Jacobi Methods (off(B)^2 = off(A)^2 - 2a_pq^2; Frobenius invariance; |θ| ≤ π/4 minimizes ||B - A||_F; cyclic sweeps; quadratic convergence), https://web.stanford.edu/class/cme335/lecture7.pdf; Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm

  631. verified Jacobi's eigenvalue method

    That is why off(A)\mathrm{off}(A) can only fall.

    Follows from the preceding identity.

    J. Lambers, CME 335 Lecture 7 Notes: Jacobi Methods (off(B)^2 = off(A)^2 - 2a_pq^2; Frobenius invariance; |θ| ≤ π/4 minimizes ||B - A||_F; cyclic sweeps; quadratic convergence), https://web.stanford.edu/class/cme335/lecture7.pdf

  632. verified Jacobi's eigenvalue method

    A sweep rotates every pair in order, (0,1),(0,2),…,(6,7)(0,1), (0,2), \dots, (6,7): 28 rotations for N=8N = 8.

    Cyclic-by-row order over p < q; 8·7/2 = 28 rotations per sweep.

    J. Lambers, CME 335 Lecture 7 Notes: Jacobi Methods (off(B)^2 = off(A)^2 - 2a_pq^2; Frobenius invariance; |θ| ≤ π/4 minimizes ||B - A||_F; cyclic sweeps; quadratic convergence), https://web.stanford.edu/class/cme335/lecture7.pdf

  633. verified Jacobi's eigenvalue method

    Once it is small next to the gaps between the eigenvalues (here the smallest gap is 0.44), each sweep roughly squares it: 0.02992≈9×10−40.0299^2 \approx 9 \times 10^{-4} and the next value is 3.2×10−53.2 \times 10^{-5}; (3.2×10−5)2≈10−9(3.2 \times 10^{-5})^2 \approx 10^{-9} and the next is 8×10−138 \times 10^{-13}.

    Cyclic Jacobi converges quadratically once off(A) is small relative to the eigenvalue gaps (Schönhage); the reference output shows off-norms 0.0299, 3.18e-5, 8.3e-13, each below the square of the previous, and a smallest gap of 0.4385.

    Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm; J. Lambers, CME 335 Lecture 7 Notes: Jacobi Methods (off(B)^2 = off(A)^2 - 2a_pq^2; Frobenius invariance; |θ| ≤ π/4 minimizes ||B - A||_F; cyclic sweeps; quadratic convergence), https://web.stanford.edu/class/cme335/lecture7.pdf; posts/refs/jacobi-eigenvalue-sweeps.out (reference run output)

  634. plausible Jacobi's eigenvalue method

    The number of correct digits doubles each sweep, as it does for Newton's method, and the fifth sweep hits rounding: under 10−1510^{-15}, about 4.5×10−174.5 \times 10^{-17} times the size of the matrix itself.

    Quadratic convergence is standard; the program measures off(A) after the fifth sweep at 4.48e-17 times the Frobenius norm of A, and tests it.

    Wikipedia, 'Jacobi eigenvalue algorithm' (pointer to Jacobi 1846, Crelle's J. 30; rotated-entry formula, tan 2θ condition, off-norm drops by 2a_pq^2, Schönhage quadratic convergence), https://en.wikipedia.org/wiki/Jacobi_eigenvalue_algorithm; posts/refs/jacobi-eigenvalue-sweeps.out (reference run output)

  635. verified Jacobi's eigenvalue method

    The eigenvalues are checked against numpy.linalg.eigh, which uses a different algorithm (LAPACK's tridiagonal reduction), and the product V diag(λ) VTV\,\mathrm{diag}(\lambda)\,V^T is checked against the matrix we started from.

    eigh calls LAPACK _syevd, which reduces to tridiagonal form and then uses divide and conquer, a different algorithm from Jacobi.

    NumPy docs, numpy.linalg.eigh, Notes: 'computed using LAPACK routines _syevd, _heevd', https://numpy.org/doc/stable/reference/generated/numpy.linalg.eigh.html

  636. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    The five-point stencil turns it into n2n^2 linear equations,

    One five-point equation per interior point gives n^2 equations.

    C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  637. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    4uij−ui−1,j−ui+1,j−ui,j−1−ui,j+1=h2fij,4 u_{ij} - u_{i-1,j} - u_{i+1,j} - u_{i,j-1} - u_{i,j+1} = h^2 f_{ij},

    Standard five-point discretization of -∇²u = f multiplied by h^2.

    C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  638. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    one per grid point, and Au=bA u = b for short.

    One equation per interior grid point, written A u = b.

    C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  639. plausible Jacobi, SOR and conjugate gradients on the Poisson equation

    Direct elimination is possible at this size, but the iterative methods here need only the stencil, so they are what gets used when the grid is large or three-dimensional.

    Iterative methods need only the stencil and dominate for large or 3D grids, though in practice plain Jacobi/SOR are mostly used as multigrid smoothers or replaced by preconditioned CG (Rycroft notes Jacobi is too slow for many problems).

    C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  640. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    The forcing f=2[x(1−x)+y(1−y)]f = 2[x(1 - x) + y(1 - y)] has the exact solution u=x(1−x) y(1−y)u = x(1 - x)\,y(1 - y).

    Checked by symbolic differentiation.

    Direct differentiation (checked with sympy): -∇²[x(1-x)y(1-y)] = 2[x(1-x) + y(1-y)], and u vanishes on the edges of the unit square

  641. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    The second difference of a quadratic is exact, so the grid solution equals uu at every grid point, and whatever error remains is the solver's.

    Truncation error of the five-point stencil involves fourth derivatives in x and y separately, both zero here.

    Direct expansion: the centered second difference of a quadratic in x (or y) is exact; u is quadratic in each variable separately, so the five-point Laplacian of u equals ∇²u at every grid point

  642. not-checkable Jacobi, SOR and conjugate gradients on the Poisson equation

    The Python twin is posts/refs/jacobi-sor-and-cg-on-the-poisson-equation.py (output beside it).

    Describes the post's reference script.

  643. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    A Jacobi sweep solves each equation for its own unknown, using the neighbors' values from the previous sweep: uij←14(ui−1,j+ui+1,j+ui,j−1+ui,j+1+bij)u_{ij} \leftarrow \tfrac14 (u_{i-1,j} + u_{i+1,j} + u_{i,j-1} + u_{i,j+1} + b_{ij}).

    Jacobi update for the five-point system with b = h^2 f.

    C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  644. not-checkable Jacobi, SOR and conjugate gradients on the Poisson equation

    All points update at once, so it is a few whole-array operations.

    Describes the implementation.

  645. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    Its error obeys e←(I−A/4) ee \leftarrow (I - A/4)\, e.

    Jacobi iteration matrix is I - D^{-1}A with D = 4I, so e ← (I - A/4)e.

    C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  646. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    Gauss-Seidel does the same update point by point, in order, and uses each new value as soon as it has it.

    Gauss-Seidel uses updated values as soon as they are computed.

    C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  647. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    SOR (successive over-relaxation) takes the Gauss-Seidel update and goes further in the same direction: $u_{ij} \leftarrow u_{ij} + \omega\,(u^{GS}_{ij}

    SOR extrapolates the Gauss-Seidel correction by ω; over-relaxation means 1 < ω < 2.

    Wikipedia, 'Successive over-relaxation' (Young and Frankel 1950; 0 < ω < 2; ω_opt from the Jacobi spectral radius; ρ_GS = ρ_J^2), https://en.wikipedia.org/wiki/Successive_over-relaxation; C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  648. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    It needs only products with AA.

    CG touches A only through matrix-vector products.

    J. R. Shewchuk, 'An Introduction to the Conjugate Gradient Method Without the Agonizing Pain' (1994), §9.2 Eq. 52 (||e_i||_A ≤ 2((√κ-1)/(√κ+1))^i ||e_0||_A) and §10 (cost dominated by matrix-vector products; iterations ~ ½√κ ln(2/ε)), https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf

  649. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    Its error bound depends on the condition number κ\kappa, the ratio of the largest eigenvalue of AA to the smallest: after kk steps the error, measured in the norm ∥e∥A=eTAe\|e\|_A = \sqrt{e^T A e}, has shrunk by at least 2(κ−1κ+1)k2\left(\frac{\sqrt\kappa - 1}{\sqrt\kappa + 1}\right)^k.

    Standard CG bound in the A-norm with κ = λ_max/λ_min.

    J. R. Shewchuk, 'An Introduction to the Conjugate Gradient Method Without the Agonizing Pain' (1994), §9.2 Eq. 52 (||e_i||_A ≤ 2((√κ-1)/(√κ+1))^i ||e_0||_A) and §10 (cost dominated by matrix-vector products; iterations ~ ½√κ ln(2/ε)), https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf

  650. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    It is a worst case over right-hand sides, and it bounds that error rather than the residual the stopping test measures, so it is a guide to the count, not a prediction of it.

    The bound is on the A-norm of the error, worst case over eigenvalue distributions/starting errors; Shewchuk notes CG usually converges faster than Eq. 52 suggests.

    J. R. Shewchuk, 'An Introduction to the Conjugate Gradient Method Without the Agonizing Pain' (1994), §9.2 Eq. 52 (||e_i||_A ≤ 2((√κ-1)/(√κ+1))^i ||e_0||_A) and §10 (cost dominated by matrix-vector products; iterations ~ ½√κ ln(2/ε)), https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf

  651. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    Like SOR, CG's count grows like κ∝1/h\sqrt\kappa \propto 1/h.

    CG iterations scale as √κ and κ ∝ 1/h^2 for the model problem; optimal SOR needs O(1/h) iterations.

    J. R. Shewchuk, 'An Introduction to the Conjugate Gradient Method Without the Agonizing Pain' (1994), §9.2 Eq. 52 (||e_i||_A ≤ 2((√κ-1)/(√κ+1))^i ||e_0||_A) and §10 (cost dominated by matrix-vector products; iterations ~ ½√κ ln(2/ε)), https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf; C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  652. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    Unlike SOR, it needs no parameter tuned to the matrix.

    CG's step lengths and directions come from the iteration itself; no relaxation parameter is chosen.

    J. R. Shewchuk, 'An Introduction to the Conjugate Gradient Method Without the Agonizing Pain' (1994), §9.2 Eq. 52 (||e_i||_A ≤ 2((√κ-1)/(√κ+1))^i ||e_0||_A) and §10 (cost dominated by matrix-vector products; iterations ~ ½√κ ln(2/ε)), https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf

  653. verified Jacobi, SOR and conjugate gradients on the Poisson equation

    The dashed lines are the theory's rates: (cos⁡πh)k(\cos \pi h)^k for Jacobi and (cos⁡2πh)k(\cos^2 \pi h)^k for Gauss-Seidel.

    cos πh and cos^2 πh are the Jacobi and Gauss-Seidel spectral radii for the model problem, the asymptotic per-sweep rates.

    C. H. Rycroft, 'Iterative methods for linear systems' (Berkeley Math 228A notes, 2007): 2D model problem, eigenvalues 4 - 2cos - 2cos with sine eigenvectors, ρ(R_J) = cos(π/(N+1)), ρ(R_GS) = cos^2, optimal SOR ω, O(N^2) vs O(N) iterations, https://math.berkeley.edu/~wilken/228A.F07/chr_lecture.pdf

  654. not-checkable Jacobi, SOR and conjugate gradients on the Poisson equation

    After the first few sweeps each measured line runs parallel to its dashed one.

    Describes the post's figure.

  655. not-checkable Jacobi, SOR and conjugate gradients on the Poisson equation

    The last cell solves the same problem on 23 by 23 and 31 by 31 grids (h=1/24h = 1/24 and 1/321/32) with Jacobi, SOR and CG, and plots the counts against 1/h1/h on log axes.

    Describes what the program runs.

  656. verified Three floating-point failures in summation, cancellation and RANDU

    Evaluating (x−1)7(x - 1)^7 from its expanded coefficients near x=1x = 1 gives rounding noise: 89 sign changes among 401 points, where the polynomial has one, and 8.5 times the true value at x=1.005x = 1.005.

    Reference output: 89 Horner sign changes in 401 points, Horner 6.66e-16 vs exact 7.81e-17 at x = 1.005 (ratio 8.5); (x-1)^7 has a single odd-order root, so one sign change.

    posts/refs/kahan-summation-horner-noise-and-randus-planes.out (reference run output); N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §5.1 Horner's method: cost 2n flops, Eq. 5.3: |p(x) - q_0| ≤ γ_2n Σ|a_i||x|^i, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  657. verified Three floating-point failures in summation, cancellation and RANDU

    The factored form is within 1.4ε1.4\varepsilon everywhere.

    Reference output gives a largest relative error of 1.385 eps for the factored form, consistent with exact x - 1 plus six rounded multiplications.

    posts/refs/kahan-summation-horner-noise-and-randus-planes.out (reference run output); N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), Theorem 2.5 (Sterbenz): y/2 ≤ x ≤ 2y implies fl(x - y) = x - y, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  658. not-checkable Three floating-point failures in summation, cancellation and RANDU

    Each section computes something in double precision and compares it with an exact answer.

    Describes the post.

  659. verified Three floating-point failures in summation, cancellation and RANDU

    A double has a 53-bit significand, so a sum, product or quotient of two doubles is the exact result times (1+δ)(1 + \delta) with ∣δ∣≤2−53|\delta| \le 2^{-53}.

    IEEE double has t = 53 and u = 2^-53; basic operations satisfy fl(x op y) = (x op y)(1 + δ), |δ| ≤ u (absent overflow/underflow).

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §2.1-2.2: double precision t = 53, u = 2^-53, fl(x op y) = (x op y)(1 + δ), |δ| ≤ u, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  660. verified Three floating-point failures in summation, cancellation and RANDU

    Adding term by term, each addition rounds the running sum, and the rounding errors pile up.

    Recursive summation rounds each partial sum and the error bound grows with n.

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §4.2 recursive summation error, §4.3 Algorithm 4.2 (compensated summation) and Eq. 4.9: |E_n| ≤ (2u + O(nu^2)) Σ|x_i|, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  661. verified Three floating-point failures in summation, cancellation and RANDU

    Once the sum is near 14, a term like 10−610^{-6} keeps only the bits that line up with the sum's last bit, about 30 of its 53.

    Arithmetic check: near 14 the ulp is 2^-49, and 1e-6 ≈ 2^-19.9, so bits 2^-20 down to 2^-49 survive, about 30 of 53.

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §2.1-2.2: double precision t = 53, u = 2^-53, fl(x op y) = (x op y)(1 + δ), |δ| ≤ u, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  662. verified Three floating-point failures in summation, cancellation and RANDU

    Kahan's method (1965) keeps a second variable cc holding what the last addition rounded away, and subtracts it from the next term before adding:

    Kahan, CACM 8(1):40, 1965; the correction variable carries the rounded-away part.

    Wikipedia, 'Kahan summation algorithm' (pseudocode y = x - c, t = sum + y, c = (t - sum) - y, sum = t; Kahan, 'Further remarks on reducing truncation errors', CACM 8(1):40, 1965), https://en.wikipedia.org/wiki/Kahan_summation_algorithm; N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §4.2 recursive summation error, §4.3 Algorithm 4.2 (compensated summation) and Eq. 4.9: |E_n| ≤ (2u + O(nu^2)) Σ|x_i|, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  663. verified Three floating-point failures in summation, cancellation and RANDU

    y=xk−c,t=s+y,c=(t−s)−y,s=t.y = x_k - c, \quad t = s + y, \quad c = (t - s) - y, \quad s = t.

    Matches the standard pseudocode exactly.

    Wikipedia, 'Kahan summation algorithm' (pseudocode y = x - c, t = sum + y, c = (t - sum) - y, sum = t; Kahan, 'Further remarks on reducing truncation errors', CACM 8(1):40, 1965), https://en.wikipedia.org/wiki/Kahan_summation_algorithm

  664. verified Three floating-point failures in summation, cancellation and RANDU

    In floating point, (t−s)(t - s) is the part of yy that made it into tt, and subtracting yy leaves the part that did not, with its sign flipped.

    (t - s) recovers the high part of y that entered t; (t - s) - y is minus the lost low part.

    Wikipedia, 'Kahan summation algorithm' (pseudocode y = x - c, t = sum + y, c = (t - sum) - y, sum = t; Kahan, 'Further remarks on reducing truncation errors', CACM 8(1):40, 1965), https://en.wikipedia.org/wiki/Kahan_summation_algorithm; N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §4.2 recursive summation error, §4.3 Algorithm 4.2 (compensated summation) and Eq. 4.9: |E_n| ≤ (2u + O(nu^2)) Σ|x_i|, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  665. plausible Three floating-point failures in summation, cancellation and RANDU

    The error of the result is at most about 2ε∣s∣2\varepsilon|s|, independent of the number of terms, as long as NεN\varepsilon is small.

    True as an upper bound but twice the standard one: Higham Eq. 4.9 gives (2u + O(nu^2))Σ|x_i| with u = 2^-53, which is about ε|s| with the post's ε = 2^-52 (all terms positive), so 'about ε|s|' would be the accurate statement.

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §4.2 recursive summation error, §4.3 Algorithm 4.2 (compensated summation) and Eq. 4.9: |E_n| ≤ (2u + O(nu^2)) Σ|x_i|, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  666. verified Three floating-point failures in summation, cancellation and RANDU

    Horner's rule evaluates it with seven multiplications and seven additions, ((((((x−7)x+21)x−35)x+35)x−21)x+7)x−1((((((x - 7)x + 21)x - 35)x + 35)x - 21)x + 7)x - 1.

    Horner for degree n costs n multiplications and n additions; the displayed nesting shows six multiplications only because the leading coefficient 1 makes the first product 1·x trivial.

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §5.1 Horner's method: cost 2n flops, Eq. 5.3: |p(x) - q_0| ≤ γ_2n Σ|a_i||x|^i, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf; Wikipedia, 'Horner's method': degree n with n multiplications and n additions, https://en.wikipedia.org/wiki/Horner%27s_method

  667. verified Three floating-point failures in summation, cancellation and RANDU

    Near x=1x = 1 the partial results are 1, −6-6, 15, −20-20, 15, −6-6, 1, while the answer is tiny (10−1410^{-14} at x=1.01x = 1.01).

    Direct computation.

    Arithmetic: at x = 1 the Horner partial sums are 1, -6, 15, -20, 15, -6, 1 (then 0); (0.01)^7 = 1e-14

  668. verified Three floating-point failures in summation, cancellation and RANDU

    Each partial result is rounded, by up to half an ulp of a number near 20, about 2×10−152 \times 10^{-15}, and those errors are as large as the answer.

    ulp(20) = 2^-48 ≈ 3.6e-15, half of it ≈ 1.8e-15; answers near the root are 1e-14 or smaller.

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §2.1-2.2: double precision t = 53, u = 2^-53, fl(x op y) = (x op y)(1 + δ), |δ| ≤ u, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  669. verified Three floating-point failures in summation, cancellation and RANDU

    The rounding bound for Horner's rule (Higham, Accuracy and Stability of Numerical Algorithms, section 5.1) is γ14∑i∣ci∣ ∣x∣i\gamma_{14}\sum_i |c_i|\,|x|^i with γ14=14u/(1−14u)\gamma_{14} = 14u/(1 - 14u) and the unit roundoff u=2−53u = 2^{-53}; here it is about 2×10−132 \times 10^{-13}, and the measured errors reach 2.6%2.6\% of it.

    Replaces disputed 698c1fb84477. Code (horner_bound), reference and test now use u = EPS/2 = 2^-53; bound about 2e-13, errors 2.6% of it.

    Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., Lemma 3.1 and Eq. (5.3): gamma_n = n u / (1 - n u), u = 2^-53 unit roundoff (Table 2.1); posts/refs/kahan-summation-horner-noise-and-randus-planes.out (regenerated): largest ratio to gamma_14 sum|c_i||x|^i is 0.0264; the bound peaks at 2.13e-13 on [0.98, 1.02] (computed)

  670. verified Three floating-point failures in summation, cancellation and RANDU

    The factored form has no such problem.

    Factored form's relative error is at most about 6u (1.385 eps measured).

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), Theorem 2.5 (Sterbenz): y/2 ≤ x ≤ 2y implies fl(x - y) = x - y, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf; posts/refs/kahan-summation-horner-noise-and-randus-planes.out (reference run output)

  671. verified Three floating-point failures in summation, cancellation and RANDU

    For xx between 1/21/2 and 2, x−1x - 1 is computed exactly (Sterbenz's lemma: the difference of two doubles within a factor of 2 of each other is a double), and then six multiplications each add a relative error of at most 2−532^{-53}.

    Sterbenz: y/2 ≤ x ≤ 2y implies x - y exact; each of the six products adds |δ| ≤ 2^-53.

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), Theorem 2.5 (Sterbenz): y/2 ≤ x ≤ 2y implies fl(x - y) = x - y, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf; N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §2.1-2.2: double precision t = 53, u = 2^-53, fl(x op y) = (x op y)(1 + δ), |δ| ≤ u, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  672. verified Three floating-point failures in summation, cancellation and RANDU

    Near the root it has no correct digits.

    Near the root the rounding errors (up to about 5e-15) exceed the true value (7.8e-17 at x = 1.005), and the sign flips 89 times.

    posts/refs/kahan-summation-horner-noise-and-randus-planes.out (reference run output); N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §5.1 Horner's method: cost 2n flops, Eq. 5.3: |p(x) - q_0| ≤ γ_2n Σ|a_i||x|^i, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  673. verified Three floating-point failures in summation, cancellation and RANDU

    Higham's bound on the rounding error of Horner's rule at x, with his unit roundoff u = EPS / 2 = 2^-53.

    Doc comment of horner_bound after the fix.

    Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., Table 2.1 and Lemma 3.1: unit roundoff u = 2^-53 for IEEE double; posts/2026-09-25-kahan-summation-horner-noise-and-randus-planes.viv: EPS = 2^-52

  674. verified Three floating-point failures in summation, cancellation and RANDU

    RANDU was IBM's random number generator in the 1960s: xk+1=65539 xk mod 231x_{k+1} = 65539\,x_k \bmod 2^{31}, with draws uk=xk/231u_k = x_k/2^{31}.

    RANDU: V_{j+1} = 65539 V_j mod 2^31, IBM, 1960s.

    Wikipedia, 'RANDU' (V_{j+1} = 65539 V_j mod 2^31, 65539 = 2^16 + 3, x_{k+2} = 6x_{k+1} - 9x_k, 15 planes, IBM 1960s), https://en.wikipedia.org/wiki/RANDU

  675. verified Three floating-point failures in summation, cancellation and RANDU

    Its multiplier is 216+32^{16} + 3, and squaring it gives 232+6⋅216+92^{32} + 6 \cdot 2^{16} + 9.

    (2^16 + 3)^2 = 2^32 + 6·2^16 + 9.

    Wikipedia, 'RANDU' (V_{j+1} = 65539 V_j mod 2^31, 65539 = 2^16 + 3, x_{k+2} = 6x_{k+1} - 9x_k, 15 planes, IBM 1960s), https://en.wikipedia.org/wiki/RANDU

  676. verified Three floating-point failures in summation, cancellation and RANDU

    xk+2=6xk+1−9xk(mod231).x_{k+2} = 6x_{k+1} - 9x_k \pmod{2^{31}}.

    Wikipedia gives x_{k+2} = 6x_{k+1} - 9x_k (mod 2^31).

    Wikipedia, 'RANDU' (V_{j+1} = 65539 V_j mod 2^31, 65539 = 2^16 + 3, x_{k+2} = 6x_{k+1} - 9x_k, 15 planes, IBM 1960s), https://en.wikipedia.org/wiki/RANDU

  677. verified Three floating-point failures in summation, cancellation and RANDU

    So 9uk−6uk+1+uk+29u_k - 6u_{k+1} + u_{k+2} is always a whole number.

    Dividing the congruence by 2^31 makes 9u_k - 6u_{k+1} + u_{k+2} an integer; it takes values -5..9, 15 planes, as the reference run confirms.

    Wikipedia, 'RANDU' (V_{j+1} = 65539 V_j mod 2^31, 65539 = 2^16 + 3, x_{k+2} = 6x_{k+1} - 9x_k, 15 planes, IBM 1960s), https://en.wikipedia.org/wiki/RANDU; posts/refs/kahan-summation-horner-noise-and-randus-planes.out (reference run output)

  678. verified Three floating-point failures in summation, cancellation and RANDU

    The products here are below 2482^{48}, so double-precision arithmetic computes them, and the remainders, exactly.

    65539·x < 2^17·2^31 = 2^48 < 2^53, so products and remainders are exact integers in double precision.

    N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM 2002), §2.1-2.2: double precision t = 53, u = 2^-53, fl(x op y) = (x op y)(1 + δ), |δ| ≤ u, http://ftp.demec.ufpr.br/CFD/bibliografia/Higham_2002_Accuracy%20and%20Stability%20of%20Numerical%20Algorithms.pdf

  679. verified Three floating-point failures in summation, cancellation and RANDU

    the largest Horner error is 5.49 × 10−15 (against exact rationals in the reference), 2.6% of Higham's bound

    Test name after the fix; asserts worst = 5.4899e-15 and worst_ratio = 0.0264.

    posts/refs/kahan-summation-horner-noise-and-randus-planes.out: 'largest |Horner - exact| 5.4899e-15; largest ratio to gamma_14 sum|c_i||x|^i: 0.0264' (exact rationals, u = 2^-53)

  680. not-checkable Kinetic Monte Carlo against the master equation

    A molecule hops between three states, A to B to C and back, at fixed rates.

    Describes the post's model.

  681. not-checkable Kinetic Monte Carlo against the master equation

    The exact solution in the reference, posts/refs/kinetic-monte-carlo-against-the-master-equation.py, is the matrix exponential p(t)=eWtp(0)p(t) = e^{Wt} p(0) from scipy.linalg.expm.

    Describes the post's reference script.

  682. verified Kinetic Monte Carlo against the master equation

    Many processes are jumps between a few states at known rates: a molecule changing shape, an atom hopping between sites on a surface, a gene switching on and off.

    Surface diffusion is a canonical KMC application and gene expression a canonical Gillespie one; conformational switching fits the same Markov-jump model.

    Wikipedia, 'Kinetic Monte Carlo' (surface diffusion, vacancy diffusion; rejection-free algorithm Δt = ln(1/u)/Q), https://en.wikipedia.org/wiki/Kinetic_Monte_Carlo; Wikipedia, 'Gillespie algorithm' (Gillespie 1976/1977, J. Phys. Chem. 81, 2340; τ = ln(1/r1)/a0; reaction chosen by relative propensity; statistically exact, no time step), https://en.wikipedia.org/wiki/Gillespie_algorithm

  683. verified Kinetic Monte Carlo against the master equation

    A rate ki→jk_{i \to j} means that in a short time dtdt a system in state ii jumps to jj with probability ki→j dtk_{i \to j}\,dt, independently of how long it has already been in ii.

    A rate is probability per unit time in a memoryless (Markov) jump process.

    Wikipedia, 'Master equation' (dP/dt = AP, rates as probability per unit time, gain-loss form, detailed balance), https://en.wikipedia.org/wiki/Master_equation; Wikipedia, 'Gillespie algorithm' (Gillespie 1976/1977, J. Phys. Chem. 81, 2340; τ = ln(1/r1)/a0; reaction chosen by relative propensity; statistically exact, no time step), https://en.wikipedia.org/wiki/Gillespie_algorithm

  684. not-checkable Kinetic Monte Carlo against the master equation

    Here the states are A, B and C in a chain,

    Describes the post's model.

  685. not-checkable Kinetic Monte Carlo against the master equation

    A⇌20.5B⇌10.25C,A \underset{0.5}{\overset{2}{\rightleftharpoons}} B \underset{0.25}{\overset{1}{\rightleftharpoons}} C,

    Defines the post's model rates.

  686. verified Kinetic Monte Carlo against the master equation

    and every molecule starts in A. The probability pi(t)p_i(t) of being in state ii gains from jumps into ii and loses from jumps out of it.

    Gain-loss form of the master equation.

    Wikipedia, 'Master equation' (dP/dt = AP, rates as probability per unit time, gain-loss form, detailed balance), https://en.wikipedia.org/wiki/Master_equation

  687. verified Kinetic Monte Carlo against the master equation

    That balance is the master equation written above, a linear system dp/dt=Wpdp/dt = Wp with a 3 by 3 matrix WW.

    The master equation for a finite state space is the linear system dP/dt = AP.

    Wikipedia, 'Master equation' (dP/dt = AP, rates as probability per unit time, gain-loss form, detailed balance), https://en.wikipedia.org/wiki/Master_equation

  688. verified Kinetic Monte Carlo against the master equation

    The fastest decay rate of WW is 2.82, so a step of 10−310^{-3} makes the method's error at t=1t = 1 between 3×10−143 \times 10^{-14} and 3×10−133 \times 10^{-13}.

    RK4 at h = 1e-3 against scipy expm: 8.5e-14 at t = 1, inside the stated 3e-14 to 3e-13.

    RK4 at h = 1e-3 against scipy.linalg.expm, run in this session: eigenvalues of W are 0, -0.931, -2.819; max error 1.9e-13 near t = 0.4, 8.5e-14 at t = 1; posts/2026-09-25-kinetic-monte-carlo-against-the-master-equation.viv test 'the Runge-Kutta error at t = 1 is between 3e-14 and 3e-13'

  689. verified Kinetic Monte Carlo against the master equation

    The master equation tracks probabilities.

    The master equation evolves the probability vector.

    Wikipedia, 'Master equation' (dP/dt = AP, rates as probability per unit time, gain-loss form, detailed balance), https://en.wikipedia.org/wiki/Master_equation

  690. verified Kinetic Monte Carlo against the master equation

    Kinetic Monte Carlo (KMC) follows one molecule instead, and gets the probabilities by counting many molecules.

    KMC/SSA generates individual trajectories; probabilities come from counting over many.

    Wikipedia, 'Kinetic Monte Carlo' (surface diffusion, vacancy diffusion; rejection-free algorithm Δt = ln(1/u)/Q), https://en.wikipedia.org/wiki/Kinetic_Monte_Carlo; Wikipedia, 'Gillespie algorithm' (Gillespie 1976/1977, J. Phys. Chem. 81, 2340; τ = ln(1/r1)/a0; reaction chosen by relative propensity; statistically exact, no time step), https://en.wikipedia.org/wiki/Gillespie_algorithm

  691. verified Kinetic Monte Carlo against the master equation

    The version here is Gillespie's algorithm (1977).

    Gillespie, J. Phys. Chem. 81, 2340 (1977) (with a 1976 J. Comput. Phys. precursor).

    Wikipedia, 'Gillespie algorithm' (Gillespie 1976/1977, J. Phys. Chem. 81, 2340; τ = ln(1/r1)/a0; reaction chosen by relative propensity; statistically exact, no time step), https://en.wikipedia.org/wiki/Gillespie_algorithm

  692. verified Kinetic Monte Carlo against the master equation

    In state ii the total rate of leaving is a=∑jki→ja = \sum_j k_{i \to j}.

    Total escape rate is the sum of the outgoing rates (a0 or Q_k).

    Wikipedia, 'Gillespie algorithm' (Gillespie 1976/1977, J. Phys. Chem. 81, 2340; τ = ln(1/r1)/a0; reaction chosen by relative propensity; statistically exact, no time step), https://en.wikipedia.org/wiki/Gillespie_algorithm; Wikipedia, 'Kinetic Monte Carlo' (surface diffusion, vacancy diffusion; rejection-free algorithm Δt = ln(1/u)/Q), https://en.wikipedia.org/wiki/Kinetic_Monte_Carlo

  693. verified Kinetic Monte Carlo against the master equation

    Since each jump happens at a constant rate, the waiting time until the next one is exponential with mean 1/a1/a, drawn as −ln⁡(u1)/a-\ln(u_1)/a from a uniform random number u1u_1.

    τ = ln(1/r1)/a0, i.e. -ln(u1)/a, exponential with mean 1/a.

    Wikipedia, 'Gillespie algorithm' (Gillespie 1976/1977, J. Phys. Chem. 81, 2340; τ = ln(1/r1)/a0; reaction chosen by relative propensity; statistically exact, no time step), https://en.wikipedia.org/wiki/Gillespie_algorithm

  694. verified Kinetic Monte Carlo against the master equation

    Which jump it is follows from a second draw: jump to jj with probability ki→j/ak_{i \to j}/a.

    Next event chosen with probability proportional to its rate.

    Wikipedia, 'Gillespie algorithm' (Gillespie 1976/1977, J. Phys. Chem. 81, 2340; τ = ln(1/r1)/a0; reaction chosen by relative propensity; statistically exact, no time step), https://en.wikipedia.org/wiki/Gillespie_algorithm

  695. verified Kinetic Monte Carlo against the master equation

    No time step is chosen, and none of the jumps is approximated.

    The SSA is statistically exact with no predetermined time step.

    Wikipedia, 'Gillespie algorithm' (Gillespie 1976/1977, J. Phys. Chem. 81, 2340; τ = ln(1/r1)/a0; reaction chosen by relative propensity; statistically exact, no time step), https://en.wikipedia.org/wiki/Gillespie_algorithm

  696. verified Kinetic Monte Carlo against the master equation

    The measured first-passage mean, 1.721, is 2.05 standard errors below 1.75; a normal variable lands that far out about one time in 25.

    Numbers check out, including the tail probability.

    Program cell output (www/public/programs/posts/...kinetic-monte-carlo...cells.json): first_mean 1.72129, first_err 0.0140162; (1.75 - 1.72129)/0.0140162 = 2.05; two-sided normal tail P(|Z| > 2.05) = erfc(2.05/√2) = 0.041 ≈ 1/25; posts/refs/kinetic-monte-carlo-against-the-master-equation.out (eigenvalues of W, p(5.0), stationary p, first-passage 1.75)

  697. verified Kinetic Monte Carlo against the master equation

    By t=5t = 5 the slowest part of the approach, which decays as e−0.931te^{-0.931 t} (the smaller nonzero eigenvalue of WW), has not died out, so pCp_C is still 0.011 short of 16/2116/21.

    Reference: eigenvalues -2.819, -0.931, 0; p_C(5) = 0.7511 vs 16/21 = 0.7619, a gap of 0.0108.

    posts/refs/kinetic-monte-carlo-against-the-master-equation.out (eigenvalues of W, p(5.0), stationary p, first-passage 1.75)

  698. verified Kinetic Monte Carlo against the master equation

    the Runge-Kutta error at t = 1 is between 3 × 10−14 and 3 × 10−13

    New test added with the fix of a8d0be44d32f.

    RK4 at h = 1e-3 against scipy.linalg.expm (this session): error 8.5e-14 at t = 1; posts/refs/kinetic-monte-carlo-against-the-master-equation.out (the expm values the test compares with)

  699. verified Lanczos finds the largest eigenvalue three times

    Orthogonalizing each new vector against all the old ones stops it.

    Full reorthogonalization restores orthogonality and removes the spurious copies.

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  700. verified Lanczos finds the largest eigenvalue three times

    Lanczos is for the extreme eigenvalues of a symmetric matrix too big to diagonalize, when all you can do with it is multiply a vector by it.

    Lanczos targets extreme eigenvalues of large symmetric/Hermitian matrices using only matrix-vector products.

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  701. verified Lanczos finds the largest eigenvalue three times

    From one starting vector q0q_0 it builds an orthonormal basis q0,q1,…q_0, q_1, \dots of the Krylov space, the span of q0,Aq0,A2q0,…q_0, A q_0, A^2 q_0, \dots.

    The Lanczos vectors are an orthonormal basis of the Krylov space (in exact arithmetic).

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  702. verified Lanczos finds the largest eigenvalue three times

    In that basis AA is tridiagonal, and each new vector needs only the two before it:

    T = V*AV is tridiagonal and the recurrence is three-term.

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  703. verified Lanczos finds the largest eigenvalue three times

    βjqj+1=Aqj−αjqj−βj−1qj−1.\beta_j q_{j+1} = A q_j - \alpha_j q_j - \beta_{j-1} q_{j-1}.

    Standard Lanczos three-term recurrence.

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  704. verified Lanczos finds the largest eigenvalue three times

    The eigenvalues of the small tridiagonal matrix TT (the α\alpha on its diagonal, the β\beta beside it) are the Ritz values, and the largest and smallest of them converge to the largest and smallest eigenvalues of AA after far fewer steps than AA has rows.

    Ritz values are eigenvalues of T; Kaniel-Paige theory gives fast convergence of the extremes.

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  705. verified Lanczos finds the largest eigenvalue three times

    The three-term formula is where the trouble is.

    Loss of orthogonality stems from the short recurrence in floating point.

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  706. verified Lanczos finds the largest eigenvalue three times

    It makes qj+1q_{j+1} orthogonal to qjq_j and qj−1q_{j-1} by construction, and to every earlier vector only because, in exact arithmetic, those overlaps are zero anyway.

    Global orthogonality in the three-term recurrence holds only in exact arithmetic.

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  707. verified Lanczos finds the largest eigenvalue three times

    In floating point they are not zero, and nothing removes them.

    In floating point orthogonality is lost and the plain recurrence does nothing to restore it.

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  708. not-checkable Lanczos finds the largest eigenvalue three times

    The numpy twin of this program, with the same matrix and starting vector, is posts/refs/lanczos-loses-orthogonality.py; its output is beside it.

    Describes the post's reference script.

  709. not-checkable Lanczos finds the largest eigenvalue three times

    The plain run is the three-term formula above.

    Describes the program.

  710. plausible Lanczos finds the largest eigenvalue three times

    That costs jj extra dot products at step jj, so O(Nk2)O(N k^2) over kk steps where plain Lanczos costs O(Nk)O(N k) beyond the products with AA, and it needs every vector kept in memory.

    Full reorthogonalization adds about j dot products and vector updates at step j, O(Nk^2) total, and needs all k vectors stored (cost figures not accessed; from general knowledge; Wikipedia only says it comes at computational cost).

    Wikipedia, 'Lanczos algorithm' (T = V*AV tridiagonal, three-term recurrence, extreme eigenvalues of large sparse Hermitian matrices via matrix-vector products, loss of orthogonality in floating point, full reorthogonalization remedy, Kaniel-Paige convergence), https://en.wikipedia.org/wiki/Lanczos_algorithm

  711. plausible Lanczos finds the largest eigenvalue three times

    In both runs it first falls, geometrically: AA stretches the uu direction the most, so the Krylov space captures it early, and once it is in the space the new vectors, orthogonal to the space, have nothing left along it.

    Lanczos Ritz values converge fastest at the extreme, well-separated end of the spectrum (SLEPc STR-5 sec. 2.2), so the top eigenvector enters the Krylov space early; the falling component itself is this run's output.

    Hernandez, Roman, Tomas, Vidal, 'Lanczos Methods in SLEPc', SLEPc Technical Report STR-5, sec. 2.2-2.3, https://slepc.upv.es/documentation/reports/str5.pdf; posts/refs/lanczos-loses-orthogonality.out

  712. not-checkable Lanczos finds the largest eigenvalue three times

    From there the two runs split.

    Transition describing this program's two runs.

  713. not-checkable Lanczos finds the largest eigenvalue three times

    With reorthogonalization the component keeps falling to rounding, below 10−1610^{-16}, and stays.

    Program result; tested (every step after the return below 1e-16).

  714. not-checkable Lanczos finds the largest eigenvalue three times

    The component grows back to order one by step 24.

    Describes this run; the reference output has the plain run's component back up at step 24 (0.764).

  715. verified Lanczos finds the largest eigenvalue three times

    The copies are called ghosts.

    Redundant copies of converged Ritz values in finite-precision Lanczos are called ghosts in the literature; SLEPc STR-5 sec. 2.2 describes the multiple copies.

    Barlow, 'Reorthogonalization for the Golub-Kahan-Lanczos bidiagonal reduction' (redundant copies of Ritz values called 'ghosts'), https://www.cse.psu.edu/~b58/lanczos_svd_orthI.pdf; Hernandez, Roman, Tomas, Vidal, 'Lanczos Methods in SLEPc', SLEPc Technical Report STR-5, sec. 2.2-2.3, https://slepc.upv.es/documentation/reports/str5.pdf

  716. not-checkable Lanczos finds the largest eigenvalue three times

    Full reorthogonalization is the fix used here.

    Describes this program's choice.

  717. verified Lanczos finds the largest eigenvalue three times

    It is also the most expensive one; selective reorthogonalization (against converged Ritz vectors only) costs less, and restarted Lanczos, as in ARPACK, keeps full reorthogonalization affordable by keeping the basis short.

    Replaces disputed 342ac965a934. Restarting keeps the basis short so full reorthogonalization stays cheap; it does not replace it.

    ARPACK-NG SRC/dsaitr.f (read): each step computes r_j = OP v_j - V_j w_j by classical Gram-Schmidt against all of V_j, with a DGKS re-orthogonalization step, https://github.com/opencollab/arpack-ng/blob/master/SRC/dsaitr.f; Parlett and Scott, 'The Lanczos algorithm with selective orthogonalization', Math. Comp. 33 (1979) 217-238, doi:10.1090/S0025-5718-1979-0514820-3 (abstract: stifles duplicate eigenvectors without significantly increasing the cost of a step)

  718. verified Landau damping from the root of the dispersion relation

    A Langmuir wave in a collisionless plasma still decays: electrons moving near its phase velocity take energy from it.

    Chen ties the damping to resonant particles with velocity near the phase velocity, with net energy going from the wave to the electrons.

    F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), secs. 7.4-7.5, https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf; Wikipedia, Landau damping (pointer; cites Landau 1946), https://en.wikipedia.org/wiki/Landau_damping

  719. verified Landau damping from the root of the dispersion relation

    The usual small-kk damping formula is 1.3% off there and 59% off at kλD=0.3k\lambda_D = 0.3.

    Formula gives 0.1514 vs exact 0.15336 at 0.5 (-1.3%) and 0.02002 vs 0.012620 at 0.3 (+59%), confirmed by an independent scipy root solve.

    arXiv:1911.08294, 'On the theory of the nonlinear Landau damping' (linear rate gamma = -sqrt(pi/8) k^-3 exp(-1/(2k^2) - 3/2) in units omega_pe = lambda_D = 1), https://arxiv.org/abs/1911.08294; Independent recomputation in this check: scipy.special.wofz + Newton on 1 + (1 + zeta Z)/k^2, roots at k = 0.2, 0.3, 0.5 = 1.06398-5.511e-5i, 1.15985-0.012620i, 1.415662-0.153359i

  720. verified Landau damping from the root of the dispersion relation

    A Langmuir wave is an oscillation of the electrons in a plasma against the ions, at about the plasma frequency ωpe\omega_{pe}.

    Chen sec. 4.3: electrons oscillate about a fixed ion background at the plasma frequency, the ions too massive to respond; sec. 4.4 adds the thermal correction.

    F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), secs. 4.3-4.4, https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf

  721. verified Landau damping from the root of the dispersion relation

    In a plasma with no collisions at all it still decays.

    Chen: 'there is a collisionless damping of plasma waves; this is called Landau damping.'

    F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), secs. 7.4-7.5, https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf; R. Fitzpatrick, Plasma Physics lecture notes, 'Landau Damping', eqs. (7.29) and (7.32), https://farside.ph.utexas.edu/teaching/plasma/lectures1/node90.html

  722. verified Landau damping from the root of the dispersion relation

    Electrons moving a little slower than the wave are pushed forward by it and take energy; electrons moving a little faster are held back and give energy.

    Wikipedia: particles slightly slower than v_ph are accelerated by the wave, slightly faster ones are decelerated and lose energy to it; Chen's sec. 7.5 gives the same picture.

    F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), sec. 7.5, https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf; Wikipedia, Landau damping (pointer; cites Landau 1946), https://en.wikipedia.org/wiki/Landau_damping; R. Fitzpatrick, Plasma Physics, 'Physics of Landau Damping', https://farside.ph.utexas.edu/teaching/plasma/Plasma/node110.html

  723. verified Landau damping from the root of the dispersion relation

    In a Maxwellian distribution the slower ones outnumber the faster ones at any speed above the mean, so the wave loses.

    Chen: 'A Maxwellian distribution, however, has more slow electrons than fast ones ... the wave is damped'; the slope df/dv < 0 above the mean makes this hold at any phase velocity above it.

    F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), sec. 7.5, https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf; R. Fitzpatrick, Plasma Physics, 'Physics of Landau Damping', https://farside.ph.utexas.edu/teaching/plasma/Plasma/node110.html

  724. verified Landau damping from the root of the dispersion relation

    This is Landau damping (Landau, 1946).

    Landau's paper is 1946 (J. Phys. USSR 10, 25; Russian version JETP 16, 574).

    R. Stucchi and P. Lauber, Landau Damping for Non-Maxwellian Distribution Functions, arXiv:2411.06769 (J. Plasma Phys. 2025), sec. 1 and sec. 3.3, https://arxiv.org/abs/2411.06769 (ref. L. Landau, On the vibrations of the electronic plasma, J. Phys. USSR 10, 25 (1946)); Wikipedia, Landau damping (pointer; cites Landau 1946), https://en.wikipedia.org/wiki/Landau_damping

  725. verified Landau damping from the root of the dispersion relation

    The rate comes out of the kinetic dispersion relation.

    Landau's 1946 rate follows from the linearized Vlasov (kinetic) treatment; the damped root of the kinetic dispersion relation gives it.

    Wikipedia, 'Landau damping' (Landau 1946; damping rate from the Vlasov treatment), https://en.wikipedia.org/wiki/Landau_damping; Wikipedia, 'Faddeeva function' / plasma dispersion function Z(z) = i sqrt(pi) w(z) (Fried and Conte 1961), https://en.wikipedia.org/wiki/Plasma_dispersion_function

  726. plausible Landau damping from the root of the dispersion relation

    For a Maxwellian with thermal speed vthv_{th} and Debye length λD\lambda_D, a wave ei(kx−ωt)e^{i(kx - \omega t)} exists when

    Standard Maxwellian Langmuir dielectric with v_th = sqrt(T/m) and lambda_D = v_th/omega_pe; textbook statement (e.g. Stix, Waves in Plasmas ch. 8) not accessed, but an independent solve of this form reproduces the post's root.

    Wikipedia, 'Faddeeva function' / plasma dispersion function Z(z) = i sqrt(pi) w(z) (Fried and Conte 1961), https://en.wikipedia.org/wiki/Plasma_dispersion_function; Independent recomputation in this check: scipy.special.wofz + Newton on 1 + (1 + zeta Z)/k^2, roots at k = 0.2, 0.3, 0.5 = 1.06398-5.511e-5i, 1.15985-0.012620i, 1.415662-0.153359i

  727. plausible Landau damping from the root of the dispersion relation

    ε(ω)=1+1+ζZ(ζ)k2λD2=0,ζ=ω2 kvth,\varepsilon(\omega) = 1 + \frac{1 + \zeta Z(\zeta)}{k^2\lambda_D^2} = 0, \qquad \zeta = \frac{\omega}{\sqrt 2\, k v_{th}},

    Correct form of the electron-wave dielectric function with zeta = omega/(sqrt2 k v_th); textbook page not accessed, but an independent scipy solve reproduces 1.415662 - 0.153359i at k lambda_D = 0.5.

    Wikipedia, 'Faddeeva function' / plasma dispersion function Z(z) = i sqrt(pi) w(z) (Fried and Conte 1961), https://en.wikipedia.org/wiki/Plasma_dispersion_function; Independent recomputation in this check: scipy.special.wofz + Newton on 1 + (1 + zeta Z)/k^2, roots at k = 0.2, 0.3, 0.5 = 1.06398-5.511e-5i, 1.15985-0.012620i, 1.415662-0.153359i

  728. verified Landau damping from the root of the dispersion relation

    where ZZ is the plasma dispersion function.

    Chen defines the plasma dispersion function Z and notes Fried and Conte tabulated it for the Maxwellian case.

    F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), sec. 7.9.1, eq. (7.118); sec. 7.4 (Fried and Conte tables), https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf

  729. verified Landau damping from the root of the dispersion relation

    Its roots are complex, ω=ωr−iγ\omega = \omega_r - i\gamma, and γ\gamma is the damping rate.

    The Stanford notes write omega = omega_p - i gamma so that e^{-i omega t} = e^{-i omega_p t - gamma t}; gamma is the decay rate.

    Stanford Physics 312 (2007), Lecture 12, Plasma waves. Landau damping, pp. 13-14, http://sun.stanford.edu/~sasha/PHYS312/2007/L12/phys312_2007_l12.pdf; F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), sec. 7.4, https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf

  730. not-checkable Landau damping from the root of the dispersion relation

    ZZ comes from lib/zfunc, which computes it by Weideman's rational expansion and is tested there against scipy.special.wofz.

    About this repository's lib/zfunc and its tests; checkable only in the repository.

  731. not-checkable Landau damping from the root of the dispersion relation

    Units: ωpe=λD=vth=1\omega_{pe} = \lambda_D = v_{th} = 1, so kk means kλDk\lambda_D.

    Defines this program's units (consistent, since lambda_D = v_th/omega_pe).

  732. verified Landau damping from the root of the dispersion relation

    A good starting guess is the Bohm-Gross frequency ω=1+3k2\omega = \sqrt{1 + 3k^2}, the fluid-theory answer, on the real axis.

    Chen's kinetic eq. (7.64), omega^2 = omega_p^2 + 3k^2 KT/m, equals the fluid result (4.30); in units omega_pe = lambda_D = 1 it is sqrt(1 + 3k^2), as in Fitzpatrick's eq. (7.29).

    F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), sec. 4.4 eq. (4.30) and sec. 7.4 eq. (7.64), https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf; R. Fitzpatrick, Plasma Physics lecture notes, 'Landau Damping', eqs. (7.29) and (7.32), https://farside.ph.utexas.edu/teaching/plasma/lectures1/node90.html

  733. not-checkable Landau damping from the root of the dispersion relation

    From there Newton's method moves the guess down into the lower half plane.

    Describes this program's Newton iteration; the damped root does lie in the lower half plane (Im omega < 0).

  734. verified Landau damping from the root of the dispersion relation

    The dispersion relation has more than one root.

    Stucchi and Lauber: the dispersion relation 'generally admits more than one root', and for a Maxwellian it 'admits infinite roots' (sec. 3.3).

    R. Stucchi and P. Lauber, Landau Damping for Non-Maxwellian Distribution Functions, arXiv:2411.06769 (J. Plasma Phys. 2025), sec. 1 and sec. 3.3, https://arxiv.org/abs/2411.06769

  735. verified Landau damping from the root of the dispersion relation

    The one found above is the highest, the least damped, and it is the one a wave settles into.

    Stucchi and Lauber, sec. 1: the root with the largest imaginary part 'dominates the long-time behavior'; that the root found is the highest is shown by the run's own root map.

    R. Stucchi and P. Lauber, Landau Damping for Non-Maxwellian Distribution Functions, arXiv:2411.06769 (J. Plasma Phys. 2025), sec. 1 and sec. 3.3, https://arxiv.org/abs/2411.06769

  736. not-checkable Landau damping from the root of the dispersion relation

    Re ω\omega is across and Im ω\omega up.

    Describes the figure's axes.

  737. verified Landau damping from the root of the dispersion relation

    The usual result is

    The small-k Langmuir damping rate sqrt(pi/8) omega_pe (k lambda_D)^-3 exp(-1/(2k^2 lambda_D^2) - 3/2) is the standard result.

    arXiv:1911.08294, 'On the theory of the nonlinear Landau damping' (linear rate gamma = -sqrt(pi/8) k^-3 exp(-1/(2k^2) - 3/2) in units omega_pe = lambda_D = 1), https://arxiv.org/abs/1911.08294

  738. verified Landau damping from the root of the dispersion relation

    γ≈π8 ωpe(kλD)3exp⁡(−12k2λD2−32).\gamma \approx \sqrt{\frac{\pi}{8}}\,\frac{\omega_{pe}}{(k\lambda_D)^3}\exp\left(-\frac{1}{2k^2\lambda_D^2} - \frac32\right).

    Chen's eq. (7.70), with v_th^2 = 2KT/m and 0.22 = e^{-3/2}, is this formula; the e^{-3/2} comes from keeping the Bohm-Gross shift in the exponent. Fitzpatrick's eq. (7.32) gives the same rate without the e^{-3/2} factor.

    F. F. Chen, Introduction to Plasma Physics and Controlled Fusion, 3rd ed. (Springer, 2016), sec. 7.4, eqs. (7.69)-(7.70), https://fenix.tecnico.ulisboa.pt/downloadFile/1970943312531201/2016_Book_IntroductionToPlasmaPhysicsAnd.pdf; R. Fitzpatrick, Plasma Physics lecture notes, 'Landau Damping', eqs. (7.29) and (7.32), https://farside.ph.utexas.edu/teaching/plasma/lectures1/node90.html

  739. verified Landau damping from the root of the dispersion relation

    At 0.50.5 the formula gives 0.15140.1514 against the exact 0.15340.1534, 1.3% low.

    Formula value 0.15139 vs exact 0.153359: 1.29% low, confirmed independently.

    arXiv:1911.08294, 'On the theory of the nonlinear Landau damping' (linear rate gamma = -sqrt(pi/8) k^-3 exp(-1/(2k^2) - 3/2) in units omega_pe = lambda_D = 1), https://arxiv.org/abs/1911.08294; Independent recomputation in this check: scipy.special.wofz + Newton on 1 + (1 + zeta Z)/k^2, roots at k = 0.2, 0.3, 0.5 = 1.06398-5.511e-5i, 1.15985-0.012620i, 1.415662-0.153359i

  740. verified Landau damping from the root of the dispersion relation

    That agreement is an accident of where the error changes sign: at 0.30.3 the formula gives 0.02000.0200 against 0.01260.0126, 59% too high, and at 0.20.2 it is still 18% high.

    Independent check: 0.02002 vs 0.012620 at 0.3 (+58.6%) and 6.51e-5 vs 5.51e-5 at 0.2 (+18.2%); the error is positive at 0.2 and 0.3 and negative at 0.5, so it changes sign in between.

    arXiv:1911.08294, 'On the theory of the nonlinear Landau damping' (linear rate gamma = -sqrt(pi/8) k^-3 exp(-1/(2k^2) - 3/2) in units omega_pe = lambda_D = 1), https://arxiv.org/abs/1911.08294; Independent recomputation in this check: scipy.special.wofz + Newton on 1 + (1 + zeta Z)/k^2, roots at k = 0.2, 0.3, 0.5 = 1.06398-5.511e-5i, 1.15985-0.012620i, 1.415662-0.153359i

  741. verified Landau damping from the root of the dispersion relation

    The real part is above Bohm-Gross by 0.5% at 0.20.2 and by 7% at 0.50.5.

    Replaces disputed c34b6e02075f.

    posts/2026-09-25-landau-damping-from-the-dispersion-relation.viv test: 1.0639843406877026 / 1.0583005244258363 - 1 = 0.537% at k lambda_D = 0.2, 1.4156618886045364 / 1.3228756555322954 - 1 = 7.01% at 0.5

  742. verified Landau damping from the root of the dispersion relation

    the small-k formula gives 0.1514 at k = 0.5 and 0.0200 at k = 0.3

    The small-k Landau formula as the program writes it; the program's values match Python's to 1e-12.

    Recomputed in Python 3 in this session: sqrt(pi/8)/k^3 exp(-1/(2k^2) - 3/2) = 0.151387230212514 at k = 0.5 and 0.020020611312067026 at k = 0.3

  743. verified Make Euler stable on a stiff equation

    A problem is stiff when it contains a rate much faster than the one you want to follow.

    Matches the standard characterization: a fast decaying mode forces explicit methods to tiny steps while the solution varies slowly.

    Wikipedia, 'Stiff equation' (fast vs slow time scales; backward Euler u_{n+1} = u_n + h f(u_{n+1}); A-stability, |1 - h lambda|^-1 <= 1), https://en.wikipedia.org/wiki/Stiff_equation

  744. verified Make Euler stable on a stiff equation

    Backward Euler solves yn+1=yn+hf(yn+1)y_{n+1} = y_n + h f(y_{n+1}) for yn+1y_{n+1}.

    Backward Euler is u_{n+1} = u_n + h f(u_{n+1}), solved for u_{n+1}.

    Wikipedia, 'Stiff equation' (fast vs slow time scales; backward Euler u_{n+1} = u_n + h f(u_{n+1}); A-stability, |1 - h lambda|^-1 <= 1), https://en.wikipedia.org/wiki/Stiff_equation

  745. not-checkable Make Euler stable on a stiff equation

    The second function steps a system y′=Ayy' = Ay whose matrix has eigenvalues −1-1 and −1000-1000.

    Describes this program's matrix; the code's comment gives eigenvalues -1 along (1,1) and -1000 along (1,-1).

  746. not-checkable Make Euler stable on a stiff equation

    The expected numbers come from posts/refs/make-euler-stable-on-a-stiff-equation.py, which runs backward Euler in numpy.

    Describes this post's reference script.

  747. verified Make Gram-Schmidt orthogonal to rounding

    Classical Gram-Schmidt turns them into ten "orthonormal" vectors of which two are at 60 degrees: their dot product is 0.5.

    An independent numpy CGS on these vectors gives a dot product of 0.5 between two output vectors, and arccos(0.5) = 60 degrees.

    Independent recomputation in this check: numpy classical Gram-Schmidt on the 10 Lauchli rows with eps = 1e-8 gives max |Q Q^T - I| = 0.5; kappa = sqrt(10 + eps^2)/eps = 3.16e8; A. Bjorck, 'Gram-Schmidt Orthogonalization: 100 Years and More' (IWMS 2010 slides): MGS loss of orthogonality ~ u kappa(A); Krylov subspace methods; 'twice is enough' proved by Giraud et al. 2005, https://www.cis.upenn.edu/~cis6100/Gram-Schmidt-Bjorck.pdf

  748. verified Make Gram-Schmidt orthogonal to rounding

    Gram-Schmidt builds an orthonormal set one vector at a time: take the next vector, subtract its components along the vectors already made, normalize.

    Standard description of the Gram-Schmidt process.

    Wikipedia, 'Gram-Schmidt process', sec. Numerical stability (CGS vs MGS; Householder more stable; Gram-Schmidt used in Arnoldi iteration), https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process

  749. verified Make Gram-Schmidt orthogonal to rounding

    It is how Krylov methods (Arnoldi, Lanczos) and deflation build their bases, and it fails when the input is close to dependent.

    Gram-Schmidt builds the Arnoldi/Lanczos bases (Wikipedia; Bjorck, Krylov section) and loses orthogonality when the input is ill conditioned.

    Wikipedia, 'Gram-Schmidt process', sec. Numerical stability (CGS vs MGS; Householder more stable; Gram-Schmidt used in Arnoldi iteration), https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process; A. Bjorck, 'Gram-Schmidt Orthogonalization: 100 Years and More' (IWMS 2010 slides): MGS loss of orthogonality ~ u kappa(A); Krylov subspace methods; 'twice is enough' proved by Giraud et al. 2005, https://www.cis.upenn.edu/~cis6100/Gram-Schmidt-Bjorck.pdf

  750. verified Make Gram-Schmidt orthogonal to rounding

    These inputs, the Läuchli vectors, have condition number 3.2×1083.2 \times 10^8: after the subtraction what is left of each vector is of size 10−810^{-8}, and the rounding in the subtracted parts, half a unit in the last place of numbers near 1, is then a relative error of 10−810^{-8} or more.

    For rows e_0 + eps e_{k+1}, n = 10, eps = 1e-8 the singular values are sqrt(10 + eps^2) and eps, so kappa = 3.16e8; rounding of size u on an O(1) subtraction leaving O(1e-8) gives relative error ~1e-8.

    Independent recomputation in this check: numpy classical Gram-Schmidt on the 10 Lauchli rows with eps = 1e-8 gives max |Q Q^T - I| = 0.5; kappa = sqrt(10 + eps^2)/eps = 3.16e8; A. Bjorck, 'Gram-Schmidt Orthogonalization: 100 Years and More' (IWMS 2010 slides): MGS loss of orthogonality ~ u kappa(A); Krylov subspace methods; 'twice is enough' proved by Giraud et al. 2005, https://www.cis.upenn.edu/~cis6100/Gram-Schmidt-Bjorck.pdf

  751. verified Make Gram-Schmidt orthogonal to rounding

    The classical version computes every dot product with the original vector, so the errors of the early projections are never corrected.

    CGS projects the original vector against all previous q; MGS applies projections to the updated intermediate vector, which reduces error.

    Wikipedia, 'Gram-Schmidt process', sec. Numerical stability (CGS vs MGS; Householder more stable; Gram-Schmidt used in Arnoldi iteration), https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process

  752. verified Make Gram-Schmidt orthogonal to rounding

    Running the orthogonalization a second time on the result (the rule known as "twice is enough") gets there, and so does a QR factorization by Householder reflections.

    Two passes of CGS give orthogonality near unit roundoff for numerically full-rank input (Giraud et al. 2005, 'twice is enough'); Householder QR is more stable than Gram-Schmidt.

    Giraud, Langou, Rozloznik, Van den Eshof, 'Rounding error analysis of the classical Gram-Schmidt orthogonalization process', Numer. Math. 101, 87-100 (2005), https://link.springer.com/article/10.1007/s00211-005-0615-4; A. Bjorck, 'Gram-Schmidt Orthogonalization: 100 Years and More' (IWMS 2010 slides): MGS loss of orthogonality ~ u kappa(A); Krylov subspace methods; 'twice is enough' proved by Giraud et al. 2005, https://www.cis.upenn.edu/~cis6100/Gram-Schmidt-Bjorck.pdf; Wikipedia, 'Gram-Schmidt process', sec. Numerical stability (CGS vs MGS; Householder more stable; Gram-Schmidt used in Arnoldi iteration), https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process

  753. not-checkable Make Gram-Schmidt orthogonal to rounding

    The expected vectors come from posts/refs/make-gram-schmidt-orthogonal-to-rounding.py, which runs Gram-Schmidt at 60 digits in mpmath, where rounding does not matter; it also measures the three double-precision versions.

    Describes this post's reference script.

  754. not-checkable Make Numerov find the decaying solution

    Rewrite decaying so that it follows e−xe^{-x} to Numerov's own accuracy, within 2.7×10−52.7 \times 10^{-5}, on both intervals.

    States the exercise's target: the last test's tolerance, 2.7e-5.

  755. verified Make Numerov find the decaying solution

    Numerov's method is the standard way to integrate y′′=f(x) yy'' = f(x)\,y, which is the form of the radial Schrödinger equation.

    Numerov's method integrates y'' = -g(x) y and is the standard tool for the radial Schrodinger equation for u(r).

    Wikipedia, 'Numerov's method' (recurrence for y'' = -g y; local error O(h^6), order 4; radial Schrodinger equation), https://en.wikipedia.org/wiki/Numerov%27s_method

  756. verified Make Numerov find the decaying solution

    For y′′=k2yy'' = k^2 y on a grid of spacing hh it is the three-term recurrence

    Lead-in; Numerov is a three-point (three-term) recurrence.

    Wikipedia, 'Numerov's method' (recurrence for y'' = -g y; local error O(h^6), order 4; radial Schrodinger equation), https://en.wikipedia.org/wiki/Numerov%27s_method

  757. verified Make Numerov find the decaying solution

    (1−h2k212)yi+1=2(1+5h2k212)yi−(1−h2k212)yi−1,\left(1 - \tfrac{h^2 k^2}{12}\right) y_{i+1} = 2\left(1 + \tfrac{5h^2k^2}{12}\right) y_i - \left(1 - \tfrac{h^2 k^2}{12}\right) y_{i-1},

    Setting g = -k^2 in Wikipedia's (1 + h^2 g/12) y_{n+1} = 2(1 - 5h^2 g/12) y_n - (1 + h^2 g/12) y_{n-1} gives exactly this recurrence.

    Wikipedia, 'Numerov's method' (recurrence for y'' = -g y; local error O(h^6), order 4; radial Schrodinger equation), https://en.wikipedia.org/wiki/Numerov%27s_method

  758. verified Make Numerov find the decaying solution

    accurate to fourth order in hh.

    Local error O(h^6), global order 4.

    Wikipedia, 'Numerov's method' (recurrence for y'' = -g y; local error O(h^6), order 4; radial Schrodinger equation), https://en.wikipedia.org/wiki/Numerov%27s_method

  759. verified Make Numerov find the decaying solution

    The equation has two solutions, e−xe^{-x} and exe^{x}, and the recurrence carries both.

    y'' = y has the independent solutions e^{-x} and e^{x}; a second-order linear recurrence has two independent solutions, which approximate both.

    Wikipedia, 'Numerov's method' (recurrence for y'' = -g y; local error O(h^6), order 4; radial Schrodinger equation), https://en.wikipedia.org/wiki/Numerov%27s_method

  760. plausible Make Numerov find the decaying solution

    The two starting values are never exactly on the decaying one (they differ from the recurrence's own decaying solution by its truncation error), so a little of exe^x is always mixed in.

    Not accessed; from general knowledge: the starting values carry truncation error, so the growing solution is excited at that level.

    Wikipedia, 'Numerov's method' (recurrence for y'' = -g y; local error O(h^6), order 4; radial Schrodinger equation), https://en.wikipedia.org/wiki/Numerov%27s_method

  761. verified Make Numerov find the decaying solution

    Going outward, that part grows by e2xe^{2x} relative to the part you want.

    The ratio of the two solutions e^{x}/e^{-x} = e^{2x}.

    Wikipedia, 'Numerov's method' (recurrence for y'' = -g y; local error O(h^6), order 4; radial Schrodinger equation), https://en.wikipedia.org/wiki/Numerov%27s_method

  762. plausible Make Numerov find the decaying solution

    In the region where a bound state's wavefunction decays, every outward integration has this problem.

    Not accessed; from general knowledge (standard advice to integrate inward in the classically forbidden region, e.g. Koonin, Computational Physics ch. 3).

    Wikipedia, 'Numerov's method' (recurrence for y'' = -g y; local error O(h^6), order 4; radial Schrodinger equation), https://en.wikipedia.org/wiki/Numerov%27s_method

  763. not-checkable Make Numerov find the decaying solution

    The tests allow about 1.5 times those.

    Describes this program's tests; the ratios 1.3e-5/8.87e-6, 8e-7/5.58e-7, 2.7e-5/1.84e-5 are 1.43 to 1.47.

  764. verified Make power iteration converge on a tied pair

    Power iteration multiplies a vector by AA again and again and finds the eigenvalue of largest magnitude.

    Power iteration finds the eigenvalue greatest in absolute value, when it is strictly dominant.

    Wikipedia, 'Power iteration' (finds the eigenvalue greatest in absolute value; needs a strictly dominant eigenvalue; Rayleigh quotient gives the eigenvalue), https://en.wikipedia.org/wiki/Power_iteration

  765. verified Make power iteration converge on a tied pair

    With s=1s = 1 those are 3 and −1-1, so the u+u_+ part wins by a factor of 3 per step; with s=−1s = -1 they are 1 and −3-3, and u−u_- wins.

    2 + 1 = 3, -2 + 1 = -1, 2 - 1 = 1, -2 - 1 = -3; the dominant component grows by the eigenvalue ratio (3) per step.

    Wikipedia, 'Power iteration' (finds the eigenvalue greatest in absolute value; needs a strictly dominant eigenvalue; Rayleigh quotient gives the eigenvalue), https://en.wikipedia.org/wiki/Power_iteration

  766. verified Make power iteration converge on a tied pair

    The Rayleigh quotient of the original AA then gives the eigenvalue itself.

    The Rayleigh quotient of A at an eigenvector gives its eigenvalue.

    Wikipedia, 'Power iteration' (finds the eigenvalue greatest in absolute value; needs a strictly dominant eigenvalue; Rayleigh quotient gives the eigenvalue), https://en.wikipedia.org/wiki/Power_iteration

  767. verified Make power iteration converge on a tied pair

    The second matrix, (122−1)\begin{pmatrix} 1 & 2 \\ 2 & -1 \end{pmatrix}, has eigenvalues ±5\pm\sqrt5, again a tie.

    Trace 0 and determinant -5 give eigenvalues +-sqrt5, equal in magnitude.

    Wikipedia, 'Power iteration' (finds the eigenvalue greatest in absolute value; needs a strictly dominant eigenvalue; Rayleigh quotient gives the eigenvalue), https://en.wikipedia.org/wiki/Power_iteration; numpy.linalg.eigvalsh([[1,2],[2,-1]]) = [-2.2360680, 2.2360680] (this check)

  768. verified Make the heat-equation step stable past r = 1/2

    The explicit (FTCS) step for ut=uxxu_t = u_{xx} multiplies the grid's most jagged mode by about 1−4r1 - 4r each step, and for r=0.6r = 0.6 that is −1.4-1.4: a checkerboard that should fade grows to 215 in 16 steps.

    FTCS multiplies mode m by 1 - 4r sin^2(m pi/(2N)), about 1 - 4r for the most jagged mode; 1 - 2.4 = -1.4, beyond the r <= 1/2 limit. The 215 is from the run.

    Wikipedia, 'FTCS scheme' (forward time, centered space; stable for r = alpha dt/dx^2 <= 1/2), https://en.wikipedia.org/wiki/FTCS_scheme

  769. verified Make the heat-equation step stable past r = 1/2

    Rewrite heat_step as backward Euler, which needs a tridiagonal solve per step and damps every mode for every rr.

    Backward Euler on the semi-discrete heat equation is A-stable, so every mode is damped for any r; each step is a tridiagonal solve.

    Wikipedia, 'Stiff equation' (fast vs slow time scales; backward Euler u_{n+1} = u_n + h f(u_{n+1}); A-stability, |1 - h lambda|^-1 <= 1), https://en.wikipedia.org/wiki/Stiff_equation; Wikipedia, 'FTCS scheme' (forward time, centered space; stable for r = alpha dt/dx^2 <= 1/2), https://en.wikipedia.org/wiki/FTCS_scheme

  770. verified Make the heat-equation step stable past r = 1/2

    FTCS stands for forward in time, centered in space: the new value at each point is the old one plus rr times the second difference of its neighbors.

    Standard definition of FTCS.

    Wikipedia, 'FTCS scheme' (forward time, centered space; stable for r = alpha dt/dx^2 <= 1/2), https://en.wikipedia.org/wiki/FTCS_scheme

  771. verified Make the heat-equation step stable past r = 1/2

    It is stable only for r≤1/2r \le 1/2, so halving Δx\Delta x forces a time step four times smaller.

    Stability needs dt <= dx^2/2 (alpha = 1), so halving dx cuts dt by 4.

    Wikipedia, 'FTCS scheme' (forward time, centered space; stable for r = alpha dt/dx^2 <= 1/2), https://en.wikipedia.org/wiki/FTCS_scheme

  772. verified Make the heat-equation step stable past r = 1/2

    Backward Euler takes the second difference at the new time instead,

    Backward Euler evaluates the right-hand side (the second difference) at the new time.

    Wikipedia, 'Stiff equation' (fast vs slow time scales; backward Euler u_{n+1} = u_n + h f(u_{n+1}); A-stability, |1 - h lambda|^-1 <= 1), https://en.wikipedia.org/wiki/Stiff_equation

  773. verified Make the heat-equation step stable past r = 1/2

    uin+1−r (ui−1n+1−2uin+1+ui+1n+1)=uin,u_i^{n+1} - r\,(u_{i-1}^{n+1} - 2u_i^{n+1} + u_{i+1}^{n+1}) = u_i^n,

    Backward Euler u^{n+1} = u^n + r (second difference of u^{n+1}), rearranged.

    Wikipedia, 'Stiff equation' (fast vs slow time scales; backward Euler u_{n+1} = u_n + h f(u_{n+1}); A-stability, |1 - h lambda|^-1 <= 1), https://en.wikipedia.org/wiki/Stiff_equation; Wikipedia, 'FTCS scheme' (forward time, centered space; stable for r = alpha dt/dx^2 <= 1/2), https://en.wikipedia.org/wiki/FTCS_scheme

  774. verified Make the heat-equation step stable past r = 1/2

    a tridiagonal linear system for the new values, with −r-r, 1+2r1 + 2r, −r-r on its three diagonals.

    Collecting terms in the equation gives -r, 1 + 2r, -r on the three diagonals.

    Wikipedia, 'Stiff equation' (fast vs slow time scales; backward Euler u_{n+1} = u_n + h f(u_{n+1}); A-stability, |1 - h lambda|^-1 <= 1), https://en.wikipedia.org/wiki/Stiff_equation

  775. not-checkable Make the heat-equation step stable past r = 1/2

    Viv's tridiag_solve(lower, diagonal, upper, rhs) solves one.

    Describes Viv's library function.

  776. not-checkable Make the heat-equation step stable past r = 1/2

    The other expected numbers come from posts/refs/make-the-heat-equation-step-stable.py, which runs backward Euler with numpy.linalg.solve on the full matrix.

    Describes this post's reference script.

  777. not-checkable Metropolis sampling finds Onsager's magnetization

    The test's tolerance is three standard errors, measured from the run itself by batch means: 20 batches of 60 sweeps each.

    Describes this program's test (20 batches of 60 sweeps, PER_BATCH = 60 in the code); nothing to check against the literature.

  778. not-checkable Metropolis sampling finds Onsager's magnetization

    A separate Metropolis code (posts/refs/metropolis-ising-against-onsager.py, 64 chains of 20000 sweeps) supports that choice three ways.

    Describes this post's reference script.

  779. verified Metropolis sampling finds Onsager's magnetization

    The Ising model is a grid of little magnets, each pointing up (s=+1s = +1) or down (s=−1s = -1).

    Spins s = +-1 on a lattice, standing for magnetic dipoles, is the Ising model.

    Wikipedia, Ising model (pointer), https://en.wikipedia.org/wiki/Ising_model; J. Kotze, Introduction to Monte Carlo methods for an Ising Model of a Ferromagnet, arXiv:0803.0217 (2008), eq. (2) and Fig. 2

  780. verified Metropolis sampling finds Onsager's magnetization

    Each spin interacts with its four neighbors, and the energy of an arrangement is

    Nearest-neighbor coupling on the square lattice: each spin has four neighbors (above, below, left, right).

    J. Kotze, Introduction to Monte Carlo methods for an Ising Model of a Ferromagnet, arXiv:0803.0217 (2008), eq. (2), Figs. 3-4; Wikipedia, Ising model (pointer), https://en.wikipedia.org/wiki/Ising_model

  781. verified Metropolis sampling finds Onsager's magnetization

    E=−J∑⟨ij⟩sisj,E = -J \sum_{\langle ij \rangle} s_i s_j,

    Standard zero-field nearest-neighbor Ising energy.

    Wikipedia, 'Ising model' (H = -J sum_<ij> s_i s_j; Boltzmann weight e^{-beta H}; single-spin-flip Metropolis), https://en.wikipedia.org/wiki/Ising_model

  782. verified Metropolis sampling finds Onsager's magnetization

    summed over neighboring pairs, so two aligned neighbors lower the energy by JJ and two opposed ones raise it by JJ.

    With H = -J sum s_i s_j over nearest neighbors and J > 0, an aligned pair contributes -J and an opposed pair +J.

    Wikipedia, Ising model (pointer), https://en.wikipedia.org/wiki/Ising_model; J. Kotze, Introduction to Monte Carlo methods for an Ising Model of a Ferromagnet, arXiv:0803.0217 (2008), eq. (2) (J > 0 favors parallel alignment)

  783. verified Metropolis sampling finds Onsager's magnetization

    At temperature TT, an arrangement with energy EE occurs with probability proportional to e−E/Te^{-E/T}.

    Configuration probability P(sigma) = e^{-beta H(sigma)}/Z with beta = 1/(k_B T); the post sets k_B = 1.

    Wikipedia, Ising model (pointer), https://en.wikipedia.org/wiki/Ising_model

  784. verified Metropolis sampling finds Onsager's magnetization

    The quantity of interest is the magnetization m=1N∑isim = \frac1N \sum_i s_i, the average spin.

    Magnetization per spin M/N, the average spin, is the standard order parameter.

    J. Kotze, Introduction to Monte Carlo methods for an Ising Model of a Ferromagnet, arXiv:0803.0217 (2008), sec. 2.2, Figs. 9-10 (magnetization per spin M/N)

  785. verified Metropolis sampling finds Onsager's magnetization

    Summing e−E/Te^{-E/T} over all 22562^{256} arrangements of a 16 by 16 grid is impossible, so the program samples arrangements instead.

    16 x 16 = 256 spins with two states each gives 2^256 (about 1.2e77) configurations, far too many to sum.

    Wikipedia, 'Ising model' (H = -J sum_<ij> s_i s_j; Boltzmann weight e^{-beta H}; single-spin-flip Metropolis), https://en.wikipedia.org/wiki/Ising_model

  786. verified Metropolis sampling finds Onsager's magnetization

    Repeating this visits arrangements with exactly the Boltzmann probabilities in the long run.

    Single-spin Metropolis leaves the Boltzmann distribution invariant and is ergodic; the post sweeps spins in order, which satisfies balance rather than detailed balance, and Manousiouthakis and Deem show balance suffices for sequential updating.

    Wikipedia, Ising model (pointer), https://en.wikipedia.org/wiki/Ising_model; V. I. Manousiouthakis and M. W. Deem, Strict detailed balance is unnecessary in Monte Carlo simulation, J. Chem. Phys. 110, 2753 (1999), abstract, https://arxiv.org/abs/cond-mat/9809240

  787. plausible Metropolis sampling finds Onsager's magnetization

    One pass over all 256 spins is a sweep.

    Not accessed; from general knowledge: a sweep is one attempted flip per spin (Newman and Barkema, Monte Carlo Methods in Statistical Physics).

    Wikipedia, 'Ising model' (H = -J sum_<ij> s_i s_j; Boltzmann weight e^{-beta H}; single-spin-flip Metropolis), https://en.wikipedia.org/wiki/Ising_model

  788. not-checkable Metropolis sampling finds Onsager's magnetization

    The edges wrap around (periodic boundaries), so every spin has four neighbors.

    Describes this program's boundary conditions (the mod() in metropolis_sweep); periodic wrapping giving four neighbors is standard (Kotze, arXiv:0803.0217, Figs. 3-4).

  789. verified Metropolis sampling finds Onsager's magnetization

    Lars Onsager solved the two-dimensional Ising model exactly in 1944, and C. N. Yang derived its magnetization in 1952.

    Onsager solved the model in 1944 (Phys. Rev. 65, 117), announced the magnetization without proof in 1949, and Yang published its derivation in Phys. Rev. 85, 808 (1952).

    F. Y. Wu, Professor C. N. Yang and Statistical Mechanics, arXiv:1010.1838, eq. (1) and refs. [10], [11], [14], https://arxiv.org/abs/1010.1838; C. N. Yang, The Spontaneous Magnetization of a Two-Dimensional Ising Model, Phys. Rev. 85, 808 (1952), title page read at http://home.ustc.edu.cn/~weixianhao/ref/cnyang.pdf; Wikipedia, Square lattice Ising model (pointer to Onsager 1944 and Yang 1952), https://en.wikipedia.org/wiki/Square_lattice_Ising_model

  790. not-checkable Metropolis sampling finds Onsager's magnetization

    Below the critical temperature TcT_c,

    Sentence fragment leading into the formula.

  791. verified Metropolis sampling finds Onsager's magnetization

    M(T)=(1−sinh⁡−4(2/T))1/8,M(T) = \left(1 - \sinh^{-4}(2/T)\right)^{1/8},

    Yang's spontaneous magnetization with J = k = 1.

    Wikipedia, 'Square lattice Ising model' (Onsager 1944; Yang 1952: M = [1 - sinh^-4(2 beta J)]^(1/8) below Tc, 0 above; kTc/J = 2/ln(1+sqrt2)), https://en.wikipedia.org/wiki/Square_lattice_Ising_model

  792. verified Metropolis sampling finds Onsager's magnetization

    Close to TcT_c, MM behaves like (Tc−T)1/8(T_c - T)^{1/8}, so it drops to zero almost vertically.

    Wu's eq. (1), Yang's result M = [1 - sinh^{-4}(2K)]^{1/8}, vanishes at T_c with exponent beta = 1/8, so its slope diverges there.

    F. Y. Wu, Professor C. N. Yang and Statistical Mechanics, arXiv:1010.1838, eq. (1) and refs. [10], [11], [14], https://arxiv.org/abs/1010.1838; Wikipedia, Square lattice Ising model (pointer to Onsager 1944 and Yang 1952), https://en.wikipedia.org/wiki/Square_lattice_Ising_model

  793. verified Metropolis sampling finds Onsager's magnetization

    The standard error comes from batch means: average each block of 60 sweeps, and treat the 20 block averages as independent samples.

    Nonoverlapping batch means: batch averages are treated as approximately independent to estimate the Monte Carlo standard error.

    Flegal and Jones, 'Batch means and spectral variance estimators in Markov chain Monte Carlo', Ann. Statist. 38(2), 1034-1070 (2010), arXiv:0811.1729

  794. verified Metropolis sampling finds Onsager's magnetization

    The run gives ∣m∣=0.95669|m| = 0.95669 with a standard error of 0.001300.00130 (m_mc, sigma), and Onsager's value is 0.956860.95686 (m_exact): they differ by 0.000170.00017, about an eighth of one standard error.

    Yang's formula at T = 1.8 gives 0.956857 (computed in this check); 0.956857 - 0.956686 = 0.000171, which is 0.13 standard errors, about an eighth.

    Wikipedia, 'Square lattice Ising model' (Onsager 1944; Yang 1952: M = [1 - sinh^-4(2 beta J)]^(1/8) below Tc, 0 above; kTc/J = 2/ln(1+sqrt2)), https://en.wikipedia.org/wiki/Square_lattice_Ising_model

  795. not-checkable Metropolis sampling finds Onsager's magnetization

    Below TcT_c the points sit on the curve.

    Describes this run's figure.

  796. not-checkable Metropolis sampling finds Onsager's magnetization

    Above it they do not reach zero: at T=3.2T = 3.2 the grid still has ∣m∣≈0.15|m| \approx 0.15 (m_T), and the reference code, running the same short protocol 256 times, averages 0.14650.1465 there.

    Describes this run and the reference output (3.2 0.1465).

  797. verified Metropolis sampling finds Onsager's magnetization

    The reason is the grid's size.

    Kotze attributes the nonzero |M| and the missing sharp transition to the lattice's finite size; the post's 1/sqrt(patches) argument is the central-limit estimate.

    J. Kotze, Introduction to Monte Carlo methods for an Ising Model of a Ferromagnet, arXiv:0803.0217 (2008), sec. 2.2 (Figs. 9-10, absolute magnetization) and sec. 2.4 (finite size scaling)

  798. plausible Metropolis sampling finds Onsager's magnetization

    Above TcT_c the spins form patches of aligned spins that are uncorrelated with each other, and the net spin of 256 spins in a few dozen independent patches is a random sum, whose absolute value is of order one over the square root of the number of patches, not zero.

    Not accessed; from general knowledge: a finite lattice above Tc has |m| of order 1/sqrt(number of correlated regions) by the central limit theorem, going to zero as L grows.

    Wikipedia, 'Square lattice Ising model' (Onsager 1944; Yang 1952: M = [1 - sinh^-4(2 beta J)]^(1/8) below Tc, 0 above; kTc/J = 2/ln(1+sqrt2)), https://en.wikipedia.org/wiki/Square_lattice_Ising_model

  799. verified Metropolis sampling finds Onsager's magnetization

    The same effect rounds off the sharp drop at TcT_c.

    On a finite lattice the divergence at T_c is not seen; the transition is rounded, and only finite-size scaling recovers the infinite-lattice behavior.

    J. Kotze, Introduction to Monte Carlo methods for an Ising Model of a Ferromagnet, arXiv:0803.0217 (2008), sec. 2.4 (finite size scaling)

  800. verified Nuclear level density, by counting the states

    They grow like Bethe's e2aEe^{2\sqrt{aE}}; at E=100E = 100 the count is 4.4% below the leading Hardy-Ramanujan term, and the next term of the series, −0.4433/E-0.4433/\sqrt E, accounts for all but 0.06% of that.

    p(100)/HR(100) = 0.95628, 4.37% below; with c = 0.4433 the corrected estimate misses by 0.00061 (0.06%).

    Wikipedia, 'Partition function (number theory)' (p(100) = 190569292; Hardy-Ramanujan 1918 p(n) ~ exp(pi sqrt(2n/3))/(4 n sqrt3); Euler pentagonal recurrence; Rademacher 1937; parts at most k via Ferrers diagrams), https://en.wikipedia.org/wiki/Partition_function_(number_theory); Independent recomputation in this check (mpmath, 30 digits): p(25) = 1958, p/HR = 0.912704; p(100)/HR = 0.956285; c = sqrt6/(2 pi) + pi/(24 sqrt6) = 0.443288; residual 0.00136 and 0.000614

  801. plausible Nuclear level density, by counting the states

    A heavy nucleus hit by a neutron is left with a few MeV of excitation energy, and at that energy it has an enormous number of states.

    Not accessed; from general knowledge: neutron capture leaves the compound nucleus at the neutron separation energy, typically 5-8 MeV, where s-wave resonance spacings are eV-scale, i.e. very many states.

    Egidy/Bucurescu-type back-shifted Fermi gas fits: a fixed from cumulative low-lying level counts and s-wave resonance spacing D0 at the neutron binding energy, e.g. 'Level-density parameters in the back-shifted Fermi gas model', Phys. At. Nucl., https://link.springer.com/article/10.1134/1.855702

  802. verified Nuclear level density, by counting the states

    How many states lie near a given energy, the level density ρ(E)\rho(E), decides how likely it is to capture the neutron, and what it emits as it cools down.

    In Hauser-Feshbach theory, level densities set the capture cross section and the decay (gamma) cascade.

    Capote et al., 'RIPL - Reference Input Parameter Library', Nucl. Data Sheets 110, 3107 (2009), https://www-nds.iaea.org/RIPL-3/ (level densities as Hauser-Feshbach input; capture cross sections most sensitive to level densities and photon strengths)

  803. verified Nuclear level density, by counting the states

    It enters reaction rates in reactors and in the formation of the heavy elements in stars.

    Level densities are core inputs to reaction-rate evaluations for reactor data and for astrophysical (s- and r-process) rates.

    Capote et al., 'RIPL - Reference Input Parameter Library', Nucl. Data Sheets 110, 3107 (2009), https://www-nds.iaea.org/RIPL-3/ (level densities as Hauser-Feshbach input; capture cross sections most sensitive to level densities and photon strengths)

  804. verified Nuclear level density, by counting the states

    The simplest model that gives the right trend is a Fermi gas: nucleons that do not interact with each other, sitting in single-particle levels.

    Bethe's model treats the nucleons as independent particles in single-particle levels.

    H. A. Bethe, 'An Attempt to Calculate the Number of Energy Levels of a Heavy Nucleus', Phys. Rev. 50, 332 (1936), https://link.aps.org/doi/10.1103/PhysRev.50.332 (abstract: independent particles in a potential, energy a sum of single-particle energies); Guttormsen et al., 'Experimental level densities of atomic nuclei', arXiv:1503.03300 (Bethe's non-interacting Fermi gas; data favor constant temperature at low energy)

  805. not-checkable Nuclear level density, by counting the states

    An excited state is any other choice of NN occupied levels, and its excitation energy EE is its total energy minus the lowest one.

    Defines the model's terms.

  806. not-checkable Nuclear level density, by counting the states

    Listing every choice of 100 levels out of 200 is out of the question, so the program counts with a table: after deciding about levels 00 to kk, entry A[n,x]A[n, x] is the number of ways to have placed nn particles in them with energy xx above the least possible for nn particles, n(n−1)/2n(n-1)/2.

    Describes this program's counting table; the minimum energy for n particles in levels 0, 1, ... is n(n-1)/2.

  807. not-checkable Nuclear level density, by counting the states

    Level kk is either empty, which changes nothing, or holds the nn-th particle, which adds kk to the energy and k−(n−1)k - (n - 1) to xx.

    Describes this program's update; the arithmetic is right (the minimum rises by n - 1 when the n-th particle is added).

  808. not-checkable Nuclear level density, by counting the states

    Going through nn from the top down uses each level at most once.

    Describes this program's loop order (the 0/1-knapsack trick).

  809. not-checkable Nuclear level density, by counting the states

    Energies above EmaxE_\text{max} are never needed, and no level above N−1+EmaxN - 1 + E_\text{max} can be occupied at those energies, so the table is small.

    Describes this program's table bounds; the top particle can rise at most E_max above level N - 1.

  810. not-checkable Nuclear level density, by counting the states

    The first counts can be checked by hand.

    Transition.

  811. verified Nuclear level density, by counting the states

    The reason: number the particles from the top, and let λi\lambda_i be how far the ii-th one moved up.

    Standard bijection between Fermi-sea excitations of equally spaced levels and partitions (Ferrers diagrams).

    Wikipedia, 'Partition function (number theory)' (p(100) = 190569292; Hardy-Ramanujan 1918 p(n) ~ exp(pi sqrt(2n/3))/(4 n sqrt3); Euler pentagonal recurrence; Rademacher 1937; parts at most k via Ferrers diagrams), https://en.wikipedia.org/wiki/Partition_function_(number_theory)

  812. verified Nuclear level density, by counting the states

    So an excited state is a partition of EE into at most NN parts, and for E≤NE \le N the limit on the number of parts never binds.

    The displacements form a partition of E with at most N parts; a partition of E has at most E parts, so the limit never binds when E <= N.

    Wikipedia, 'Partition function (number theory)' (p(100) = 190569292; Hardy-Ramanujan 1918 p(n) ~ exp(pi sqrt(2n/3))/(4 n sqrt3); Euler pentagonal recurrence; Rademacher 1937; parts at most k via Ferrers diagrams), https://en.wikipedia.org/wiki/Partition_function_(number_theory)

  813. verified Nuclear level density, by counting the states

    Hans Bethe worked out in 1936 how a Fermi gas's level density grows: ρ(E)∝e2aE\rho(E) \propto e^{2\sqrt{aE}}, where the level density parameter aa is π2/6\pi^2/6 times the number of single-particle levels per unit energy, which is 1 here.

    Bethe 1936 Fermi-gas density grows as exp(2 sqrt(aE)) with a = pi^2 g/6 (g = single-particle level density); here g = 1.

    H. A. Bethe, 'An Attempt to Calculate the Number of Energy Levels of a Heavy Nucleus', Phys. Rev. 50, 332 (1936), https://link.aps.org/doi/10.1103/PhysRev.50.332 (abstract: independent particles in a potential, energy a sum of single-particle energies)

  814. verified Nuclear level density, by counting the states

    Hardy and Ramanujan had found the growth of the partition numbers in 1918, with the prefactor:

    Hardy and Ramanujan, 1918, with the 1/(4 n sqrt3) prefactor.

    Wikipedia, 'Partition function (number theory)' (p(100) = 190569292; Hardy-Ramanujan 1918 p(n) ~ exp(pi sqrt(2n/3))/(4 n sqrt3); Euler pentagonal recurrence; Rademacher 1937; parts at most k via Ferrers diagrams), https://en.wikipedia.org/wiki/Partition_function_(number_theory)

  815. verified Nuclear level density, by counting the states

    p(E)≈143 E eπ2E/3,p(E) \approx \frac{1}{4\sqrt3\,E}\,e^{\pi\sqrt{2E/3}},

    Hardy-Ramanujan asymptotic formula as stated.

    Wikipedia, 'Partition function (number theory)' (p(100) = 190569292; Hardy-Ramanujan 1918 p(n) ~ exp(pi sqrt(2n/3))/(4 n sqrt3); Euler pentagonal recurrence; Rademacher 1937; parts at most k via Ferrers diagrams), https://en.wikipedia.org/wiki/Partition_function_(number_theory)

  816. verified Nuclear level density, by counting the states

    and π2E/3=2π2E/6\pi\sqrt{2E/3} = 2\sqrt{\pi^2 E/6} is Bethe's exponent with a=π2/6a = \pi^2/6.

    2 sqrt(pi^2 E/6) = pi sqrt(4E/6) = pi sqrt(2E/3).

    Wikipedia, 'Partition function (number theory)' (p(100) = 190569292; Hardy-Ramanujan 1918 p(n) ~ exp(pi sqrt(2n/3))/(4 n sqrt3); Euler pentagonal recurrence; Rademacher 1937; parts at most k via Ferrers diagrams), https://en.wikipedia.org/wiki/Partition_function_(number_theory)

  817. verified Nuclear level density, by counting the states

    The two results are the same count.

    For equally spaced single-species levels, the state count at energy E is p(E), so Bethe's exponent and Hardy-Ramanujan's are the same asymptotics.

    Wikipedia, 'Partition function (number theory)' (p(100) = 190569292; Hardy-Ramanujan 1918 p(n) ~ exp(pi sqrt(2n/3))/(4 n sqrt3); Euler pentagonal recurrence; Rademacher 1937; parts at most k via Ferrers diagrams), https://en.wikipedia.org/wiki/Partition_function_(number_theory); H. A. Bethe, 'An Attempt to Calculate the Number of Energy Levels of a Heavy Nucleus', Phys. Rev. 50, 332 (1936), https://link.aps.org/doi/10.1103/PhysRev.50.332 (abstract: independent particles in a potential, energy a sum of single-particle energies)

  818. verified Nuclear level density, by counting the states

    At E=25E = 25 the count is 8.7% below the leading term and at E=100E = 100 it is 4.4% below (ratio_25, ratio_100): four times the energy, half the gap.

    1 - p/HR = 8.73% at 25 and 4.37% at 100, ratio 2.0, as expected from a leading 1/sqrt(E) correction.

    Independent recomputation in this check (mpmath, 30 digits): p(25) = 1958, p/HR = 0.912704; p(100)/HR = 0.956285; c = sqrt6/(2 pi) + pi/(24 sqrt6) = 0.443288; residual 0.00136 and 0.000614

  819. plausible Nuclear level density, by counting the states

    An experiment measures ρ\rho, not aa, and extracts aa from how fast ln⁡ρ\ln\rho grows with E\sqrt E.

    Simplified: in practice a is fitted to measured densities at two energies (low-lying level counts and the resonance spacing D0 at the neutron binding energy), which amounts to the growth of ln rho with energy.

    Egidy/Bucurescu-type back-shifted Fermi gas fits: a fixed from cumulative low-lying level counts and s-wave resonance spacing D0 at the neutron binding energy, e.g. 'Level-density parameters in the back-shifted Fermi gas model', Phys. At. Nucl., https://link.springer.com/article/10.1134/1.855702; Guttormsen et al., 'Experimental level densities of atomic nuclei', arXiv:1503.03300 (Bethe's non-interacting Fermi gas; data favor constant temperature at low energy)

  820. verified Nuclear level density, by counting the states

    The prefactor 1/E1/E subtracts 2/E2/\sqrt E from it.

    With rho ~ exp(2 sqrt(aE))/E, ln rho has the term -ln E = -2 ln sqrt(E), whose derivative in sqrt(E) is -2/sqrt(E); a = pi^2/6 gives the Hardy-Ramanujan exponent.

    Wikipedia, 'Partition function (number theory)', sec. Approximation formulas: Hardy-Ramanujan p(n) ~ exp(pi*sqrt(2n/3))/(4n*sqrt(3)) (Hardy & Ramanujan, Proc. London Math. Soc. 17, 75 (1918)), https://en.wikipedia.org/wiki/Partition_function_(number_theory)

  821. verified Nuclear level density, by counting the states

    The counts give a slope of 2.3592.359 (slope), not 2.5652.565: taking 2a2\sqrt a from them without the prefactor would put aa at 1.391.39 instead of π2/6=1.645\pi^2/6 = 1.645, 15% low.

    Arithmetic checks: (2.359/2)^2 = 1.391, which is 15.4% below pi^2/6 = 1.645; 2.565 - 2 ln(10/9) = 2.354 matches the stated prediction.

    Wikipedia, 'Partition function (number theory)', sec. Approximation formulas: Hardy-Ramanujan p(n) ~ exp(pi*sqrt(2n/3))/(4n*sqrt(3)) (Hardy & Ramanujan, Proc. London Math. Soc. 17, 75 (1918)), https://en.wikipedia.org/wiki/Partition_function_(number_theory); posts/refs/nuclear-level-density-by-counting.out

  822. verified Nuclear level density, by counting the states

    The prefactor matters at energies this low.

    At sqrt(E) = 9 to 10 the prefactor term -2/sqrt(E) is about -0.21, 8% of the bare slope 2.565, as the sentence says.

    Wikipedia, 'Partition function (number theory)', sec. Approximation formulas: Hardy-Ramanujan p(n) ~ exp(pi*sqrt(2n/3))/(4n*sqrt(3)) (Hardy & Ramanujan, Proc. London Math. Soc. 17, 75 (1918)), https://en.wikipedia.org/wiki/Partition_function_(number_theory)

  823. not-checkable Neutron pairing in a neutron-star crust

    One cell of the neutron-star inner crust in one dimension: a slab of nuclear matter in a gas of free neutrons, with a contact pairing force.

    Describes what the program models.

  824. verified Neutron pairing in a neutron-star crust

    Below the outer crust of a neutron star, nuclei are so neutron-rich that neutrons drip out of them and fill the space between as a gas.

    The review describes neutron drip at the outer/inner crust boundary with a neutron gas between the nuclei.

    N. Chamel and P. Haensel, 'Physics of Neutron Star Crusts', Living Rev. Relativity 11, 10 (2008), arXiv:0812.3955, sec. 2.1 ('A neutron gas is also present at densities greater than neutron drip density ~4e11 g/cm^3') and sec. 3.1 (neutrons 'drip out of nuclei')

  825. verified Neutron pairing in a neutron-star crust

    That gas is expected to be a superfluid: neutrons of opposite spin pair up, as electrons do in a superconductor, and the energy needed to break a pair is twice the pairing gap Δ\Delta.

    Crust neutrons are expected to be superfluid; breaking a pair costs at least 2 Delta (two quasiparticles of energy >= Delta each).

    N. Chamel and P. Haensel, 'Physics of Neutron Star Crusts', Living Rev. Relativity 11, 10 (2008), arXiv:0812.3955, sec. 8.2 (free neutrons in the crust very likely superfluid); Wikipedia, 'BCS theory' (energy gap for single-particle excitation; breaking a pair), https://en.wikipedia.org/wiki/BCS_theory

  826. verified Neutron pairing in a neutron-star crust

    Deeper down, the nuclei are thought to flatten into sheets (the "lasagna" phase).

    Pasta phases, including slab-shaped 'lasagna', are predicted in the deepest layer of the inner crust; spaghetti rods come before the slabs.

    N. Chamel and P. Haensel, 'Physics of Neutron Star Crusts', Living Rev. Relativity 11, 10 (2008), arXiv:0812.3955, sec. 3.3 (sphere -> cylinder -> slab shapes; slabs called 'lasagna') and sec. 7.2 (pasta in the bottom crust layer); Wikipedia, 'Nuclear pasta': inner-crust phases gnocchi, spaghetti, lasagna (sheets), ..., https://en.wikipedia.org/wiki/Nuclear_pasta

  827. not-checkable Neutron pairing in a neutron-star crust

    The method is the Hartree-Fock-Bogoliubov one, cut down to its pairing part.

    Describes this program's method.

  828. not-checkable Neutron pairing in a neutron-star crust

    A neutron's energy in the cell is h=−ℏ22md2dx2+V(x)h = -\frac{\hbar^2}{2m}\frac{d^2}{dx^2} + V(x), with VV a Woods-Saxon well 40 MeV deep and 10 fm wide standing for the slab.

    States this program's model parameters.

  829. verified Neutron pairing in a neutron-star crust

    Pairing mixes a neutron state (uu) with a hole state (vv), which gives the Bogoliubov-de Gennes (BdG) equations above.

    In HFB/BdG the quasiparticle has an upper (particle) and lower (hole) component coupled by the pairing field.

    K. Bennaceur and J. Dobaczewski, 'Coordinate-space solution of the Skyrme-Hartree-Fock-Bogolyubov equations within spherical symmetry. The program HFBRAD (v1.00)', Comput. Phys. Commun. 168, 96 (2005), arXiv:nucl-th/0501002, eqs. (31)-(33)

  830. verified Neutron pairing in a neutron-star crust

    The pairing field Δ(x)\Delta(x) depends on the solutions through the anomalous density κ(x)=−∑E<0u(x)v(x)\kappa(x) = -\sum_{E<0} u(x)v(x), so the equations are solved over and over until Δ\Delta stops changing.

    Same sign convention as HFBRAD's abnormal density; the pairing field depends on it, so the equations are iterated to self-consistency. Signs and which half of the spectrum is summed vary by convention.

    K. Bennaceur and J. Dobaczewski, 'Coordinate-space solution of the Skyrme-Hartree-Fock-Bogolyubov equations within spherical symmetry. The program HFBRAD (v1.00)', Comput. Phys. Commun. 168, 96 (2005), arXiv:nucl-th/0501002, eq. (5): abnormal density rho~ = -sum_i phi1 phi2

  831. verified Neutron pairing in a neutron-star crust

    In one dimension a contact force gives a finite κ\kappa without a cutoff, so no regularization is needed.

    Bulgac and Yu show the anomalous density diverges for a zero-range force in 3D; in 1D the corresponding integral goes as int dk/k^2 at large k and converges, so no cutoff is needed.

    A. Bulgac and Y. Yu, 'Renormalization of the Hartree-Fock-Bogoliubov equations in the case of a zero range pairing interaction', PRL 88, 042504 (2002), arXiv:nucl-th/0106062

  832. not-checkable Neutron pairing in a neutron-star crust

    posts/refs/pairing-in-the-neutron-star-crust.py solves the same cell with numpy (the matrix in block form, not interleaved, and 100 times tighter convergence), and solves the uniform gas from the BCS gap equation without diagonalizing anything.

    Describes the reference script.

  833. verified Neutron pairing in a neutron-star crust

    The kinetic energy is the three-point second difference, so each site couples to its neighbors with τ=ℏ2/(2m Δx2)\tau = \hbar^2/(2m\,\Delta x^2).

    The three-point stencil applied to -hbar^2/(2m) d^2/dx^2 gives off-diagonal -hbar^2/(2m dx^2) and diagonal twice that, so tau = hbar^2/(2m dx^2).

    Wikipedia, 'Finite difference', sec. Higher-order differences: f''(x) ~ [f(x+h) - 2f(x) + f(x-h)]/h^2, https://en.wikipedia.org/wiki/Finite_difference

  834. not-checkable Neutron pairing in a neutron-star crust

    The cell has hard walls at both ends.

    Describes this program's boundary conditions.

  835. verified Neutron pairing in a neutron-star crust

    Every site is then the same, Δ\Delta is uniform, and the BdG equations separate into plane waves of momentum kk, each with quasiparticle energy Ek=ξk2+Δ2E_k = \sqrt{\xi_k^2 + \Delta^2} and ξk=2τ(1−cos⁡kΔx)−μ\xi_k = 2\tau(1 - \cos k\Delta x) - \mu.

    Applying the three-point stencil to e^{ikx} gives 2 tau (1 - cos k dx); with uniform Delta the BdG problem is the BCS one with E_k = sqrt(xi_k^2 + Delta^2).

    D. Ivanov, ETH Zurich lecture notes 'Self-consistency equations for the superconducting gap', sec. 5.4, eqs. (5.4.3)-(5.4.4), https://people.phys.ethz.ch/~ivanov/cmt/1213/ssth-lectureC.pdf; Wikipedia, 'Finite difference', sec. Higher-order differences: f''(x) ~ [f(x+h) - 2f(x) + f(x-h)]/h^2, https://en.wikipedia.org/wiki/Finite_difference

  836. verified Neutron pairing in a neutron-star crust

    The self-consistency condition becomes the BCS gap equation on this lattice,

    With uniform Delta the self-consistency condition Delta = (g/V) sum_k u_k v_k and u_k v_k = Delta/(2E_k) give the BCS gap equation.

    D. Ivanov, ETH Zurich lecture notes 'Self-consistency equations for the superconducting gap', sec. 5.4, eqs. (5.4.3)-(5.4.4), https://people.phys.ethz.ch/~ivanov/cmt/1213/ssth-lectureC.pdf

  837. verified Neutron pairing in a neutron-star crust

    1=gΔx 1N∑k12Ek,1 = \frac{g}{\Delta x}\,\frac{1}{N}\sum_k \frac{1}{2E_k},

    Ivanov eqs. (5.4.3)-(5.4.4) at T = 0 give 1 = (g/V) sum_k 1/(2E_k); here the volume is V = N dx, which matches the post's g/dx * (1/N) sum.

    D. Ivanov, ETH Zurich lecture notes 'Self-consistency equations for the superconducting gap', sec. 5.4, eqs. (5.4.3)-(5.4.4), https://people.phys.ethz.ch/~ivanov/cmt/1213/ssth-lectureC.pdf

  838. not-checkable Neutron pairing in a neutron-star crust

    The gas there is 10 fm wide on each side, bounded by a hard wall and by the slab, not an infinite gas.

    Describes this program's cell geometry (30 fm cell minus a 10 fm slab).

  839. not-checkable Neutron pairing in a neutron-star crust

    The gap there peaks at 1.012 MeV about 4 fm from the wall, falls to zero at the wall, and falls toward the slab.

    Describes this program's output; the 1.012 MeV peak and its position are checked by the program's test.

  840. not-checkable Silicon's band structure, from the crystal up

    The code is a small version of the plane-wave DFT program in dft/ (the dense engine, dft/pwdft.viv), cut into the order the physics goes in.

    Describes this program.

  841. verified Silicon's band structure, from the crystal up

    The whole calculation solves one equation, the Kohn-Sham equation above: each electron moves in the potential of the ions, plus the classical repulsion of the electron density ρ\rho (Hartree), plus an exchange-correlation term for what the classical repulsion misses.

    The Kohn-Sham effective potential is external (ions) + Hartree + exchange-correlation, as described.

    Wikipedia, 'Kohn-Sham equations' (v_eff = v_ext + Hartree + dE_xc/drho; self-consistent solution; total energy E = sum eps_i - E_H + E_xc - int rho v_xc), https://en.wikipedia.org/wiki/Kohn%E2%80%93Sham_equations

  842. verified Silicon's band structure, from the crystal up

    The potential depends on ρ\rho, and ρ\rho is built from the solutions, so it is solved by iteration until the density stops changing.

    The effective potential depends on the density built from the orbitals, so the equations are solved iteratively to self-consistency.

    Wikipedia, 'Kohn-Sham equations' (v_eff = v_ext + Hartree + dE_xc/drho; self-consistent solution; total energy E = sum eps_i - E_H + E_xc - int rho v_xc), https://en.wikipedia.org/wiki/Kohn%E2%80%93Sham_equations

  843. verified Silicon's band structure, from the crystal up

    Silicon has the diamond structure: an fcc lattice with lattice constant a=10.26a = 10.26 bohr (5.43 Å), and two atoms in each primitive cell, at ±a8(1,1,1)\pm\tfrac{a}{8}(1, 1, 1).

    a = 5.4310 A = 10.263 bohr; the diamond structure is fcc with two atoms per primitive cell a/4(1,1,1) apart, equivalent to +-a/8(1,1,1).

    NIST CODATA 2022, lattice parameter of silicon a = 5.431020511e-10 m, https://physics.nist.gov/cgi-bin/cuu/Value?asil; Wikipedia, 'Diamond cubic': fcc lattice with two atoms per primitive cell separated by 1/4 of the cube edge in each direction, https://en.wikipedia.org/wiki/Diamond_cubic

  844. verified Silicon's band structure, from the crystal up

    The rows of B are the reciprocal vectors, defined by bi⋅aj=2π δij\mathbf b_i \cdot \mathbf a_j = 2\pi\,\delta_{ij}.

    This is the standard definition of reciprocal lattice vectors.

    Wikipedia, 'Reciprocal lattice': a_i . b_j = 2 pi delta_ij; lattice-periodic functions are Fourier series over G = m1 b1 + m2 b2 + m3 b3, https://en.wikipedia.org/wiki/Reciprocal_lattice

  845. verified Silicon's band structure, from the crystal up

    Every function with the period of the crystal is a sum of plane waves eiG⋅re^{i\mathbf G\cdot\mathbf r} with G=m1b1+m2b2+m3b3\mathbf G = m_1 \mathbf b_1 + m_2 \mathbf b_2 + m_3 \mathbf b_3 for integers mim_i.

    Lattice-periodic functions expand in plane waves with G = m1 b1 + m2 b2 + m3 b3.

    Wikipedia, 'Reciprocal lattice': a_i . b_j = 2 pi delta_ij; lattice-periodic functions are Fourier series over G = m1 b1 + m2 b2 + m3 b3, https://en.wikipedia.org/wiki/Reciprocal_lattice

  846. verified Silicon's band structure, from the crystal up

    That is the reason to work with plane waves: the potential, the density and the periodic part of every orbital are Fourier series on this lattice.

    The potential and density are lattice-periodic, and Bloch's theorem makes the orbital's u(r) periodic, so all are Fourier series over G.

    Wikipedia, 'Reciprocal lattice': a_i . b_j = 2 pi delta_ij; lattice-periodic functions are Fourier series over G = m1 b1 + m2 b2 + m3 b3, https://en.wikipedia.org/wiki/Reciprocal_lattice; Wikipedia, 'Bloch's theorem': psi = e^{ik.r} u(r) with u lattice-periodic; each k gives bands eps_n(k), https://en.wikipedia.org/wiki/Bloch%27s_theorem

  847. not-checkable Silicon's band structure, from the crystal up

    The next cell describes one silicon ion to the valence electrons.

    Transition to the next cell.

  848. verified Silicon's band structure, from the crystal up

    A silicon atom has 14 electrons; the 10 core electrons stay put when atoms bond, so they are replaced, together with the nucleus, by a pseudopotential acting on the 4 valence electrons.

    Si has Z = 14 with configuration [Ne]3s2 3p2, so 10 core and 4 valence electrons; the GTH Si potential is the q4 (Z_ion = 4) one.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), introduction (eliminating core electrons); CP2K data, GTH_POTENTIALS, entry 'Si GTH-PADE-q4' (r_loc 0.44, C1 -7.33610297; s: r 0.42273813, h 5.90692831 -1.26189397 3.25819622; p: r 0.48427842, h 2.72701346), https://github.com/cp2k/cp2k-data/blob/master/potentials/Goedecker/cp2k/GTH_POTENTIALS

  849. verified Silicon's band structure, from the crystal up

    The parameters are the Goedecker-Teter-Hutter ones for silicon, copied from CP2K's table by dft/pseudo/make_pseudo.py.

    The r_loc, C1, HS, RP and HP values in the post's code match CP2K's 'Si GTH-PADE-q4' entry digit for digit.

    CP2K data, GTH_POTENTIALS, entry 'Si GTH-PADE-q4' (r_loc 0.44, C1 -7.33610297; s: r 0.42273813, h 5.90692831 -1.26189397 3.25819622; p: r 0.48427842, h 2.72701346), https://github.com/cp2k/cp2k-data/blob/master/potentials/Goedecker/cp2k/GTH_POTENTIALS

  850. verified Silicon's band structure, from the crystal up

    Its local part is a function of ∣G∣|\mathbf G| only.

    GTH's V_loc(K) depends only on K = |K|, since the local part is spherically symmetric.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), eq. (5)

  851. verified Silicon's band structure, from the crystal up

    Expect it to be negative (attractive) and to vanish at large ∣G∣|\mathbf G|, since the ion looks smooth to the valence electrons.

    For Si, C1 = -7.336 < 0, so both terms of V_loc(g) are negative, and both carry the Gaussian e^{-(g r_loc)^2/2}, which vanishes at large g.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), eq. (5); CP2K data, GTH_POTENTIALS, entry 'Si GTH-PADE-q4' (r_loc 0.44, C1 -7.33610297; s: r 0.42273813, h 5.90692831 -1.26189397 3.25819622; p: r 0.48427842, h 2.72701346), https://github.com/cp2k/cp2k-data/blob/master/potentials/Goedecker/cp2k/GTH_POTENTIALS

  852. verified Silicon's band structure, from the crystal up

    The local part is the same for every electron.

    The local part is a single radial function applied to every electron, while the nonlocal part acts through l-dependent separable projectors.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), eqs. (1)-(3)

  853. not-checkable Silicon's band structure, from the crystal up

    The next cell defines them and evaluates each at three values of ∣k+G∣|\mathbf k + \mathbf G|.

    Describes the next cell.

  854. verified Silicon's band structure, from the crystal up

    The pp projector starts at zero and grows with ∣k+G∣|\mathbf k + \mathbf G|: a plane wave with small ∣k+G∣|\mathbf k + \mathbf G| is nearly constant across the ion, and a constant has no pp (l=1l = 1) component.

    Replaces disputed a9d8aace9ad7: the zero is from angular momentum (j_1(0) = 0), not from the projector vanishing at the center.

    Goedecker, Teter and Hutter, PRB 54, 1703 (1996), eqs. 10-12: the l = 1 projector's transform carries j_1(K r), p_p1(K) ~ K exp(-(K r_p)^2/2); Direct check in this session: the l = 1 transform of r exp(-r^2/2) is 0 at K = 0 and grows like K, while the second s projector (r^2 exp(-r^2/2), zero at the center) transforms to 3.76 at K = 0

  855. verified Silicon's band structure, from the crystal up

    An electron in a crystal is a Bloch wave, eik⋅re^{i\mathbf k\cdot\mathbf r} times a periodic function, and each wave vector k\mathbf k in the Brillouin zone gives its own set of energy bands.

    This is Bloch's theorem and the resulting band structure eps_n(k).

    Wikipedia, 'Bloch's theorem': psi = e^{ik.r} u(r) with u lattice-periodic; each k gives bands eps_n(k), https://en.wikipedia.org/wiki/Bloch%27s_theorem

  856. verified Silicon's band structure, from the crystal up

    The density averages over k\mathbf k, and that average is replaced by a sum over a few points.

    The density is an average over the Brillouin zone, which plane-wave codes replace by a weighted sum over special (Monkhorst-Pack) k-points.

    ABINIT documentation, input variable shiftk, item 2: for an FCC lattice the usual Monkhorst-Pack sampling uses nshiftk 4 with shifts (0.5 0.5 0.5), (0.5 0 0), (0 0.5 0), (0 0 0.5), https://docs.abinit.org/variables/basic/#shiftk

  857. verified Silicon's band structure, from the crystal up

    It is a four-shift mesh: its points are closed under the crystal's rotations, so the density comes out with the crystal's symmetry without any explicit symmetrization.

    ABINIT's usual FCC Monkhorst-Pack sampling uses exactly these four shifts; they are the four inequivalent L points, which the cubic point group permutes (up to reciprocal lattice vectors), so the sampled density keeps the crystal symmetry.

    ABINIT documentation, input variable shiftk, item 2: for an FCC lattice the usual Monkhorst-Pack sampling uses nshiftk 4 with shifts (0.5 0.5 0.5), (0.5 0 0), (0 0.5 0), (0 0 0.5), https://docs.abinit.org/variables/basic/#shiftk; Wikipedia, 'Brillouin zone', FCC critical points: L = center of a hexagonal face, X = center of a square face, https://en.wikipedia.org/wiki/Brillouin_zone

  858. verified Silicon's band structure, from the crystal up

    The basis at one k\mathbf k is every plane wave whose kinetic energy 12∣k+G∣2\tfrac12|\mathbf k + \mathbf G|^2 is at most the cutoff.

    The plane-wave basis is all k+G with kinetic energy below the cutoff; this is the standard definition.

    N. D. Woods, M. C. Payne, P. J. Hasnip, 'Computing the self-consistent field in Kohn-Sham density functional theory', J. Phys.: Condens. Matter 31, 453001 (2019), arXiv:1905.02332, sec. IV (linear mixing converges q-linearly; Pulay/Anderson accelerates it), sec. III (plane-wave basis set); S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA)

  859. verified Silicon's band structure, from the crystal up

    The cutoff is the basis's one tunable parameter (the k-point mesh is the other convergence setting): raising it adds shorter waves and lowers the energy.

    Replaces disputed 74a01a5add4f.

    posts/2026-09-25-silicon-bands-from-the-crystal-up.viv: NKMESH is a tunable mesh setting, and the post later says the 10 Ha / 16 k-point comparison 'mixes the cutoff and the k-points'

  860. not-checkable Silicon's band structure, from the crystal up

    plane_waves loops over a box of integer triples mm large enough to hold every G\mathbf G that can pass, and keeps the ones that do.

    Describes this program's function.

  861. not-checkable Silicon's band structure, from the crystal up

    The cell above only defines things.

    Describes this program.

  862. not-checkable Silicon's band structure, from the crystal up

    The next one counts, sizes the arrays (one slot per k-point, and one spare slot for the band path), and fills each k-point's slot.

    Describes this program.

  863. not-checkable Silicon's band structure, from the crystal up

    On that grid the cell tabulates 1/∣G∣21/|\mathbf G|^2 (for the Hartree term later) and the ions' potential.

    Describes what this cell tabulates.

  864. verified Silicon's band structure, from the crystal up

    Each atom contributes its local pseudopotential times a phase e−iG⋅τe^{-i\mathbf G\cdot\boldsymbol\tau}, the structure factor, which says where in the cell the atom sits.

    An atom at tau contributes its form factor times exp(-i G . tau), the structure-factor phase.

    Wikipedia, 'Structure factor' (F = sum_j f_j exp(-i q . R_j), phase set by atomic position in the cell), https://en.wikipedia.org/wiki/Structure_factor

  865. verified Silicon's band structure, from the crystal up

    Two electrons repel, so each keeps the others at a distance, and electrons of the same spin are kept apart further by the Pauli principle.

    Coulomb repulsion keeps all electrons apart (correlation), and same-spin electrons are further kept apart by the exchange hole required by the Pauli principle.

    Wikipedia, 'Exchange interaction': exchange hole around an electron that same-spin electrons avoid by the Pauli principle, https://en.wikipedia.org/wiki/Exchange_interaction

  866. verified Silicon's band structure, from the crystal up

    The Hartree term treats the density as a smooth charge cloud and misses both.

    The Hartree term is the classical Coulomb energy of the density; exchange and correlation are the separate E_xc term.

    Wikipedia, 'Kohn-Sham equations' (v_eff = v_ext + Hartree + dE_xc/drho; self-consistent solution; total energy E = sum eps_i - E_H + E_xc - int rho v_xc), https://en.wikipedia.org/wiki/Kohn%E2%80%93Sham_equations

  867. verified Silicon's band structure, from the crystal up

    The local density approximation (LDA) adds, at each point, the exchange-correlation energy per electron εxc(ρ)\varepsilon_{xc}(\rho) of a uniform electron gas with the density found there.

    The LDA uses at each point the xc energy per particle of the homogeneous electron gas with the local density.

    Wikipedia, 'Local-density approximation': E_xc = int rho eps_xc(rho), eps_xc of the homogeneous electron gas; r_s = radius of a sphere holding one electron, https://en.wikipedia.org/wiki/Local-density_approximation

  868. verified Silicon's band structure, from the crystal up

    The cell uses the Teter-93 Padé fit, a ratio of two polynomials in the Wigner-Seitz radius rs=(3/4πρ)1/3r_s = (3/4\pi\rho)^{1/3}, the radius of a sphere that holds one electron.

    The Pade form is a ratio of polynomials in r_s, and r_s is the radius of a sphere holding one electron.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), Appendix: eps_xc = -(a0 + a1 rs + a2 rs^2 + a3 rs^3)/(b1 rs + b2 rs^2 + b3 rs^3 + b4 rs^4); Wikipedia, 'Local-density approximation': E_xc = int rho eps_xc(rho), eps_xc of the homogeneous electron gas; r_s = radius of a sphere holding one electron, https://en.wikipedia.org/wiki/Local-density_approximation

  869. verified Silicon's band structure, from the crystal up

    It is the functional the pseudopotential was fitted with.

    The GTH LDA potentials were fitted with this Pade parameterization; CP2K labels the Si one GTH-PADE.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), section 'The parameters' (LDA parameters built with the Appendix's Pade parameterization); CP2K data, GTH_POTENTIALS, entry 'Si GTH-PADE-q4' (r_loc 0.44, C1 -7.33610297; s: r 0.42273813, h 5.90692831 -1.26189397 3.25819622; p: r 0.48427842, h 2.72701346), https://github.com/cp2k/cp2k-data/blob/master/potentials/Goedecker/cp2k/GTH_POTENTIALS

  870. verified Silicon's band structure, from the crystal up

    The potential is the derivative, vxc=d(ρ εxc)/dρ=εxc−rs3 dεxc/drsv_{xc} = d(\rho\,\varepsilon_{xc})/d\rho = \varepsilon_{xc} - \tfrac{r_s}{3}\, d\varepsilon_{xc}/dr_s.

    v_xc = d(rho eps_xc)/drho; with rho ~ r_s^-3, dr_s/drho = -r_s/(3 rho), which gives eps_xc - (r_s/3) d eps_xc/dr_s.

    Wikipedia, 'Kohn-Sham equations' (v_eff = v_ext + Hartree + dE_xc/drho; self-consistent solution; total energy E = sum eps_i - E_H + E_xc - int rho v_xc), https://en.wikipedia.org/wiki/Kohn%E2%80%93Sham_equations; Wikipedia, 'Local-density approximation': E_xc = int rho eps_xc(rho), eps_xc of the homogeneous electron gas; r_s = radius of a sphere holding one electron, https://en.wikipedia.org/wiki/Local-density_approximation

  871. not-checkable Silicon's band structure, from the crystal up

    In the plane-wave basis at k\mathbf k, the Hamiltonian is a matrix with one row per plane wave:

    Introduces a formula.

  872. verified Silicon's band structure, from the crystal up

    HGG′=12∣k+G∣2 δGG′+V(G−G′)+Vnl(G,G′).H_{\mathbf G\mathbf G'} = \tfrac12|\mathbf k + \mathbf G|^2\,\delta_{\mathbf G\mathbf G'} + V(\mathbf G - \mathbf G') + V_\text{nl}(\mathbf G, \mathbf G').

    Kinetic energy diagonal in k+G, local potential through V(G-G'), nonlocal separable term: the standard plane-wave Hamiltonian.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), eqs. (5)-(8) (plane-wave matrix elements of the local and nonlocal parts)

  873. verified Silicon's band structure, from the crystal up

    The kinetic energy is diagonal.

    A plane wave e^{i(k+G).r} is an eigenfunction of the kinetic operator with eigenvalue |k+G|^2/2, so that term is diagonal.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA)

  874. verified Silicon's band structure, from the crystal up

    The nonlocal part is a sum over projectors, Vnl=∑IJ∣βI⟩DIJ⟨βJ∣V_\text{nl} = \sum_{IJ} |\beta_I\rangle D_{IJ} \langle\beta_J|, where each βI\beta_I is one projector of one atom times an angular factor (a real spherical harmonic of the direction of k+G\mathbf k + \mathbf G) times the atom's structure factor.

    GTH's nonlocal part is sum Y_lm(K^) p_i(K) h_ij p_j(K') Y*_lm(K^'), a sum of projector outer products; each atom's copy carries its structure-factor phase. Real spherical harmonics are an equivalent choice.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), eqs. (6)-(8); Wikipedia, 'Structure factor' (F = sum_j f_j exp(-i q . R_j), phase set by atomic position in the cell), https://en.wikipedia.org/wiki/Structure_factor

  875. verified Silicon's band structure, from the crystal up

    Five per atom: two ss projectors and one pp projector with three orientations.

    Two s projectors plus one p projector with m = -1, 0, 1 gives five per atom.

    S. Goedecker, M. Teter, J. Hutter, 'Separable dual-space Gaussian pseudopotentials', PRB 54, 1703 (1996), arXiv:mtrl-th/9512004: eqs. (1)-(3) local + separable nonlocal form, eq. (5) V_loc(K), eqs. (6)-(12) projectors in Fourier space, Appendix (Pade LDA), 'Discussion of the pseudo-potential parameters': second-row atoms have two s projectors and one p projector; CP2K data, GTH_POTENTIALS, entry 'Si GTH-PADE-q4' (r_loc 0.44, C1 -7.33610297; s: r 0.42273813, h 5.90692831 -1.26189397 3.25819622; p: r 0.48427842, h 2.72701346), https://github.com/cp2k/cp2k-data/blob/master/potentials/Goedecker/cp2k/GTH_POTENTIALS

  876. not-checkable Silicon's band structure, from the crystal up

    D holds the coupling matrices.

    Describes this program's variable.

  877. not-checkable Silicon's band structure, from the crystal up

    Every k-point has its own number of plane waves, so the matrices are padded to NPWMAX rows.

    Describes this program's padding.

  878. not-checkable Silicon's band structure, from the crystal up

    To see the Hamiltonian before any self-consistency, the cell diagonalizes it at Γ\Gamma in the starting potential: the ions plus the exchange-correlation potential of a uniform density (whose Hartree potential is zero).

    Describes what this cell computes.

  879. verified Silicon's band structure, from the crystal up

    Expect one low ss-like state and then a triple degeneracy: at Γ\Gamma the three pp directions are equivalent.

    Silicon's Gamma25' valence level is triply degenerate at k = 0 without spin-orbit, below it the s-like Gamma1 state; the starting potential has the same cubic symmetry.

    M. S. Dresselhaus, Solid State Physics Part II, Optical Properties of Solids (MIT 6.732 notes): 'The Gamma25' band is triply degenerate at k = 0' (no spin-orbit), https://web.mit.edu/6.732/www/6.732-pt2.pdf

  880. not-checkable Silicon's band structure, from the crystal up

    pair_index gives, for every pair of plane waves, where their difference G−G′\mathbf G - \mathbf G' sits in the FFT grid, using whole-matrix arithmetic: an outer difference of the integer triples, wrapped onto the grid (a negative component mm is stored at m+Nm + N).

    Describes this program's function.

  881. not-checkable Silicon's band structure, from the crystal up

    wrap does the same for one number.

    Describes this program's function.

  882. not-checkable Silicon's band structure, from the crystal up

    take then reads the potential at all those places at once.

    Describes this program's function.

  883. not-checkable Silicon's band structure, from the crystal up

    Now the starting potential and one diagonalization at Γ\Gamma, in the spare slot.

    Transition to the next cell.

  884. not-checkable Silicon's band structure, from the crystal up

    potential assembles the total local potential on the grid from a density: the ions, the Hartree potential and exchange-correlation.

    Describes this program's function.

  885. verified Silicon's band structure, from the crystal up

    The Hartree potential comes from Poisson's equation, ∇2VH=−4πρ\nabla^2 V_H = -4\pi\rho, which in reciprocal space is algebra: VH(G)=4πρ(G)/∣G∣2V_H(\mathbf G) = 4\pi\rho(\mathbf G)/|\mathbf G|^2.

    The Hartree potential int rho/|r-r'| satisfies del^2 V_H = -4 pi rho (atomic units), and del^2 -> -|G|^2 gives V_H(G) = 4 pi rho(G)/|G|^2.

    Wikipedia, 'Kohn-Sham equations' (v_eff = v_ext + Hartree + dE_xc/drho; self-consistent solution; total energy E = sum eps_i - E_H + E_xc - int rho v_xc), https://en.wikipedia.org/wiki/Kohn%E2%80%93Sham_equations; N. D. Woods, M. C. Payne, P. J. Hasnip, 'Computing the self-consistent field in Kohn-Sham density functional theory', J. Phys.: Condens. Matter 31, 453001 (2019), arXiv:1905.02332, sec. IV (linear mixing converges q-linearly; Pulay/Anderson accelerates it), sec. III (Hartree kernel 4 pi/|G|^2)

  886. not-checkable Silicon's band structure, from the crystal up

    build the potential from the density RHO;

    Step of this program's loop.

  887. not-checkable Silicon's band structure, from the crystal up

    compute the total energy and how far the new density is from the old one;

    Step of this program's loop.

  888. verified Silicon's band structure, from the crystal up

    The energy is the sum of the occupied band energies, corrected for double counting: each band energy contains the electron's interaction with the whole density, which counts every pair of electrons twice, so the Hartree energy is subtracted once and ∫ρ vxc\int\rho\,v_{xc} is replaced by ∫ρ εxc\int\rho\,\varepsilon_{xc}.

    Matches the Kohn-Sham total energy E = sum eps_i - E_H + E_xc - int rho v_xc. The full total energy also has an ion-ion (Ewald) term, which this program leaves out, as its test says.

    Wikipedia, 'Kohn-Sham equations' (v_eff = v_ext + Hartree + dE_xc/drho; self-consistent solution; total energy E = sum eps_i - E_H + E_xc - int rho v_xc), https://en.wikipedia.org/wiki/Kohn%E2%80%93Sham_equations

  889. verified Silicon's band structure, from the crystal up

    The full program mixes with the last three iterations (Anderson mixing, dft/pw_common.viv), which takes fewer iterations; plain mixing is one line and reaches the same density.

    Anderson/Pulay mixing converges faster than linear mixing, and both converge to the same self-consistent fixed point.

    N. D. Woods, M. C. Payne, P. J. Hasnip, 'Computing the self-consistent field in Kohn-Sham density functional theory', J. Phys.: Condens. Matter 31, 453001 (2019), arXiv:1905.02332, sec. IV (linear mixing converges q-linearly; Pulay/Anderson accelerates it)

  890. verified Silicon's band structure, from the crystal up

    Plain mixing converges geometrically: once the first few iterations are past, expect the density change to shrink by about the same factor at every iteration.

    Woods et al. state that linear mixing converges q-linearly, which means a roughly constant reduction factor per iteration near the fixed point.

    N. D. Woods, M. C. Payne, P. J. Hasnip, 'Computing the self-consistent field in Kohn-Sham density functional theory', J. Phys.: Condens. Matter 31, 453001 (2019), arXiv:1905.02332, sec. IV (linear mixing converges q-linearly; Pulay/Anderson accelerates it)

  891. verified Silicon's band structure, from the crystal up

    With the potential converged, the bands at any k\mathbf k come from one diagonalization each, with no further iteration.

    With the self-consistent potential fixed, H at each k is independent of the density, so bands along a path need one diagonalization per k (non-self-consistent band structure).

    Wikipedia, 'Kohn-Sham equations' (v_eff = v_ext + Hartree + dE_xc/drho; self-consistent solution; total energy E = sum eps_i - E_H + E_xc - int rho v_xc), https://en.wikipedia.org/wiki/Kohn%E2%80%93Sham_equations; Wikipedia, 'Bloch's theorem': psi = e^{ik.r} u(r) with u lattice-periodic; each k gives bands eps_n(k), https://en.wikipedia.org/wiki/Bloch%27s_theorem

  892. verified Silicon's band structure, from the crystal up

    The path runs from LL, the center of a hexagonal face of the Brillouin zone, to its center Γ\Gamma, and on to XX, the center of a square face.

    In the fcc Brillouin zone, L is the center of a hexagonal face and X the center of a square face.

    Wikipedia, 'Brillouin zone', FCC critical points: L = center of a hexagonal face, X = center of a square face, https://en.wikipedia.org/wiki/Brillouin_zone

  893. not-checkable Silicon's band structure, from the crystal up

    Energies are shifted so that the top of the valence bands is zero, and converted to eV.

    Describes this program's plotting convention.

  894. verified Silicon's band structure, from the crystal up

    What to look for: the valence-band top is at Γ\Gamma and threefold degenerate.

    The VBM is at Gamma and is triply degenerate (Gamma25') when spin-orbit coupling is neglected, as in this program.

    E. Oliphant, V. Mantena, M. Brod, G. J. Snyder, W. Sun, 'Why does silicon have an indirect band gap?', Mater. Horiz. 12, 3073 (2025), arXiv:2404.05634, introduction: VBM at Gamma, CBM ~85% of the way from Gamma to X; M. S. Dresselhaus, Solid State Physics Part II, Optical Properties of Solids (MIT 6.732 notes): 'The Gamma25' band is triply degenerate at k = 0' (no spin-orbit), https://web.mit.edu/6.732/www/6.732-pt2.pdf

  895. verified Silicon's band structure, from the crystal up

    The lowest conduction state is not at Γ\Gamma but most of the way to XX, so silicon's gap is indirect: an electron at the bottom of the conduction band has a different crystal momentum from a hole at the top of the valence band.

    The silicon CBM lies about 85% of the way from Gamma to X, so the gap is indirect.

    E. Oliphant, V. Mantena, M. Brod, G. J. Snyder, W. Sun, 'Why does silicon have an indirect band gap?', Mater. Horiz. 12, 3073 (2025), arXiv:2404.05634, introduction: VBM at Gamma, CBM ~85% of the way from Gamma to X

  896. verified Silicon's band structure, from the crystal up

    That is a known failure of the LDA, not of the code.

    LDA/GGA Kohn-Sham gaps severely underestimate semiconductor gaps (Si experiment 1.17 eV at 0 K); this is a failure of the functional and of the KS gap, not of the numerics.

    Z.-h. Yang, H. Peng, J. Sun, J. P. Perdew, 'More-realistic band gaps from meta-generalized gradient approximations: only in a generalized Kohn-Sham scheme', PRB 93, 205205 (2016), arXiv:1603.00512, introduction and Table I (Si experimental gap 1.17 eV; LDA/GGA KS gaps severely underestimate, derivative discontinuity); Ioffe NSM archive, Silicon band structure: Eg = 1.17 - 4.73e-4 T^2/(T+636) eV, https://www.ioffe.ru/SVA/NSM/Semicond/Si/bandstr.html

  897. not-checkable Silicon's band structure, from the crystal up

    The full program runs silicon at 10 Ha with 16 k-points (dft/si.viv), and its check file pins the band energies at LL, Γ\Gamma and XX.

    Describes the full program and its check file.

  898. not-checkable Silicon's band structure, from the crystal up

    Two settings differ, the cutoff and the k-points, so each difference mixes the two effects.

    Describes this post's comparison.

  899. not-checkable Silicon's band structure, from the crystal up

    The energies on both sides are measured from the valence-band top, so the comparison is of spacings between bands, and the differences need not have one sign.

    Describes this post's comparison.

  900. not-checkable Silicon's band structure, from the crystal up

    The six lowest bands along the path.

    Figure caption.

  901. not-checkable Skyrme Hartree-Fock of oxygen-16

    The ground state of 16^{16}O from the SLy5 Skyrme functional, solved on a radial mesh at two spacings and extrapolated.

    Describes what this program computes.

  902. verified Skyrme Hartree-Fock of oxygen-16

    The binding energy comes out 8.0250 MeV per nucleon and the charge radius 2.7993 fm; skyrme_rpa, the published code of Colò et al. (2013), gives 8.0261 MeV and 2.7991 fm in its own test run with the same force, and the six single-particle energies agree with it to 3 keV.

    The numbers are linked to the run and to skyrme_rpa's sample output; the largest single-particle difference in the reference file is 2.1 keV (1p3/2 neutron), within the stated 3 keV.

    G. Colo, L. Cao, N. Van Giai, L. Capelli, 'Self-consistent RPA calculations with Skyrme-type interactions: the skyrme_rpa program', Comput. Phys. Commun. 184, 142 (2013); posts/refs/skyrme-hartree-fock-of-oxygen-16.out

  903. verified Skyrme Hartree-Fock of oxygen-16

    A nucleus is up to a few hundred protons and neutrons (sixteen here) held together by the strong force, which has no simple closed form.

    Replaces disputed d8dbb5d20d30.

    Wikipedia, 'Oganesson': 'Its only known isotope, oganesson-294'; highest atomic mass of all known elements, https://en.wikipedia.org/wiki/Oganesson; Vautherin and Brink, PRC 5, 626 (1972), treats 16O through 208Pb

  904. verified Skyrme Hartree-Fock of oxygen-16

    Nuclear density functional theory replaces it with an energy that depends only on a few local densities: the number density ρq\rho_q of neutrons (q=nq = n) and protons (q=pq = p), their kinetic-energy densities τq\tau_q, and their spin-orbit densities Jq\mathbf J_q.

    For even-even nuclei the Skyrme functional depends on rho_q, tau_q, J_q (and gradients of rho_q), as described.

    K. Bennaceur and J. Dobaczewski, 'Coordinate-space solution of the Skyrme-Hartree-Fock-Bogolyubov equations within spherical symmetry. The program HFBRAD (v1.00)', Comput. Phys. Commun. 168, 96 (2005), arXiv:nucl-th/0501002, eqs. (5)-(8), (13)-(15) and the Skyrme energy functional (ESkyrme)

  905. verified Skyrme Hartree-Fock of oxygen-16

    Skyrme's functional is the oldest of these, with about ten parameters fitted to nuclear data.

    Skyrme's 1959 interaction predates the Gogny force and relativistic mean-field models; standard parameterizations such as SLy5 have about ten parameters.

    Memoir of D. M. Brink, arXiv:2301.02907: Skyrme proposed his short-range effective interaction in 1959; Vautherin and Brink (PRC 5, 626 (1972)) made it the basis of HF calculations; K. Bennaceur and J. Dobaczewski, 'Coordinate-space solution of the Skyrme-Hartree-Fock-Bogolyubov equations within spherical symmetry. The program HFBRAD (v1.00)', Comput. Phys. Commun. 168, 96 (2005), arXiv:nucl-th/0501002, Skyrme energy functional (t0-t3, x0-x3, W0, gamma)

  906. verified Skyrme Hartree-Fock of oxygen-16

    Minimizing the energy gives each nucleon a Schrödinger equation (the second equation above) with a position-dependent effective mass mq∗m^*_q, a central potential UqU_q and a spin-orbit field Wq\mathbf W_q, all computed from the densities.

    Varying the Skyrme energy gives a Schrodinger-like equation with hbar^2/2m*(r), central field U and spin-orbit form factor built from the densities.

    K. Bennaceur and J. Dobaczewski, 'Coordinate-space solution of the Skyrme-Hartree-Fock-Bogolyubov equations within spherical symmetry. The program HFBRAD (v1.00)', Comput. Phys. Commun. 168, 96 (2005), arXiv:nucl-th/0501002, eq. (33); Vautherin and Brink, PRC 5, 626 (1972)

  907. not-checkable Skyrme Hartree-Fock of oxygen-16

    That output file is the published reference here.

    Describes this post's reference.

  908. verified Skyrme Hartree-Fock of oxygen-16

    Each orbital is ϕ=u(r)r [Yl⊗χ]j\phi = \frac{u(r)}{r}\,[Y_l \otimes \chi]_j, and on a mesh ri=ihr_i = ih, i=1…Ni = 1 \dots N, the radial equation for uu is a symmetric tridiagonal matrix:

    A three-point discretization of -d/dr B du/dr with B at half points plus a diagonal potential gives a symmetric tridiagonal matrix.

    K. Bennaceur and J. Dobaczewski, 'Coordinate-space solution of the Skyrme-Hartree-Fock-Bogolyubov equations within spherical symmetry. The program HFBRAD (v1.00)', Comput. Phys. Commun. 168, 96 (2005), arXiv:nucl-th/0501002, eqs. (13)-(15) (orbitals as u(nlj,r)/r times spin-angular factor); Wikipedia, 'Finite difference', sec. Higher-order differences: f''(x) ~ [f(x+h) - 2f(x) + f(x-h)]/h^2, https://en.wikipedia.org/wiki/Finite_difference

  909. verified Skyrme Hartree-Fock of oxygen-16

    −ddrBdudr+[Bl(l+1)r2+B′r+U+VC+⟨σ⋅l⟩Wr]u=εu,B=ℏ22m∗.-\frac{d}{dr}B\frac{du}{dr} + \left[B\frac{l(l+1)}{r^2} + \frac{B'}{r} + U + V_C + \frac{\langle\boldsymbol\sigma\cdot\mathbf l\rangle W}{r}\right]u = \varepsilon u, \qquad B = \frac{\hbar^2}{2m^*}.

    HFBRAD's radial equation has -d/dr M d/dr + M l(l+1)/r^2 + M'/r + U + B[j(j+1)-l(l+1)-3/4]/(2r); with <sigma.l> = j(j+1)-l(l+1)-3/4 and W = B/2 (Vautherin-Brink convention) this is the post's equation, plus Coulomb for protons.

    K. Bennaceur and J. Dobaczewski, 'Coordinate-space solution of the Skyrme-Hartree-Fock-Bogolyubov equations within spherical symmetry. The program HFBRAD (v1.00)', Comput. Phys. Commun. 168, 96 (2005), arXiv:nucl-th/0501002, eqs. (32)-(33); Vautherin and Brink, PRC 5, 626 (1972)

  910. plausible Skyrme Hartree-Fock of oxygen-16

    The first term uses BB at the half points, which keeps the matrix symmetric; the B′/rB'/r term comes from writing the equation for u=rϕu = r\phi rather than ϕ\phi.

    Not accessed; from general knowledge. Rewriting -(1/r^2)(r^2 B phi')' with phi=u/r gives -(Bu')' + (B'/r)u, and half-point B gives a symmetric three-point matrix, so the sentence checks by direct algebra.

    Vautherin and Brink, Phys. Rev. C 5, 626 (1972) (not accessed)

  911. plausible Skyrme Hartree-Fock of oxygen-16

    On the first pass the eigenvalue itself is found first, by bisection on the Sturm count (the number of negative pivots of H−xH - x is the number of eigenvalues below xx), so the iteration starts on the right state.

    Not accessed; from general knowledge. The count of negative pivots of the LDL^T factorization of H - x equals the number of eigenvalues below x by Sylvester's law of inertia.

    Golub and Van Loan, Matrix Computations, Sturm-sequence bisection for symmetric tridiagonal matrices (not accessed)

  912. not-checkable Skyrme Hartree-Fock of oxygen-16

    Derivatives of the densities are centered differences with second-order one-sided ones at the ends, and integrals are trapezoidal.

    Describes this program's discretization.

  913. not-checkable Skyrme Hartree-Fock of oxygen-16

    The protons also feel the Coulomb field of their own density, with exchange in the Slater approximation.

    Describes this program's Coulomb treatment; the reference script uses the same Slater exchange.

    posts/refs/skyrme-hartree-fock-of-oxygen-16.py header: 'Coulomb exchange in the Slater approximation'

  914. not-checkable Skyrme Hartree-Fock of oxygen-16

    On both meshes the energy per nucleon, the three radii and the six orbital energies match the numpy twin to 7×10−97\times10^{-9}; the tests allow 10−710^{-7}.

    Program agreement with its numpy twin; tested (twin_diff under 7e-9).

  915. verified Skyrme Hartree-Fock of oxygen-16

    Going from h=0.1h = 0.1 to h=0.05h = 0.05 fm moves the energy per nucleon by 0.016 MeV and the charge radius by 0.002 fm.

    From the reference output, E/A moves from -8.04654 to -8.03037 MeV (0.0162) and r_ch from 2.79668 to 2.79861 fm (0.0019).

    posts/refs/skyrme-hartree-fock-of-oxygen-16.out and .py header (skyrme_rpa rerun at 0.05 fm: E/A = -8.0259916)

  916. verified Skyrme Hartree-Fock of oxygen-16

    The extrapolated binding energy is 8.02508.0250 MeV per nucleon, against skyrme_rpa's 8.02618.0261: the two differ by 1.1×10−31.1\times10^{-3} MeV per nucleon, 18 keV out of 128 MeV. skyrme_rpa's own answer moves by 1.2×10−41.2\times10^{-4} MeV per nucleon between its 0.1 fm and 0.05 fm meshes (the reference script records the rerun), so most of the remaining difference is between the two programs' formulas, not their meshes.

    Difference 1.13e-3 MeV x 16 = 18 keV; skyrme_rpa's rerun at 0.05 fm gives -8.0259916 vs -8.0261107 at 0.1 fm, a change of 1.2e-4, as stated.

    posts/refs/skyrme-hartree-fock-of-oxygen-16.out and .py header (skyrme_rpa rerun at 0.05 fm: E/A = -8.0259916)

  917. verified Skyrme Hartree-Fock of oxygen-16

    On the 0.1 fm mesh alone, this program's second-order scheme is off by 0.02 MeV per nucleon, which is why it extrapolates.

    On the 0.1 fm mesh E/A = -8.04654 vs skyrme_rpa's -8.02611, a difference of 0.020 MeV.

    posts/refs/skyrme-hartree-fock-of-oxygen-16.out and .py header (skyrme_rpa rerun at 0.05 fm: E/A = -8.0259916)

  918. verified A gyro-orbit and the E×B drift by the Boris push

    The Boris push moves a charged particle through electric and magnetic fields in almost every particle-in-cell code.

    Qin et al.: the Boris algorithm 'is the de facto standard for advancing a charged particle' and has been used in plasma simulation for over forty years.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  919. verified A gyro-orbit and the E×B drift by the Boris push

    With an electric field added, a particle started at E×B/B2\mathbf E \times \mathbf B / B^2 moves at exactly that velocity forever, and any other start averages to it.

    From Eqs. (5)-(7), v -> R(v + a) + a, and R(v_E + a) = v_E - a, so v_E is a fixed point and v - v_E is only rotated, which averages out. Checked algebraically; 'exactly' holds up to rounding.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  920. verified A gyro-orbit and the E×B drift by the Boris push

    A charged particle in a uniform magnetic field circles the field lines at the cyclotron frequency ωc=qB/m\omega_c = qB/m.

    Qin et al. give the gyro-frequency as qB0/mc in Gaussian units, which is qB/m in SI.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  921. verified A gyro-orbit and the E×B drift by the Boris push

    This circling is gyration, and its circle is the gyro-orbit.

    Qin et al. call the circular motion gyromotion at the gyro-frequency and show it as a circle of constant radius; 'gyro-orbit' is standard terminology.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  922. verified A gyro-orbit and the E×B drift by the Boris push

    The Boris push (J. P. Boris, 1970) is the standard choice.

    Qin et al.: 'the Boris algorithm is the de facto standard for advancing a charged particle'; ref. [1] is J. Boris, Proc. 4th Conf. Num. Sim. Plasmas (NRL, 1970), p. 3.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  923. not-checkable A gyro-orbit and the E×B drift by the Boris push

    posts/refs/boris_push.py computes the same numbers with a separate numpy implementation.

    Describes the post's reference script.

  924. verified A gyro-orbit and the E×B drift by the Boris push

    The positions are updated with the new velocity, xn+1=xn+Δt vn+1x_{n+1} = x_n + \Delta t\, v_{n+1}.

    Qin et al. Eq. (3): (x_{k+1} - x_k)/dt = v_{k+1}.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  925. verified A gyro-orbit and the E×B drift by the Boris push

    T2π/ωc=ωcΔt2arctan⁡(ωcΔt/2)=1+(ωcΔt)212+O(Δt4).\frac{T}{2\pi/\omega_c} = \frac{\omega_c\Delta t}{2\arctan(\omega_c\Delta t/2)} = 1 + \frac{(\omega_c\Delta t)^2}{12} + O(\Delta t^4).

    Eq. (6) of Qin et al. is a Cayley rotation with tan(theta/2) = omega_c dt/2, so the period ratio is omega_c dt/(2 arctan(omega_c dt/2)); expanding arctan gives 1 + (omega_c dt)^2/12 + O(dt^4) (checked with mpmath).

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  926. verified A gyro-orbit and the E×B drift by the Boris push

    At Δt=0.05\Delta t = 0.05 that is T=6.28449T = 6.28449 against 2π=6.283192\pi = 6.28319.

    mpmath: 2 pi (0.05)/(2 arctan 0.025) = 6.284494, and 2 pi = 6.283185.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  927. verified A gyro-orbit and the E×B drift by the Boris push

    At Δt=0.4\Delta t = 0.4 the Δt4\Delta t^4 term shows: the error is 1.3194×10−21.3194 \times 10^{-2}, below 0.42/12=1.3333×10−20.4^2/12 = 1.3333 \times 10^{-2}.

    mpmath: 0.4/(2 arctan 0.2) - 1 = 1.31940e-2, below 0.4^2/12 = 1.33333e-2.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  928. verified A gyro-orbit and the E×B drift by the Boris push

    The drift velocity is vE=E×B/B2=(0,−0.1)\mathbf v_E = \mathbf E \times \mathbf B / B^2 = (0, -0.1).

    With E = 0.1 x-hat and B = z-hat, E x B / B^2 = 0.1 (x-hat x z-hat) = (0, -0.1).

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  929. verified A gyro-orbit and the E×B drift by the Boris push

    The vector vE+a=(0.0025,−0.1)\mathbf v_E + \mathbf a = (0.0025, -0.1) is turned by RR into (−0.0025,−0.1)=vE−a(-0.0025, -0.1) = \mathbf v_E - \mathbf a, because its half-angle from −y^-\hat y is arctan⁡(0.0025/0.1)=arctan⁡(Δt/2)=θ/2\arctan(0.0025/0.1) = \arctan(\Delta t/2) = \theta/2.

    a = E dt/2 = (0.0025, 0); the Cayley rotation turns by theta = 2 arctan(dt/2) clockwise for q > 0, taking the vector at half-angle arctan(0.025) on one side of -y-hat to the mirror point (-0.0025, -0.1). Checked by hand.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  930. verified A gyro-orbit and the E×B drift by the Boris push

    For any other start, u=v−vE\mathbf u = \mathbf v - \mathbf v_E is only rotated, so the particle gyrates about a guiding center moving at vE\mathbf v_E.

    From v -> R(v + a) + a and R(v_E + a) = v_E - a, it follows that v - v_E -> R(v - v_E); checked algebraically.

    H. Qin et al., 'Why is Boris algorithm so good?', Phys. Plasmas 20, 084503 (2013), Eqs. (3)-(7), https://bp-pub.pppl.gov/pub_report//2013/PPPL-4872.pdf

  931. not-checkable The error of a linear solve follows the condition number

    Gaussian elimination with partial pivoting solves Hilbert systems whose exact solution is all ones.

    Describes what this program does.

  932. not-checkable The error of a linear solve follows the condition number

    Every computed answer here is compared with an exact one.

    Describes this post's testing.

  933. not-checkable The error of a linear solve follows the condition number

    The Hilbert systems are scaled to have integer entries, so the system stored in the computer is the exact system and its solution is exactly all ones; the Python reference confirms it by solving in rational arithmetic with fractions.

    Describes this program and its reference script.

  934. not-checkable The error of a linear solve follows the condition number

    The exact condition numbers come from mpmath at 80 digits, and numpy's linalg.cond agrees with them to 3×10−63 \times 10^{-6} through n=10n = 10.

    Describes the reference script; its output prints numpy cond against mpmath at most 2.8e-6 off through n = 10.

  935. verified The error of a linear solve follows the condition number

    The condition number κ(A)=σmax⁡/σmin⁡\kappa(A) = \sigma_{\max}/\sigma_{\min}, the ratio of the largest to the smallest singular value, bounds how much a relative change in bb or AA can change the solution of Ax=bAx = b: by up to κ\kappa times as much.

    Higham: forward error <~ condition number x backward error; kappa_2 = sigma_max/sigma_min for Ax = b. The bound is a first-order worst case, as 'up to' says.

    N. J. Higham, 'What Is Backward Error?', https://nhigham.com/2020/03/25/what-is-backward-error/; Numerical Linear Algebra: Least Squares, QR and SVD, arXiv:2412.19960, Secs. 1.3, 3.1, 3.5

  936. verified The error of a linear solve follows the condition number

    A method is backward stable if its answer is the exact solution of a nearby system, one whose data differ from AA and bb by a few ε\varepsilon relative.

    Matches Higham's definition of backward error as the smallest relative data perturbation making the computed answer exact; backward stable means that is O(eps).

    N. J. Higham, 'What Is Backward Error?', https://nhigham.com/2020/03/25/what-is-backward-error/

  937. verified The error of a linear solve follows the condition number

    Its residual b−Ax^b - A\hat x is then a few ε\varepsilon relative to ∥A∥ ∥x^∥\|A\|\,\|\hat x\|, and its error is about κε\kappa\varepsilon.

    Small backward error gives small relative residual, and forward error <~ kappa x backward error; 'about kappa eps' is an upper-bound estimate, which the post's measured 0.005 to 0.18 kappa eps shows.

    N. J. Higham, 'What Is Backward Error?', https://nhigham.com/2020/03/25/what-is-backward-error/

  938. verified The error of a linear solve follows the condition number

    Gaussian elimination with partial pivoting (GEPP) behaves this way in practice.

    Higham: GEPP's backward error is proportional to the growth factor, which 'is usually of modest size in practice'.

    N. J. Higham, 'What Is the Growth Factor for Gaussian Elimination?', https://nhigham.com/2020/07/14/what-is-the-growth-factor-for-gaussian-elimination/

  939. verified The error of a linear solve follows the condition number

    So a small residual says the method did its job, and it says nothing about the error when κ\kappa is large.

    Since forward error <~ kappa x backward error, a small residual (small backward error) bounds the error only up to a factor kappa.

    N. J. Higham, 'What Is Backward Error?', https://nhigham.com/2020/03/25/what-is-backward-error/

  940. verified The error of a linear solve follows the condition number

    The Hilbert matrix Hij=1/(i+j+1)H_{ij} = 1/(i + j + 1) is the standard ill-conditioned example; κ\kappa grows about 32 times with each row added.

    kappa grows asymptotically like e^{3.5255n}, about 34x per row; from 524 (n = 3) to 1.71e16 (n = 12) the geometric mean is 31.7x per row, tested.

    Hilbert matrix, https://en.wikipedia.org/wiki/Hilbert_matrix (pointer; kappa ~ e^{3.5255 n}/sqrt(n), (1+sqrt2)^4 = 33.97); posts/refs/the-error-follows-the-condition-number.out

  941. verified The error of a linear solve follows the condition number

    Multiplying by L=lcm(1,…,2n−1)L = \mathrm{lcm}(1, \ldots, 2n - 1) makes every entry an integer below 2532^{53}, stored exactly, with the same κ\kappa.

    Entries are 1/(i+j+1) with i+j+1 in 1..2n-1, so L makes them integers; lcm(1..23) = 5354228880 < 2^53 = 9.0e15, and scaling by a constant leaves kappa unchanged.

    posts/refs/the-error-follows-the-condition-number.out; Hilbert matrix, https://en.wikipedia.org/wiki/Hilbert_matrix (pointer; kappa ~ e^{3.5255 n}/sqrt(n), (1+sqrt2)^4 = 33.97)

  942. verified The error of a linear solve follows the condition number

    The right side b=H (1,…,1)b = H\,(1, \ldots, 1) is a sum of integers, also exact.

    Row sums of at most 12 integers each below 5.4e9 stay far below 2^53, so they are exact in double precision.

    posts/refs/the-error-follows-the-condition-number.out

  943. not-checkable The error of a linear solve follows the condition number

    The condition number has to be computed too, and it runs into the same limit.

    Transition.

  944. plausible The error of a linear solve follows the condition number

    eig_sym finds the smallest eigenvalue to within about ε\varepsilon times the largest, so κ\kappa comes out with a relative error below κε\kappa\varepsilon: 1.1×10−151.1 \times 10^{-15} at n=3n = 3 and 4.4% at n=12n = 12, where numpy's cond is off by 1.6%.

    Not accessed; from general knowledge: a backward-stable symmetric eigensolver gives eigenvalues with absolute error ~ eps*||H|| (Weyl), so kappa's relative error is ~ kappa eps. The reference output confirms numpy cond is 1.57% off at n = 12.

    posts/refs/the-error-follows-the-condition-number.out

  945. verified The error of a linear solve follows the condition number

    A least-squares fit asks for the cc that minimizes ∥Vc−y∥\|Vc - y\| for a tall matrix VV.

    Standard definition of the linear least-squares problem for a tall matrix.

    Numerical Linear Algebra: Least Squares, QR and SVD, arXiv:2412.19960, Secs. 1.3, 3.1, 3.5

  946. verified The error of a linear solve follows the condition number

    The normal equations VTVc=VTyV^T V c = V^T y are the textbook route: a square system, solved here with the same elimination.

    Sec. 1.3 introduces the normal equations A^T A x = A^T b as the classical route.

    Numerical Linear Algebra: Least Squares, QR and SVD, arXiv:2412.19960, Secs. 1.3, 3.1, 3.5

  947. verified The error of a linear solve follows the condition number

    But κ(VTV)=κ(V)2\kappa(V^T V) = \kappa(V)^2, so the error is about κ2ε\kappa^2\varepsilon.

    Sec. 1.3: cond2(A^T A) = cond2(A)^2; the reference output shows NE errors of 0.002 to 0.27 kappa^2 eps.

    Numerical Linear Algebra: Least Squares, QR and SVD, arXiv:2412.19960, Secs. 1.3, 3.1, 3.5

  948. verified The error of a linear solve follows the condition number

    Householder QR multiplies VV by reflections I−2vvT/vTvI - 2vv^T/v^Tv, each of which zeroes one column below the diagonal, until VV is upper triangular, RR.

    Sec. 3.1: H = I - 2uu^T/u^Tu maps a vector to a multiple of e_1, zeroing entries below the first; applied column by column it produces R.

    Numerical Linear Algebra: Least Squares, QR and SVD, arXiv:2412.19960, Secs. 1.3, 3.1, 3.5

  949. verified The error of a linear solve follows the condition number

    Reflections are orthogonal and change no lengths, so the problem becomes Rc=QTyRc = Q^T y with κ(R)=κ(V)\kappa(R) = \kappa(V), and the error is about κε\kappa\varepsilon.

    Householder QR is backward stable (Sec. 3.5, Wilkinson), and for this consistent (zero-residual) problem the error is about kappa eps; strictly the system is R c = (first n rows of Q^T y).

    Numerical Linear Algebra: Least Squares, QR and SVD, arXiv:2412.19960, Secs. 1.3, 3.1, 3.5; posts/refs/the-error-follows-the-condition-number.out

  950. not-checkable The error of a linear solve follows the condition number

    The data are rounded when they are formed, which moves the exact least-squares answer of the stored problem slightly away from all ones.

    Describes this program's data; the reference output lists the exact-LS offset.

    posts/refs/the-error-follows-the-condition-number.out

  951. not-checkable The error of a linear solve follows the condition number

    The singular values for κ(V)\kappa(V) come from one-sided Jacobi (lib/svd).

    Describes which library routine the program uses.

  952. not-checkable A star of free neutrons can weigh at most 0.71 suns

    Hold a ball of neutrons up by their Fermi pressure alone, with gravity from general relativity, and solve for the star at each central density.

    Describes what the post computes.

  953. verified A star of free neutrons can weigh at most 0.71 suns

    A scipy twin written in different variables gets 0.710180.71018, and Narain, Schaffner-Bielich and Mishustin (2006) quote 0.7100.710.

    Narain et al.: 'a neutron star with mf = mn = 939.6 MeV in eq. (31) and eq. (32), has the maximum mass Mmax = 0.710 M_sun'.

    G. Narain, J. Schaffner-Bielich, I. N. Mishustin, Phys. Rev. D 74, 063003 (2006), arXiv:astro-ph/0605724, Eqs. (30)-(32) and following text

  954. not-checkable A star of free neutrons can weigh at most 0.71 suns

    The reference, in posts/refs/the-free-neutron-star-limit.py, integrates the same physics a different way: in cgs units, with the radius as the independent variable and the Fermi momentum as the unknown, by scipy's DOP853 at a relative tolerance of 10−1210^{-12}, and finds the maximum with minimize_scalar.

    Describes the reference script.

  955. verified A star of free neutrons can weigh at most 0.71 suns

    The literature value is from G. Narain, J. Schaffner-Bielich and I. N. Mishustin, "Compact stars made of fermionic dark matter", Phys. Rev. D 74, 063003 (2006), arXiv:astro-ph/0605724: from their Eqs. (31) and (32), a star of free neutrons has "the maximum mass Mmax=0.710 M⊙M_\text{max} = 0.710\,M_\odot at a radius of Rmin=9.192R_\text{min} = 9.192 km, which match very well the original results of Oppenheimer and Volkoff" (Phys. Rev. 55, 374, 1939).

    Quote matches the paper text verbatim, including Eqs. (31) and (32), 9.192 km, and the reference to Oppenheimer and Volkoff.

    G. Narain, J. Schaffner-Bielich, I. N. Mishustin, Phys. Rev. D 74, 063003 (2006), arXiv:astro-ph/0605724, Eqs. (30)-(32) and following text

  956. not-checkable A star of free neutrons can weigh at most 0.71 suns

    The program takes 400 steps per star, and its maximum agrees with scipy's to 2×10−82 \times 10^{-8} of a solar mass; the tests allow 10−610^{-6}, relative.

    Describes this program's step count and test tolerance.

  957. verified A star of free neutrons can weigh at most 0.71 suns

    A neutron star is held up by the pressure of its neutrons.

    Silbar and Reddy: degeneracy pressure (with nuclear interactions for realistic stars) supports the star against gravity.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  958. verified A star of free neutrons can weigh at most 0.71 suns

    Neutrons are fermions: no two can share a state, so packing them tighter forces them into states of higher momentum, and that momentum pushes outward even at zero temperature.

    Silbar and Reddy lines on the Pauli principle: degeneracy pressure stabilizes cold (T = 0) stars against gravity.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  959. verified A star of free neutrons can weigh at most 0.71 suns

    In 1939 Oppenheimer and Volkoff asked how heavy a star held up this way alone can be, ignoring the nuclear force between the neutrons.

    Silbar and Reddy: the non-interacting Fermi gas EoS reproduces 'the results of Oppenheimer and Volkov' (Phys. Rev. 55, 374 (1939)) for pure neutron stars.

    G. Narain, J. Schaffner-Bielich, I. N. Mishustin, Phys. Rev. D 74, 063003 (2006), arXiv:astro-ph/0605724, Eqs. (30)-(32) and following text; R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  960. verified A star of free neutrons can weigh at most 0.71 suns

    In general relativity pressure is itself a source of gravity, so a star that squeezes its center harder to push back also pulls harder, and past some central density the extra pull wins.

    The TOV equation in Silbar and Reddy has the factors (1 + p/eps) and (1 + 4 pi r^3 p/Mc^2): pressure adds to the gravitational pull.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  961. verified A star of free neutrons can weigh at most 0.71 suns

    A cold gas of free neutrons is described by one number, the Fermi momentum pFp_F, written as x=pF/mncx = p_F / m_n c.

    Silbar and Reddy Eqs. (10) and (14) give eps and p as functions of x = k_F/mc alone.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  962. not-checkable A star of free neutrons can weigh at most 0.71 suns

    The energy density ε\varepsilon (including the neutrons' rest mass) and the pressure PP are

    Lead-in to the formula that follows.

  963. verified A star of free neutrons can weigh at most 0.71 suns

    ε=ε0[(2x3+x)1+x2−sinh⁡−1x],P=ε03[(2x3−3x)1+x2+3sinh⁡−1x],\varepsilon = \varepsilon_0\left[(2x^3 + x)\sqrt{1+x^2} - \sinh^{-1} x\right], \qquad P = \frac{\varepsilon_0}{3}\left[(2x^3 - 3x)\sqrt{1+x^2} + 3\sinh^{-1} x\right],

    Silbar and Reddy Eqs. (10) and (14) have eps0'/8 [...] and eps0'/24 [...] with eps0' = m^4c^5/(pi^2 hbar^3); with eps0 = eps0'/8 these are the post's formulas.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  964. verified A star of free neutrons can weigh at most 0.71 suns

    The first two terms of the pressure's series at small x, (8/15)·x⁵·(1 − (5/14)·x²), in units of ε₀.

    sympy series of Silbar-Reddy's P (Eq. 14, rescaled): 8x^5/15 - 4x^7/21 = (8/15)x^5(1 - (5/14)x^2).

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  965. verified A star of free neutrons can weigh at most 0.71 suns

    For free neutrons μ=mnc21+x2\mu = m_n c^2 \sqrt{1 + x^2}, so x=e2h−1x = \sqrt{e^{2h} - 1} and the equation of state needs no inverting.

    The T = 0 chemical potential d eps/dn (Silbar-Reddy Eq. 13) of a free Fermi gas is sqrt(p_F^2c^2 + m^2c^4) = mc^2 sqrt(1+x^2); inverting h = ln(mu/mc^2) gives x = sqrt(e^{2h}-1).

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  966. plausible A star of free neutrons can weigh at most 0.71 suns

    The surface, where the pressure is zero, is h=0h = 0 exactly, so every star is integrated over a known interval, from hch_c at the center to 0; the equations are the two at the top of the page (Lindblom, ApJ 398, 569, 1992).

    Only the abstract was read; the enthalpy form of the structure equations in that paper is from general knowledge. P = 0 at x = 0 gives h = 0 exactly.

    L. Lindblom, ApJ 398, 569 (1992), https://ui.adsabs.harvard.edu/abs/1992ApJ...398..569L/abstract (abstract only)

  967. verified A star of free neutrons can weigh at most 0.71 suns

    Near the center rr grows like hc−h\sqrt{h_c - h}, and near the surface the density falls like h3/2h^{3/2}; a fixed-step method follows neither well.

    From TOV near the center, h_c - h ~ r^2 so r ~ sqrt(h_c - h); near the surface x ~ sqrt(2h), so n ~ x^3 ~ h^{3/2}. Derived by hand from the equations in the source.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  968. verified A star of free neutrons can weigh at most 0.71 suns

    Near the center that makes rr a straight line in tt, r≈hc−h 3/2π(εc+3Pc)r \approx \sqrt{h_c - h}\,\sqrt{3/2\pi(\varepsilon_c + 3P_c)}, and near the surface h≈2hc(1−t)2h \approx 2h_c(1 - t)^2, so x∝1−tx \propto 1 - t and the density is a polynomial in tt there too.

    With m ~ (4pi/3) eps_c r^3, dh/dr ~ -(4pi/3)(eps_c + 3P_c) r gives h_c - h = (2pi/3)(eps_c+3P_c) r^2; near t = 1, h_c - h = h_c (1 - (1-t)^2)^2 gives h ~ 2h_c(1-t)^2. Derived by hand.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  969. not-checkable A star of free neutrons can weigh at most 0.71 suns

    With 400 steps a star's radius and mass agree with the scipy twin to about 3×10−73 \times 10^{-7}, the digits the twin was recorded to; with 100 steps, to 3×10−53 \times 10^{-5}.

    Program agreement with its scipy twin; tested (3.3e-7 at 400 steps, 3.3e-5 at 100).

  970. not-checkable A star of free neutrons can weigh at most 0.71 suns

    Each central density gives one star.

    Narration of the program's sequence of stars.

  971. not-checkable A star of free neutrons can weigh at most 0.71 suns

    Somewhere in between the mass passed through a maximum.

    Narration of the computed sequence.

  972. verified A star of free neutrons can weigh at most 0.71 suns

    Narain, Schaffner-Bielich and Mishustin (2006) quote 9.192 km for the radius, 0.3% larger than both this program and the scipy twin; their number comes from a scaling formula (their Eq. (32)) whose coefficient, 3.367, they give to four digits.

    Eq. (32): R_min = 8.115 km (1 GeV/m_f)^2, from R'_min = 3.367 stated before Eq. (31); for m_f = 939.6 MeV they give R_min = 9.192 km. 9.192/9.1615 = 1.0033, 0.3% larger.

    G. Narain, J. Schaffner-Bielich, I. N. Mishustin, Phys. Rev. D 74, 063003 (2006), arXiv:astro-ph/0605724, Eqs. (30)-(32) and the text after them (read in this session); posts/refs/the-free-neutron-star-limit.out

  973. verified A star of free neutrons can weigh at most 0.71 suns

    Along the sequence, the stars to the right of the peak (larger, lighter, less dense) are stable: add a little mass and the star settles slightly smaller.

    Silbar and Reddy Fig. 6: 'The stars to the right of the maximum are stable'; along that branch higher mass goes with smaller radius.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  974. verified A star of free neutrons can weigh at most 0.71 suns

    The stars to its left are not, and a small squeeze makes them collapse.

    Silbar and Reddy: stars 'to the left of the maximum ... are unstable against gravitational collapse'.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  975. plausible A star of free neutrons can weigh at most 0.71 suns

    Heavier neutron stars need the force between neutrons, which this model leaves out, to be repulsive at these densities.

    Silbar and Reddy (Sec. 5-6) show that adding nucleon interactions raises the maximum mass above the free-gas value; that the needed interaction is repulsive at these densities is from general knowledge, not a passage read.

    R. R. Silbar and S. Reddy, 'Neutron stars for undergraduates', Am. J. Phys. 72, 892 (2004), arXiv:nucl-th/0309041, Eqs. (10), (14), TOV eq. and Fig. 6

  976. verified The two-pion loop function, built and differentiated by a small computer algebra system

    Both are checked against a 30-digit Feynman-parameter integral that never uses the closed form: L(200 MeV)=1.14642288565L(200\text{ MeV}) = 1.14642288565 and dL/dq=1.24075106×10−3dL/dq = 1.24075106\times10^{-3}/MeV there, to 10−1410^{-14} and 2×10−172\times10^{-17}/MeV.

    mpmath from Eq. (4.11) with m_pi = 138.039 gives L(200) = 1.1464228856496 and dL/dq = 1.240751064e-3/MeV, matching the reference's Feynman-parameter values.

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12); posts/refs/the-pion-loop-function-by-computer-algebra.out

  977. verified The two-pion loop function, built and differentiated by a small computer algebra system

    In chiral effective field theory the force between two nucleons is a sum of pion exchanges and short-range contact terms.

    Replaces disputed 6d24d0bbae07.

    Machleidt and Entem, Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Sec. 3.2 (read from the PDF): at LO 'the NN amplitude is made up by two momentum-independent contact terms ... and static one-pion exchange'; Sec. 4.1 pion exchanges, Sec. 4.3 NN contact terms

  978. verified The two-pion loop function, built and differentiated by a small computer algebra system

    At next-to-leading order the exchange of two pions enters through one function of the momentum transfer qq,

    Eqs. (4.9)-(4.10): at NLO W_C, V_T and V_S are all proportional to L(q).

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  979. verified The two-pion loop function, built and differentiated by a small computer algebra system

    L(q)=wqln⁡w+q2mπ,w=4mπ2+q2,L(q) = \frac{w}{q}\ln\frac{w + q}{2m_\pi}, \qquad w = \sqrt{4m_\pi^2 + q^2},

    Eqs. (4.11)-(4.12): L(q) = (w/q) ln((w+q)/(2m_pi)), w = sqrt(4m_pi^2 + q^2).

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  980. verified The two-pion loop function, built and differentiated by a small computer algebra system

    which multiplies the central, tensor and spin-spin parts of the potential (Machleidt and Entem, Phys. Rep. 503, 1 (2011), Eqs. (4.9)-(4.12), with their average pion mass mπ=138.039m_\pi = 138.039 MeV).

    L(q) multiplies W_C (isovector central), V_T and V_S = -q^2 V_T in Eqs. (4.9)-(4.10); the review uses the average pion mass m_pi = 138.039 MeV (Sec. 4.2).

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  981. plausible The two-pion loop function, built and differentiated by a small computer algebra system

    Higher orders need many such functions and their derivatives, which is the job of a computer algebra system.

    At N2LO the review introduces the additional loop function A(q), and higher orders bring more; calling this 'the job of a computer algebra system' is a judgment, not a checkable fact.

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  982. not-checkable The two-pion loop function, built and differentiated by a small computer algebra system

    Nothing simplifies the result, so the derivative tape does more arithmetic than a hand-written derivative would, but it is exact.

    Describes this program's differentiator.

  983. plausible The two-pion loop function, built and differentiated by a small computer algebra system

    The reference evaluates LL at eight momenta from its integral representation, which comes from the loop diagram itself, not from the closed form.

    Not accessed; from general knowledge. The Feynman-parameter form 1 + (1/2) int_0^1 ln(1 + x(1-x)q^2/m_pi^2) dx equals Eq. (4.11) to 30 digits in mpmath, but no source deriving it from the diagram was read.

    posts/refs/the-pion-loop-function-by-computer-algebra.out

  984. verified The two-pion loop function, built and differentiated by a small computer algebra system

    The tape agrees at every one to 10−1410^{-14}, from q=1q = 1 MeV, where L−1=4.4×10−6L - 1 = 4.4\times10^{-6}, to 1 GeV.

    At q = 1 MeV, mpmath from Eq. (4.11) gives L - 1 = 4.373e-6.

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12); posts/refs/the-pion-loop-function-by-computer-algebra.out

  985. verified The two-pion loop function, built and differentiated by a small computer algebra system

    At small qq the logarithm in the integral expands, and with t=q2/mπ2t = q^2/m_\pi^2 and ∫01x(1−x)dx=1/6\int_0^1 x(1-x)dx = 1/6, ∫01x2(1−x)2dx=1/30\int_0^1 x^2(1-x)^2dx = 1/30,

    int_0^1 x(1-x) dx = 1/6 and int_0^1 x^2(1-x)^2 dx = 1/30 are exact; combined with the representation they give the series below.

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  986. verified The two-pion loop function, built and differentiated by a small computer algebra system

    L=1+t12−t2120+O(t3).L = 1 + \frac{t}{12} - \frac{t^2}{120} + O(t^3).

    sympy series of Eq. (4.11) in units m_pi = 1: 1 + q^2/12 - q^4/120 + O(q^6).

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  987. verified The two-pion loop function, built and differentiated by a small computer algebra system

    At q=1q = 1 MeV, t2/120=2.3×10−11t^2/120 = 2.3\times10^{-11}, and the tape matches the two terms to 10−1310^{-13}.

    t = (1/138.039)^2, t^2/120 = 2.30e-11.

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  988. plausible The two-pion loop function, built and differentiated by a small computer algebra system

    A third representation is the dispersion integral: LL has an imaginary part above the two-pion threshold μ=2mπ\mu = 2m_\pi, and

    Not accessed; from general knowledge. L(q) as a function of q^2 has a cut from -4m_pi^2 (the two-pion threshold mu = 2m_pi); the dispersion integral below equals Eq. (4.11) to 30 digits in mpmath at q = 200 MeV.

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  989. plausible The two-pion loop function, built and differentiated by a small computer algebra system

    L(q)=1+q2∫2mπ∞μ2−4mπ2μ2(μ2+q2) dμ.L(q) = 1 + q^2\int_{2m_\pi}^\infty \frac{\sqrt{\mu^2 - 4m_\pi^2}}{\mu^2(\mu^2 + q^2)}\,d\mu .

    Not accessed; from general knowledge. mpmath evaluation of this integral at q = 200 MeV reproduces Eq. (4.11) to 30 digits.

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  990. not-checkable The two-pion loop function, built and differentiated by a small computer algebra system

    The derivative tape, evaluated at three momenta, matches mpmath's numerical derivative of the Feynman-parameter integral to 2×10−172\times10^{-17} per MeV, rounding in a number of about 0.001.

    Program result; tested (dL_tape_err 1.7e-17 under 2e-17; dL/dq is about 1.24e-3 per MeV).

  991. plausible The two-pion loop function, built and differentiated by a small computer algebra system

    A central difference on the tape with a step of 1 MeV is off by up to 5.3×10−95.3\times10^{-9}, which is the h2L′′′/6h^2L'''/6 error of that step; the symbolic derivative has no step to choose.

    Not accessed; from general knowledge that the central difference error is h^2 f'''/6; mpmath gives L'''/6 = -5.3e-9/MeV^3 at q = 200 MeV, so 5e-9 at h = 1 MeV is consistent.

    R. Machleidt and D. R. Entem, 'Chiral effective field theory and nuclear forces', Phys. Rep. 503, 1 (2011), arXiv:1105.2919, Eqs. (4.9)-(4.12)

  992. not-checkable Tunneling through one and two barriers by transfer matrices

    An electron meets a barrier it does not have the energy to climb.

    Scene-setting for the tunneling problem; no claim to check.

  993. not-checkable Tunneling through one and two barriers by transfer matrices

    The reference, posts/refs/transfer-matrices-and-resonant-tunneling.py, does not multiply transfer matrices.

    Describes the post's reference script; confirmed by reading posts/refs/transfer-matrices-and-resonant-tunneling.py (it uses np.linalg.solve on the full system).

  994. not-checkable Tunneling through one and two barriers by transfer matrices

    It writes every matching condition of the whole potential as one linear system and solves it with numpy.linalg.solve, and it finds the resonances with scipy.optimize.

    Describes the reference script; the file imports scipy.optimize (minimize_scalar, brentq) and calls np.linalg.solve, as stated.

  995. not-checkable Tunneling through one and two barriers by transfer matrices

    The single barrier is also checked against its textbook closed form.

    Describes the reference script, which implements the sinh closed form at line 70.

  996. verified Tunneling through one and two barriers by transfer matrices

    Where the potential is flat, the time-independent Schrödinger equation −12ψ′′+Vψ=Eψ-\tfrac12\psi'' + V\psi = E\psi has two solutions, a wave moving right and one moving left:

    In units hbar=m=1 the flat-region solutions are e^{+ikx} and e^{-ikx} with k=sqrt(2(E-V)), the standard free-particle solutions.

    Wikipedia, 'Rectangular potential barrier', transmission coefficient for E<V0 and E>V0 (pointer to Griffiths, Intro to QM, Problem 2.33), https://en.wikipedia.org/wiki/Rectangular_potential_barrier

  997. verified Tunneling through one and two barriers by transfer matrices

    ψ(x)=A eik(x−x0)+B e−ik(x−x0),k=2(E−V).\psi(x) = A\,e^{ik(x - x_0)} + B\,e^{-ik(x - x_0)}, \qquad k = \sqrt{2(E - V)}.

    Standard plane-wave form with k=sqrt(2m(E-V))/hbar, here with hbar=m=1.

    Wikipedia, 'Rectangular potential barrier', transmission coefficient for E<V0 and E>V0 (pointer to Griffiths, Intro to QM, Problem 2.33), https://en.wikipedia.org/wiki/Rectangular_potential_barrier

  998. verified Tunneling through one and two barriers by transfer matrices

    When E<VE < V the square root is imaginary, k=iκk = i\kappa, and the two waves become a decaying and a growing exponential.

    Liss, p. 7-4: for E < V0, kappa^2 = 2m(V0-E)/hbar^2 is real and psi = A e^{-kappa x} + B e^{kappa x} inside the barrier.

    T. M. Liss, Physics 486 Lecture 7, The step potential and the square barrier (U. Illinois, 2009), pp. 7-2 to 7-6, https://courses.physics.illinois.edu/phys487/sp2010/486Lectures/lect07.pdf

  999. verified Tunneling through one and two barriers by transfer matrices

    That is tunneling: the wave does not stop at the wall, it fades inside it.

    Liss, p. 7-6: inside the barrier the wave is a sum of real exponentials, and the transmission is nonzero for E < V0; 'This is tunneling'.

    T. M. Liss, Physics 486 Lecture 7, The step potential and the square barrier (U. Illinois, 2009), pp. 7-2 to 7-6, https://courses.physics.illinois.edu/phys487/sp2010/486Lectures/lect07.pdf

  1000. verified Tunneling through one and two barriers by transfer matrices

    At an edge where VV jumps, ψ\psi and ψ′\psi' must be continuous.

    Liss, p. 7-2: the boundary conditions are 'the continuity of the wave function and its first derivative' at a finite step.

    T. M. Liss, Physics 486 Lecture 7, The step potential and the square barrier (U. Illinois, 2009), pp. 7-2 to 7-6, https://courses.physics.illinois.edu/phys487/sp2010/486Lectures/lect07.pdf

  1001. plausible Tunneling through one and two barriers by transfer matrices

    The whole potential is the product of these matrices, one matrix MM.

    Composing interface and propagation matrices is the standard transfer-matrix method; not accessed in a textbook section; from general knowledge plus the Tsu-Esaki setup.

    R. Tsu and L. Esaki, 'Tunneling in a finite superlattice', Appl. Phys. Lett. 22, 562 (1973); L. L. Chang, L. Esaki, R. Tsu, 'Resonant tunneling in semiconductor double barriers', Appl. Phys. Lett. 24, 593 (1974)

  1002. verified Tunneling through one and two barriers by transfer matrices

    Far to the left the wave is the incoming one plus a reflected one, (A,B)=(1,r)(A, B) = (1, r).

    Incident plus reflected wave on the left, amplitudes (1, r), matches the standard scattering setup.

    Wikipedia, 'Rectangular potential barrier', transmission coefficient for E<V0 and E>V0 (pointer to Griffiths, Intro to QM, Problem 2.33), https://en.wikipedia.org/wiki/Rectangular_potential_barrier

  1003. verified Tunneling through one and two barriers by transfer matrices

    Far to the right there is only the transmitted wave, (t,0)(t, 0).

    Only a transmitted wave on the right, as in the standard scattering setup.

    Wikipedia, 'Rectangular potential barrier', transmission coefficient for E<V0 and E>V0 (pointer to Griffiths, Intro to QM, Problem 2.33), https://en.wikipedia.org/wiki/Rectangular_potential_barrier

  1004. verified Tunneling through one and two barriers by transfer matrices

    So M(1,r)T=(t,0)TM(1, r)^{\mathsf T} = (t, 0)^{\mathsf T}, and the second row gives r=−M21/M22r = -M_{21}/M_{22}, the first t=det⁡M/M22t = \det M / M_{22}.

    Both expressions follow directly from the two rows.

    Algebra from the stated M(1,r)=(t,0): row 2 gives M21+M22 r=0, row 1 gives t=M11+M12 r=(M11M22-M12M21)/M22=det M/M22; checked by hand.

  1005. verified Tunneling through one and two barriers by transfer matrices

    With the same potential on both sides, the transmission probability is T=∣t∣2T = |t|^2 and the reflection probability R=∣r∣2R = |r|^2.

    Liss, p. 7-6: since the velocity factor is the same on both sides, the transmission coefficient is |D|^2; Wikipedia gives T = |t|^2 and R = |r|^2.

    T. M. Liss, Physics 486 Lecture 7, The step potential and the square barrier (U. Illinois, 2009), pp. 7-2 to 7-6, https://courses.physics.illinois.edu/phys487/sp2010/486Lectures/lect07.pdf; Wikipedia, Rectangular potential barrier (pointer; cites Griffiths 2nd ed. and Cohen-Tannoudji pp. 231-233), https://en.wikipedia.org/wiki/Rectangular_potential_barrier

  1006. verified Tunneling through one and two barriers by transfer matrices

    For a single rectangular barrier the answer is known in closed form.

    Liss derives the rectangular-barrier transmission in closed form.

    T. M. Liss, Physics 486 Lecture 7, The step potential and the square barrier (U. Illinois, 2009), pp. 7-2 to 7-6, https://courses.physics.illinois.edu/phys487/sp2010/486Lectures/lect07.pdf; Wikipedia, Rectangular potential barrier (pointer; cites Griffiths 2nd ed. and Cohen-Tannoudji pp. 231-233), https://en.wikipedia.org/wiki/Rectangular_potential_barrier

  1007. verified Tunneling through one and two barriers by transfer matrices

    Below the top, with κ=2(V0−E)\kappa = \sqrt{2(V_0 - E)} and width aa,

    kappa=sqrt(2(V0-E)) in hbar=m=1 units matches Wikipedia's k1; the formula that follows is the standard one.

    Wikipedia, 'Rectangular potential barrier', transmission coefficient for E<V0 and E>V0 (pointer to Griffiths, Intro to QM, Problem 2.33), https://en.wikipedia.org/wiki/Rectangular_potential_barrier

  1008. verified Tunneling through one and two barriers by transfer matrices

    T=[1+V02sinh⁡2(κa)4E(V0−E)]−1,T = \left[1 + \frac{V_0^2 \sinh^2(\kappa a)}{4E(V_0 - E)}\right]^{-1},

    Liss's T = (2k kappa)^2/[(2k kappa)^2 + (k^2+kappa^2)^2 sinh^2] (barrier width 2a) reduces to this form with hbar = m = 1 and width a; Wikipedia states it directly.

    T. M. Liss, Physics 486 Lecture 7, The step potential and the square barrier (U. Illinois, 2009), pp. 7-2 to 7-6, https://courses.physics.illinois.edu/phys487/sp2010/486Lectures/lect07.pdf; Wikipedia, Rectangular potential barrier (pointer; cites Griffiths 2nd ed. and Cohen-Tannoudji pp. 231-233), https://en.wikipedia.org/wiki/Rectangular_potential_barrier

  1009. verified Tunneling through one and two barriers by transfer matrices

    and above it sinh⁡(κa)\sinh(\kappa a) becomes sin⁡(qa)\sin(qa) with q=2(E−V0)q = \sqrt{2(E - V_0)} and V0−EV_0 - E becomes E−V0E - V_0.

    Wikipedia gives T^{-1} = 1 + V0^2 sin^2(k1 a)/(4E(E-V0)) for E > V0; the same follows from Liss's formula with kappa = iq, since sinh(iqa) = i sin(qa).

    Wikipedia, Rectangular potential barrier (pointer; cites Griffiths 2nd ed. and Cohen-Tannoudji pp. 231-233), https://en.wikipedia.org/wiki/Rectangular_potential_barrier; T. M. Liss, Physics 486 Lecture 7, The step potential and the square barrier (U. Illinois, 2009), pp. 7-2 to 7-6, https://courses.physics.illinois.edu/phys487/sp2010/486Lectures/lect07.pdf

  1010. not-checkable Tunneling through one and two barriers by transfer matrices

    Nothing in the matrix product enforces that; it comes out only if every matching condition is right.

    Statement about what the program imposes; T+R=1 is checked as a consequence, not imposed.

  1011. plausible Tunneling through one and two barriers by transfer matrices

    With walls of finite height the particle can leak out, so these are not exact states, but near such an energy a wave that gets into the well reflects back and forth between the walls and adds up in phase.

    Resonant tunneling through a double barrier occurs near the quasi-bound levels of the well, where multiple reflections add in phase (Tsu-Esaki/Chang-Esaki-Tsu); papers identified but not read in full.

    R. Tsu and L. Esaki, 'Tunneling in a finite superlattice', Appl. Phys. Lett. 22, 562 (1973); L. L. Chang, L. Esaki, R. Tsu, 'Resonant tunneling in semiconductor double barriers', Appl. Phys. Lett. 24, 593 (1974)

  1012. not-checkable Tunneling through one and two barriers by transfer matrices

    A naive guess for two walls in a row is the product, 0.00942=8.8×10−50.0094^2 = 8.8\times10^{-5}.

    A deliberately naive guess set up to be refuted; 0.0094 is the single wall's 0.936% (tested), and 0.0094^2 = 8.8e-5.

  1013. not-checkable Tunneling through one and two barriers by transfer matrices

    Then it finds the two energies around each peak where T=1/2T = 1/2 by bisection; their distance is the width of the resonance.

    Describes the program's width measurement (full width at T=1/2).

  1014. verified Tunneling through one and two barriers by transfer matrices

    The two walls are identical, so the waves reflected by the far wall and leaking back through the near one cancel the near wall's own reflection exactly at resonance.

    Blanter and Buttiker: resonant peaks come from interference between the barriers, and for a symmetric resonance (Gamma_L = Gamma_R) the peak transmission is 1.

    Ya. M. Blanter and M. Buttiker, Shot Noise in Mesoscopic Conductors, Phys. Rep. 336, 1 (2000), sec. 'Resonant tunnel barriers', eqs. (74)-(75) and Fig. 8, https://arxiv.org/abs/cond-mat/9910158; Wikipedia, Resonant-tunneling diode (pointer; cites D. Bohm, Quantum Theory, 1951), https://en.wikipedia.org/wiki/Resonant-tunneling_diode

  1015. verified Tunneling through one and two barriers by transfer matrices

    The widths grow with the single-wall transmission: a leakier well holds the wave for a shorter time, and a shorter-lived state has a broader resonance.

    Blanter and Buttiker: the partial widths are Gamma_{L,R} = hbar nu T_{L,R}, so the width grows with the single-barrier transmission, and Gamma is the decay width of the quasi-bound level (lifetime ~ hbar/Gamma).

    Ya. M. Blanter and M. Buttiker, Shot Noise in Mesoscopic Conductors, Phys. Rep. 336, 1 (2000), sec. 'Resonant tunnel barriers', eqs. (74)-(75) and Fig. 8, https://arxiv.org/abs/cond-mat/9910158

  1016. not-checkable Tunneling through one and two barriers by transfer matrices

    The single wall is the dashed curve.

    Describes the figure.

  1017. verified The bounce period of an electron trapped in a plasma wave

    In the frame of a large-amplitude plasma wave, an electron near the wave's phase velocity moves like a pendulum.

    O'Neil's abstract describes the resonant electrons' exact motion in the wave (Jacobi elliptic functions), i.e. pendulum motion in the wave frame.

    T. M. O'Neil, 'Collisionless damping of nonlinear plasma oscillations', Phys. Fluids 8, 2255 (1965), abstract https://ui.adsabs.harvard.edu/abs/1965PhFl....8.2255O/abstract

  1018. verified The bounce period of an electron trapped in a plasma wave

    Electrons with speed below 2ωB/k2\omega_B/k at the trough stay in it; faster ones pass over the crests.

    Speed below 2 omega_B/k at the trough keeps the electron trapped; the pendulum separatrix gives the same threshold.

    Energy conservation E=v^2/2-phi0 cos x in the wave frame, separatrix at E=phi0 gives v0=2 sqrt(phi0)=2 omega_B (k=1); checked by hand; Wikipedia, 'Pendulum (mechanics)', large-amplitude period T=(2T0/pi)K(sin(theta0/2)) and series 1+theta0^2/16+11theta0^4/3072, https://en.wikipedia.org/wiki/Pendulum_(mechanics)

  1019. plausible The bounce period of an electron trapped in a plasma wave

    Landau damping is the linear theory of a wave losing energy to the electrons that move at nearly its phase velocity.

    O'Neil's abstract calls Landau's result the linear theory of collisionless damping; the phase-velocity resonance is standard (not accessed beyond the abstract).

    T. M. O'Neil, 'Collisionless damping of nonlinear plasma oscillations', Phys. Fluids 8, 2255 (1965), abstract https://ui.adsabs.harvard.edu/abs/1965PhFl....8.2255O/abstract

  1020. plausible The bounce period of an electron trapped in a plasma wave

    It assumes the wave is small enough that those electrons go straight through it.

    O'Neil states linear theory breaks down after t ~ tau=(m/e eps k)^1/2, i.e. it assumes unperturbed (straight-line) orbits for times short compared to the bounce time.

    T. M. O'Neil, 'Collisionless damping of nonlinear plasma oscillations', Phys. Fluids 8, 2255 (1965), abstract https://ui.adsabs.harvard.edu/abs/1965PhFl....8.2255O/abstract

  1021. plausible The bounce period of an electron trapped in a plasma wave

    O'Neil (Phys. Fluids 8, 2255, 1965) asked what happens when the wave is large: the resonant electrons are caught in its potential troughs and bounce back and forth there, and the damping stops after about one bounce.

    Citation is correct (Phys. Fluids 8, 2255, 1965). The abstract says the damping rate oscillates for t~tau and phase-mixes to zero as t/tau grows, so 'stops after about one bounce' is a loose paraphrase of 'dies away over a few bounce times'.

    T. M. O'Neil, 'Collisionless damping of nonlinear plasma oscillations', Phys. Fluids 8, 2255 (1965), abstract https://ui.adsabs.harvard.edu/abs/1965PhFl....8.2255O/abstract

  1022. plausible The bounce period of an electron trapped in a plasma wave

    In the frame moving with the wave, the potential is static, ϕ(x)=ϕ0cos⁡kx\phi(x) = \phi_0\cos kx, and an electron obeys mx¨=−ekϕ0sin⁡kxm\ddot x = -e k\phi_0 \sin kx.

    Force on charge -e is -(-e)(-dphi/dx)=-e k phi0 sin kx for phi=phi0 cos kx; checked by hand, not accessed in a textbook.

    T. M. O'Neil, 'Collisionless damping of nonlinear plasma oscillations', Phys. Fluids 8, 2255 (1965), abstract https://ui.adsabs.harvard.edu/abs/1965PhFl....8.2255O/abstract

  1023. verified The bounce period of an electron trapped in a plasma wave

    That is the pendulum equation.

    x''=-(e k phi0/m) sin kx has the pendulum form theta''=-(g/l) sin theta.

    Wikipedia, 'Pendulum (mechanics)', large-amplitude period T=(2T0/pi)K(sin(theta0/2)) and series 1+theta0^2/16+11theta0^4/3072, https://en.wikipedia.org/wiki/Pendulum_(mechanics)

  1024. verified The bounce period of an electron trapped in a plasma wave

    A pendulum released from rest at angle θ0\theta_0 has the period

    Pendulum period released from rest at theta0 is given by the complete elliptic integral.

    Wikipedia, 'Pendulum (mechanics)', large-amplitude period T=(2T0/pi)K(sin(theta0/2)) and series 1+theta0^2/16+11theta0^4/3072, https://en.wikipedia.org/wiki/Pendulum_(mechanics)

  1025. verified The bounce period of an electron trapped in a plasma wave

    T=4ωBK(m),m=sin⁡2θ02,T = \frac{4}{\omega_B} K(m), \qquad m = \sin^2\frac{\theta_0}{2},

    Wikipedia: T=(2T0/pi)K(k), k=sin(theta0/2); with T0=2pi/omega_B and parameter m=k^2 this is 4K(m)/omega_B.

    Wikipedia, 'Pendulum (mechanics)', large-amplitude period T=(2T0/pi)K(sin(theta0/2)) and series 1+theta0^2/16+11theta0^4/3072, https://en.wikipedia.org/wiki/Pendulum_(mechanics)

  1026. verified The bounce period of an electron trapped in a plasma wave

    For a small release angle the series K(m)=π2(1+m/4+9m2/64+… )K(m) = \frac{\pi}{2}(1 + m/4 + 9m^2/64 + \dots) gives T=2πωB(1+θ02/16+11θ04/3072+… )T = \frac{2\pi}{\omega_B}\left(1 + \theta_0^2/16 + 11\theta_0^4/3072 + \dots\right): the period grows with amplitude because the restoring force sin⁡x\sin x is weaker than xx.

    Wikipedia gives K series 1+(1/2)^2 m+(3/8)^2 m^2 (=9/64) and T=2pi sqrt(l/g)(1+theta0^2/16+11theta0^4/3072+...).

    Wikipedia, 'Pendulum (mechanics)', large-amplitude period T=(2T0/pi)K(sin(theta0/2)) and series 1+theta0^2/16+11theta0^4/3072, https://en.wikipedia.org/wiki/Pendulum_(mechanics)

  1027. plausible The bounce period of an electron trapped in a plasma wave

    The Verlet run lands within 10−610^{-6} of the elliptic value: its phase error is (ωBΔt)2/24=1.7×10−7(\omega_B\Delta t)^2/24 = 1.7\times10^{-7} of a period, and the test allows twice that.

    For leapfrog on a harmonic oscillator cos(h w~)=1-h^2w^2/2 gives w~=w(1+(wh)^2/24+...), so the relative period error is (w dt)^2/24=1.67e-7 at dt=0.002; the test tolerance is 2*(dt^2/24)*T as stated.

    Hairer, Lubich, Wanner, 'Geometric numerical integration illustrated by the Stormer-Verlet method', Acta Numerica 12 (2003) 399-450, modified frequency cos(h w~)=1-h^2w^2/2, https://www.math.kit.edu/ianm3/lehre/geonumint2009s/media/gni_by_stoermer-verlet.pdf

  1028. verified The bounce period of an electron trapped in a plasma wave

    The only frequency in the problem is ωB=ϕ0\omega_B = \sqrt{\phi_0}, so quadrupling the wave amplitude halves the bounce period at the same release angle.

    The period scales as 1/omega_B with omega_B=sqrt(phi0) at fixed release angle, so 4x phi0 halves it.

    Wikipedia, 'Pendulum (mechanics)', large-amplitude period T=(2T0/pi)K(sin(theta0/2)) and series 1+theta0^2/16+11theta0^4/3072, https://en.wikipedia.org/wiki/Pendulum_(mechanics)

  1029. verified The bounce period of an electron trapped in a plasma wave

    The energy E=v2/2−ϕ0cos⁡xE = v^2/2 - \phi_0\cos x is conserved.

    x''=-phi0 sin x conserves v^2/2-phi0 cos x (pendulum energy).

    Wikipedia, 'Pendulum (mechanics)', large-amplitude period T=(2T0/pi)K(sin(theta0/2)) and series 1+theta0^2/16+11theta0^4/3072, https://en.wikipedia.org/wiki/Pendulum_(mechanics)

  1030. verified The bounce period of an electron trapped in a plasma wave

    The curve E=ϕ0E = \phi_0, v=±2ωBcos⁡(x/2)v = \pm 2\omega_B\cos(x/2), is the separatrix: inside it electrons are trapped and bounce, outside they stream past the crests.

    Setting E=phi0: v^2/2=phi0(1+cos x)=2phi0 cos^2(x/2), so v=+-2 omega_B cos(x/2); the pendulum separatrix; checked by hand.

    Wikipedia, 'Pendulum (mechanics)', large-amplitude period T=(2T0/pi)K(sin(theta0/2)) and series 1+theta0^2/16+11theta0^4/3072, https://en.wikipedia.org/wiki/Pendulum_(mechanics)

  1031. plausible The bounce period of an electron trapped in a plasma wave

    The trapped band is 4ωB/k4\omega_B/k wide in velocity, and it is the electrons in this band that O'Neil's theory follows.

    The separatrix spans v from -2omega_B/k to +2omega_B/k, width 4omega_B/k; O'Neil treats the resonant (trapped) electrons, though his theory also follows the near-resonant untrapped ones.

    T. M. O'Neil, 'Collisionless damping of nonlinear plasma oscillations', Phys. Fluids 8, 2255 (1965), abstract https://ui.adsabs.harvard.edu/abs/1965PhFl....8.2255O/abstract

  1032. not-checkable The bounce period of an electron trapped in a plasma wave

    The boundary comes out at 2ωB2\omega_B to the bisection's tolerance.

    Describes the program's bisection result; the linker covers the number.

  1033. verified The two-stream instability in a particle-in-cell code

    Two cold electron beams passing through each other are unstable.

    Counterstreaming cold beams are unstable to the two-stream instability.

    Wikipedia, 'Two-stream instability' (bunching, trapping, saturation), https://en.wikipedia.org/wiki/Two-stream_instability

  1034. verified The two-stream instability in a particle-in-cell code

    The phase-space film shows the beams rolling up into vortices of trapped electrons, which is where the growth stops.

    Wikipedia: saturation occurs when beam particles are trapped in the wave's field, which is the phase-space vortex structure.

    Wikipedia, 'Two-stream instability' (bunching, trapping, saturation), https://en.wikipedia.org/wiki/Two-stream_instability

  1035. not-checkable The two-stream instability in a particle-in-cell code

    Two beams of electrons move through each other at velocities +v0+v_0 and −v0-v_0, over a fixed background of ions that keeps the plasma neutral on average.

    Describes the setup of this simulation.

  1036. verified The two-stream instability in a particle-in-cell code

    A small ripple in density bunches both beams, the bunches make an electric field, and the field bunches them further.

    Wikipedia describes the self-reinforcing bunching of the beams by the wave field.

    Wikipedia, 'Two-stream instability' (bunching, trapping, saturation), https://en.wikipedia.org/wiki/Two-stream_instability

  1037. verified The two-stream instability in a particle-in-cell code

    The ripple grows exponentially at a rate γ\gamma that linear theory predicts, until electrons are trapped in the wave's potential wells and the growth stops.

    Exponential growth at the linear rate until trapping saturates it, as Wikipedia describes.

    Wikipedia, 'Two-stream instability' (bunching, trapping, saturation), https://en.wikipedia.org/wiki/Two-stream_instability

  1038. plausible The two-stream instability in a particle-in-cell code

    A particle-in-cell (PIC) code follows this with no model beyond Newton's law and Gauss's law.

    An electrostatic PIC code uses only the equations of motion and Poisson/Gauss; the grid and particle shape are numerical choices, not physical models.

    Wikipedia, 'Particle-in-cell' (CIC linear weighting to the two nearest grid points, leapfrog, Birdsall & Langdon 1985), https://en.wikipedia.org/wiki/Particle-in-cell

  1039. not-checkable The two-stream instability in a particle-in-cell code

    For two cold beams at ±v0\pm v_0, each of density n0/2n_0/2, write a=kv0/ωpa = k v_0/\omega_p.

    Defines notation for the post.

  1040. plausible The two-stream instability in a particle-in-cell code

    1=12[1(ω−a)2+1(ω+a)2]1 = \frac12\left[\frac{1}{(\omega - a)^2} + \frac{1}{(\omega + a)^2}\right]

    Matches the cold two-beam dispersion relation (Wikipedia gives the ion-beam variant); the symmetric form checked by hand.

    Hand derivation: each beam of density n0/2 contributes (omega_p^2/2)/(omega-+kv0)^2 to the cold-fluid dielectric; in units omega_p=v0=1, omega in omega_p units; Wikipedia, 'Two-stream instability' (bunching, trapping, saturation), https://en.wikipedia.org/wiki/Two-stream_instability

  1041. verified The two-stream instability in a particle-in-cell code

    γ2=12[8a2+1−(2a2+1)],\gamma^2 = \frac12\left[\sqrt{8a^2 + 1} - (2a^2 + 1)\right],

    Solving the quadratic in omega^2 gives exactly this growth rate.

    Hand algebra from the quartic w^4-(2a^2+1)w^2+a^4-a^2=0: w^2=[(2a^2+1)-+sqrt(8a^2+1)]/2; the negative root gives gamma^2=[sqrt(8a^2+1)-(2a^2+1)]/2, positive iff a<1

  1042. not-checkable The two-stream instability in a particle-in-cell code

    The box is one wavelength of the fastest mode, L=2π/kL = 2\pi/k, with 32 grid cells and 2000 particles, 1000 per beam.

    Describes the program's parameters (inputs).

  1043. plausible The two-stream instability in a particle-in-cell code

    The particles start evenly spaced, a quiet start, with their positions shifted by 10−3sin⁡kx10^{-3}\sin kx so that only the one mode is seeded.

    A quiet (evenly spaced) start with a single sinusoidal displacement seeds one mode; standard practice from Birdsall & Langdon, not accessed in the book.

    Wikipedia, 'Particle-in-cell' (CIC linear weighting to the two nearest grid points, leapfrog, Birdsall & Langdon 1985), https://en.wikipedia.org/wiki/Particle-in-cell

  1044. plausible The two-stream instability in a particle-in-cell code

    With random positions the instability would grow out of noise in every mode at once, and the fit below would need far more particles.

    Random loading gives noise at 1/sqrt(N) in all modes; not accessed; from general knowledge.

    Wikipedia, 'Particle-in-cell' (CIC linear weighting to the two nearest grid points, leapfrog, Birdsall & Langdon 1985), https://en.wikipedia.org/wiki/Particle-in-cell

  1045. verified The two-stream instability in a particle-in-cell code

    Each particle's charge is shared between the two nearest grid points in proportion to how close it is (cloud-in-cell).

    CIC shares a particle's charge with the two nearest grid points with linear weights.

    Wikipedia, 'Particle-in-cell' (CIC linear weighting to the two nearest grid points, leapfrog, Birdsall & Langdon 1985), https://en.wikipedia.org/wiki/Particle-in-cell

  1046. plausible The two-stream instability in a particle-in-cell code

    Gauss's law dE/dx=ρdE/dx = \rho, integrated along the grid by the trapezoid rule; the mean of EE is removed, since a periodic box has no net field.

    In a periodic box the mean field is set to zero since the net charge is zero and the potential is periodic; not accessed in a text; from general knowledge.

    Wikipedia, 'Particle-in-cell' (CIC linear weighting to the two nearest grid points, leapfrog, Birdsall & Langdon 1985), https://en.wikipedia.org/wiki/Particle-in-cell

  1047. verified The two-stream instability in a particle-in-cell code

    Leapfrog: velocities live at half steps, positions at whole steps, and an electron's acceleration is −E-E.

    Leapfrog stores velocities at half steps and positions at whole steps; with q/m=-1 the acceleration is -E.

    Wikipedia, 'Particle-in-cell' (CIC linear weighting to the two nearest grid points, leapfrog, Birdsall & Langdon 1985), https://en.wikipedia.org/wiki/Particle-in-cell

  1048. not-checkable The two-stream instability in a particle-in-cell code

    The cell runs 250 steps to t=25t = 25.

    Describes the program's step count.

  1049. not-checkable The two-stream instability in a particle-in-cell code

    In the film the two beams are the bright lines at v=±1v = \pm 1.

    Describes the film.

  1050. plausible The two-stream instability in a particle-in-cell code

    They ripple, then fold over each other into vortices: electrons caught in the wave's potential wells, going round at the bounce frequency.

    Trapped electrons circulate in the potential wells at the bounce frequency (O'Neil); description of the film.

    Wikipedia, 'Two-stream instability' (bunching, trapping, saturation), https://en.wikipedia.org/wiki/Two-stream_instability; T. M. O'Neil, 'Collisionless damping of nonlinear plasma oscillations', Phys. Fluids 8, 2255 (1965), abstract https://ui.adsabs.harvard.edu/abs/1965PhFl....8.2255O/abstract

  1051. verified The two-stream instability in a particle-in-cell code

    At that point the field stops growing.

    Growth saturates when particles are trapped.

    Wikipedia, 'Two-stream instability' (bunching, trapping, saturation), https://en.wikipedia.org/wiki/Two-stream_instability

  1052. verified The two-stream instability in a particle-in-cell code

    While the mode is small it grows as eγte^{\gamma t}, so ln⁡∣E1∣\ln|E_1| is a straight line of slope γ\gamma.

    A straight line of slope gamma follows directly from exponential growth.

    Elementary: ln(A e^{gamma t}) = ln A + gamma t

  1053. verified Upwind advection smears the pulse by its modified equation

    On the unit interval with periodic ends, after a time T=1/cT = 1/c the exact solution is the initial condition again, so everything a scheme does to the pulse in one transit is error.

    On a unit periodic interval the exact solution returns after time 1/c; any difference after one transit is scheme error.

    L. H. Hellevik, Numerical Methods for Engineers (NTNU TKT4140), first-order upwind modified equation u_t+a u_x=(a h/2)(1-C)u_xx, stability 0<C<=1, exact shift at C=1, https://leifh.folk.ntnu.no/teaching/tkt4140/._main070.html

  1054. not-checkable Upwind advection smears the pulse by its modified equation

    The pulse is u0(x)=e−((x−0.3)/0.05)2u_0(x) = e^{-((x - 0.3)/0.05)^2} sampled at the cell centers.

    Describes the initial condition used.

  1055. not-checkable Upwind advection smears the pulse by its modified equation

    A separate numpy implementation, posts/refs/upwind-advection-smears-by-its-modified-equation.py, computes the same numbers (output beside it).

    Describes the post's reference script.

  1056. verified Upwind advection smears the pulse by its modified equation

    Upwind takes the space difference from the side the wave comes from.

    First-order upwind takes the one-sided difference from the upstream side.

    L. H. Hellevik, Numerical Methods for Engineers (NTNU TKT4140), first-order upwind modified equation u_t+a u_x=(a h/2)(1-C)u_xx, stability 0<C<=1, exact shift at C=1, https://leifh.folk.ntnu.no/teaching/tkt4140/._main070.html

  1057. verified Upwind advection smears the pulse by its modified equation

    uin+1=uin−ν (uin−ui−1n)=(1−ν) uin+ν ui−1n.u_i^{n+1} = u_i^n - \nu\,(u_i^n - u_{i-1}^n) = (1 - \nu)\,u_i^n + \nu\,u_{i-1}^n.

    Standard upwind update u_j^{n+1}=u_j^n-C(u_j^n-u_{j-1}^n).

    L. H. Hellevik, Numerical Methods for Engineers (NTNU TKT4140), first-order upwind modified equation u_t+a u_x=(a h/2)(1-C)u_xx, stability 0<C<=1, exact shift at C=1, https://leifh.folk.ntnu.no/teaching/tkt4140/._main070.html

  1058. not-checkable Upwind advection smears the pulse by its modified equation

    The second form is the useful one.

    Transition.

  1059. plausible Upwind advection smears the pulse by its modified equation

    roll(u, 1) brings each cell's left neighbor to it, with the last cell wrapping to the first.

    Matches numpy.roll(u, 1) semantics; Viv's roll assumed to follow numpy (not accessed; from general knowledge).

    NumPy documentation, numpy.roll: elements rolled beyond the last position are reintroduced at the first, https://numpy.org/doc/stable/reference/generated/numpy.roll.html

  1060. verified Upwind advection smears the pulse by its modified equation

    Expand uin+1u_i^{n+1} and ui−1nu_{i-1}^n in Taylor series about (xi,tn)(x_i, t_n), substitute into the update, and use the equation itself to trade uttu_{tt} for c2uxxc^2 u_{xx}.

    The modified-equation derivation expands in Taylor series and replaces u_tt by c^2 u_xx, as in the NTNU notes and LeVeque.

    L. H. Hellevik, Numerical Methods for Engineers (NTNU TKT4140), first-order upwind modified equation u_t+a u_x=(a h/2)(1-C)u_xx, stability 0<C<=1, exact shift at C=1, https://leifh.folk.ntnu.no/teaching/tkt4140/._main070.html

  1061. verified Upwind advection smears the pulse by its modified equation

    What is left, to the first order in hh, is the modified equation

    Introduces the modified equation, first order in h.

    L. H. Hellevik, Numerical Methods for Engineers (NTNU TKT4140), first-order upwind modified equation u_t+a u_x=(a h/2)(1-C)u_xx, stability 0<C<=1, exact shift at C=1, https://leifh.folk.ntnu.no/teaching/tkt4140/._main070.html

  1062. verified Upwind advection smears the pulse by its modified equation

    ut+c ux=D uxx,D=c h2(1−ν).u_t + c\,u_x = D\,u_{xx}, \qquad D = \frac{c\,h}{2}(1 - \nu).

    NTNU notes: nu_N=(a h/2)(1-C), matching D=(c h/2)(1-nu).

    L. H. Hellevik, Numerical Methods for Engineers (NTNU TKT4140), first-order upwind modified equation u_t+a u_x=(a h/2)(1-C)u_xx, stability 0<C<=1, exact shift at C=1, https://leifh.folk.ntnu.no/teaching/tkt4140/._main070.html

  1063. plausible Upwind advection smears the pulse by its modified equation

    Diffusion spreads a Gaussian and keeps it Gaussian.

    True on the infinite line.

    Heat kernel: a Gaussian convolved with a Gaussian is Gaussian; not accessed; from general knowledge

  1064. plausible Upwind advection smears the pulse by its modified equation

    Its variance (the second moment of uu, treated as a distribution in xx) grows by 2Dt2Dt, and since the mass is fixed the peak falls as one over the width.

    Standard result for the diffusion equation; peak ~1/width for a Gaussian of fixed mass.

    Heat equation u_t=D u_xx: second moment grows by 2Dt, mass conserved; not accessed; from general knowledge

  1065. verified Upwind advection smears the pulse by its modified equation

    For the variance the prediction is exact, not just first order.

    Variance of a convolution is the sum of variances exactly, so the variance prediction is exact (up to periodic wrap).

    Hand calculation: the update is convolution with a two-point (Bernoulli) kernel, so variances add exactly per step

  1066. verified Upwind advection smears the pulse by its modified equation

    The update (1−ν)ui+νui−1(1 - \nu)u_i + \nu u_{i-1} moves a fraction ν\nu of each cell's content one cell to the right.

    (1-nu)u_i+nu u_{i-1} moves fraction nu of each cell one cell to the right.

    L. H. Hellevik, Numerical Methods for Engineers (NTNU TKT4140), first-order upwind modified equation u_t+a u_x=(a h/2)(1-C)u_xx, stability 0<C<=1, exact shift at C=1, https://leifh.folk.ntnu.no/teaching/tkt4140/._main070.html

  1067. verified Upwind advection smears the pulse by its modified equation

    That is one step of a random walk, which adds ν(1−ν)\nu(1 - \nu) cells squared to the variance; 1/(νh)1/(\nu h) steps add (1−ν)h=2DT(1 - \nu)h = 2DT.

    Arithmetic checks.

    Hand calculation: Bernoulli step variance nu(1-nu) cells^2; 1/(nu h) steps times h^2 gives (1-nu)h=2DT with c=T=1

  1068. plausible Upwind advection smears the pulse by its modified equation

    The peak prediction is only first order, because the random walk's pulse is not an exact Gaussian.

    Plausible explanation; the measured discrepancy is small.

    Central limit theorem: binomial kernel is Gaussian only asymptotically; not accessed; from general knowledge

  1069. not-checkable Upwind advection smears the pulse by its modified equation

    The variance is taken with each cell's displacement from x0x_0 wrapped into [−1/2,1/2)[-1/2, 1/2), so the periodic grid has no seam in the middle of the pulse.

    Describes how the program computes the variance.

  1070. not-checkable Upwind advection smears the pulse by its modified equation

    The variance growth sits on the line 2DT=(1−ν)h2DT = (1 - \nu)h at every one, to rounding.

    Describes the program's result; numbers are handled by the linker.

  1071. verified Upwind advection smears the pulse by its modified equation

    A larger time step means less smearing, up to ν=1\nu = 1; past it the scheme is unstable.

    NTNU notes: numerical viscosity (1-C) decreases with C up to C=1 and the scheme is unstable for C>1.

    L. H. Hellevik, Numerical Methods for Engineers (NTNU TKT4140), first-order upwind modified equation u_t+a u_x=(a h/2)(1-C)u_xx, stability 0<C<=1, exact shift at C=1, https://leifh.folk.ntnu.no/teaching/tkt4140/._main070.html