What does Koopman Modes for Audience Turning Points conclude, in numbers, about “The Koopman Operator: Lifting Nonlinear Dynamics into Linear Ones, and the Limits of the Lift”?
Answer: Chapter 2 explains how a nonlinear system is lifted into a linear one, how a forced fit in raw coordinates gives a distorted eigenvalue of 0.744427, and why chaotic orbits have no finite set of modes.
Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (19 programs), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.744427
| raw (x1, x2) eigenvalues 0.900000 0.744427 | |
| worst |x2 error|, 20 steps from x1 | 2.5: 2.80 |
| lifted (x1, x2, x1^2) eigenvalues 0.900000 0.810000 0.500000 | |
| worst |x2 error|, 20 steps from x1 | 2.5: 1.33e-15 |
| x2 after 3 steps from x1 | 2.5: 3.2778 |
Show the full program
# Chapter 2. p21: one nonlinear term, and a finite Koopman lift removes it.
# Model (illustrative): traffic x1 decays by 0.9 a step; orders x2 keep
# 0.5 of themselves and gain 0.4 * x1^2 from interaction, so
# x1' = 0.9 x1, x2' = 0.5 x2 + 0.4 x1^2.
# The observables (x1, x2, x1^2) span a Koopman-invariant subspace: on it
# the map is exactly linear with eigenvalues 0.9, 0.5 and 0.81 (Brunton
# et al. 2016 use the continuous-time twin). We fit least-squares linear
# maps on raw and lifted coordinates from the same 5 short trajectories
# and forecast 20 steps from a start outside the training range.
import math
import cmath
def dot(a, b):
return math.fsum(x * y for x, y in zip(a, b))
def matmul(a, b):
bt = list(zip(*b))
return [[dot(r, c) for c in bt] for r in a]
def transpose(a):
return [list(r) for r in zip(*a)]
def inv(a):
# Gauss-Jordan 求逆(部分主元),只用于小矩阵
n = len(a)
m = [list(map(float, a[i])) + [1.0 if i == j else 0.0
for j in range(n)] for i in range(n)]
for c in range(n):
p = max(range(c, n), key=lambda i: abs(m[i][c]))
m[c], m[p] = m[p], m[c]
pv = m[c][c]
m[c] = [q / pv for q in m[c]]
for i in range(n):
if i != c:
f = m[i][c]
m[i] = [q - f * w for q, w in zip(m[i], m[c])]
return [row[n:] for row in m]
def charpoly(a):
# Faddeev-LeVerrier:特征多项式 z^n + c1 z^(n-1) + c2 z^(n-2) 直到 cn
n = len(a)
m = [[0.0] * n for _ in range(n)]
coef = [1.0]
for k in range(1, n + 1):
m = matmul(a, m)
for i in range(n):
m[i][i] += coef[-1]
am = matmul(a, m)
coef.append(-math.fsum(am[i][i] for i in range(n)) / k)
return coef
def roots(coef):
# Durand-Kerner 同时迭代求全部复根(cmath)
n = len(coef) - 1
z = [cmath.rect(0.9, 0.4 + 2.0 * math.pi * k / n) for k in range(n)]
def p(x):
r = complex(1.0, 0.0)
for c in coef[1:]:
r = r * x + c
return r
for _ in range(800):
new = []
for i in range(n):
den = complex(1.0, 0.0)
for j in range(n):
if j != i:
den *= z[i] - z[j]
new.append(z[i] - p(z[i]) / den)
moved = max(abs(a - b) for a, b in zip(new, z))
z = new
if moved < 1e-14:
break
return z
def eigvals(a):
z = roots(charpoly(a))
z = [complex(w.real, 0.0) if abs(w.imag) < 1e-12 else w for w in z]
return sorted(z, key=lambda w: (-round(abs(w), 9), w.imag))
def step(s):
x1, x2 = s
return (0.9 * x1, 0.5 * x2 + 0.4 * x1 * x1)
def lift(s):
return [s[0], s[1], s[0] * s[0]]
def fit(pairs, obs):
# A = Y X^T (X X^T)^-1,最小二乘线性映射
xs = transpose([obs(p) for p, q in pairs])
ys = transpose([obs(q) for p, q in pairs])
xt = transpose(xs)
return matmul(matmul(ys, xt), inv(matmul(xs, xt)))
pairs = []
for start in ((1.0, 0.0), (-1.0, 0.5), (0.5, 1.0), (1.5, -0.5),
(-0.8, -1.0)):
s = start
for _ in range(8):
n = step(s)
pairs.append((s, n))
s = n
for name, obs in (("raw (x1, x2)", lambda s: [s[0], s[1]]),
("lifted (x1, x2, x1^2)", lift)):
a = fit(pairs, obs)
lam = sorted((round(z.real, 6) for z in eigvals(a)), reverse=True)
s, z = (2.5, 0.0), obs((2.5, 0.0))
worst = 0.0
for k in range(20):
s = step(s)
z = [math.fsum(a[i][j] * z[j] for j in range(len(z)))
for i in range(len(z))]
worst = max(worst, abs(z[1] - s[1]))
print("%-22s eigenvalues %s" % (name, " ".join("%.6f" % q
for q in lam)))
fmt = "%.2e" if worst < 1e-3 else "%.2f"
print("%-22s worst |x2 error|, 20 steps from x1 = 2.5: " % ""
+ fmt % worst)
print("x2 after 3 steps from x1 = 2.5: %.4f" % step(step(step(
(2.5, 0.0))))[1])Single source and citation
Fan, Y. (2026). Koopman Operators and Dynamic Mode Decomposition: Linearising Nonlinear Cash-Flow Swings and Forecasting Turning Points in Livestream Audience Curves (Version 1.0.0), Chapter 2: The Koopman Operator: Lifting Nonlinear Dynamics into Linear Ones, and the Limits of the Lift. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-238 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026238,
author = {Fan, Yafu},
title = {Koopman Operators and Dynamic Mode Decomposition: Linearising Nonlinear Cash-Flow Swings and Forecasting Turning Points in Livestream Audience Curves},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Two or Three Modes: the Low-Rank Structure of a Livestream Audience Curve and the Built-In Lag of Moving Averages
- Chapter 3 · Jacobi Rotations: Symmetric Eigendecomposition and the Singular Value Decomposition with the Standard Library Alone
- Chapter 4 · Dynamic Mode Decomposition: Eigenvalues, Amplitudes and the False Decay Caused by Noise
- Chapter 5 · Lead Time at the Turning Point: a Mode-Based Warning Every Five Minutes against Moving Averages
- Chapter 6 · Cash Flow: Linearising Daily, Weekly and Monthly Swings with Modes, and Choosing the Observable
- Chapter 7 · East and West in the Sources: "Knowing the Incipient" in the Book of Changes and Fourier's Analysis of Heat
- Chapter 8 · Closing the Empirical Loop: a Mode Fit Every Five Minutes, a Cooling Warning and a Pre-Registered Test