Eleven years of daily temperature, measured over this
campus. 4,018 days, nothing thrown away.
Daily maximum at 33.85 N, 35.53 E.
Open-Meteo
ERA5 reanalysis, 2015 to 2025.
The file
is on this site.
One Cosine, Two Numbers
The claim on the last slide was that Fourier is a linear
model. Here is that model, fitted to the real series: $K$ terms, least
squares, nothing else.
$T(t) \approx c + \sum_{k=1}^{K}\left[w_k\sin\frac{2\pi k t}{365.25} + v_k\cos\frac{2\pi k t}{365.25}\right]$
One cosine, two coefficients, eleven years.
Adding terms buys very little after the first: the seasons are close to
a pure tone.
What Is Left Is the Weather
The series after the annual cycle is subtracted.
Taking the season out drops the spread from
6.05 to
2.84 degrees. The first number is
mostly the calendar. The second is the part a forecast has to earn.
Knowing the date is not
skill. If you report an $R^2$ of 0.78 for predicting Beirut's
temperature, you have reported the existence of summer.
Today is like yesterday in a way the calendar
does not explain. That is what the AR models later in this lecture go
after.
The trend here is about +0.11 degrees a year.
Eleven years is too short to call that a climate signal, and long enough
to notice.
Interactive: Fourier Superposition
Target:
- - - target
━ your approximation
| Drag the frequency bars to match the target signal
Short-Time Fourier Transform
What if the frequency content changes over time? Spectrogram of a chirp signal:
$\displaystyle S(t, f) = \left| \int_{-\infty}^{\infty} u(\tau)\, w(\tau - t)\, e^{-2\pi i f \tau}\, d\tau \right|^2$
$u(\tau)$: signal
$w(\tau - t)$: window at time $t$
$e^{-2\pi i f\tau}$: Fourier kernel at frequency $f$
$|\cdot|^2$: power
How the STFT Works
Slide a window along the signal; at each position, compute the Fourier transform:
$\displaystyle S(t, f) = \left| \int_{-\infty}^{\infty} u(\tau)\, w(\tau - t)\, e^{-2\pi i f \tau}\, d\tau \right|^2$
Step by step:
Pick a time $t$. Center the window $w(\tau - t)$ there
Multiply: $u(\tau) \cdot w(\tau - t)$ isolates a local segment
The kernel $e^{-2\pi i f\tau}$ probes for frequency $f$ in that segment
$|\cdot|^2$ gives the power → one pixel of the spectrogram
Repeat for all $t$ and $f$ → full 2D map $S(t,f)$
The window $w$:
A localized bump (e.g. Gaussian, Hann) that selects a short segment of the signal near time $t$.
Wide window → good frequency resolution, poor time resolution Narrow window → good time resolution, poor frequency resolution
This is the uncertainty principle: you cannot have perfect resolution in both time and frequency simultaneously.
General Modal Decomposition
Sines and cosines are one choice. What others exist?
Basis
$\phi_k(t)$
Use case
Fourier
$\sin(k\omega t),\;\cos(k\omega t)$
Periodic signals
Polynomials
$1,\; t,\; t^2,\; t^3,\; \dots$
Smooth trends
Wavelets
localized in time and frequency
Transients, edges
Legendre
$P_k(t)$
Orthogonal on $[-1,1]$
Key property: orthogonality $\langle \phi_i, \phi_j \rangle = \delta_{ij}$ ensures the basis spans the space efficiently. The choice of basis IS your inductive bias.
Physics of Harmonics
Where do sines and cosines come from? The wave equation:
General solution by superposition: $\displaystyle u(x,t) = \sum_{n=1}^{\infty} a_n \sin\!\left(\tfrac{n\pi x}{L}\right) \cos(\omega_n t)$
Linear PDE → each mode satisfies the equation → their sum does too.
1953, Los Alamos. Fermi, Pasta, Ulam, and Tsingou simulated a chain
of masses connected by nonlinear springs on the MANIAC I computer. They expected
energy to spread across all modes (thermalization). Instead, the energy returned
almost perfectly to the initial mode.
One of the earliest examples of computational scientific discovery: a numerical
experiment revealed behavior that no one predicted, launching the study of nonlinear
dynamics and solitons.
From Representation to Prediction
Fourier tells us what's in the signal. But can we predict the next value?
Most candidates are wrong. We want $\boldsymbol{\theta}$ to be sparse. This is the SINDy framework.
Looking Ahead
Next lectures:
Lecture 9: System Identification: fitting coefficients for known equation structures
Lecture 10: SINDy: discovering the equation structure itself from data
Read Brunton, Proctor, Kutz. "Discovering governing equations from data by sparse identification of nonlinear dynamical systems." (2016)
The central thread: the design matrix $\Phi$ and feature vector $\phi$ connect Fourier, AR, logistic maps, and SINDy. It's all linear regression with the right features.
Summary
Method
Feature vector $\phi$
Goal
Fourier
$[\sin(f_k t), \cos(f_k t)]$
Representation
AR(p)
$[u_i, u_{i-1}, \dots]$
Prediction
Logistic Map
$[1, x, x^2]$
Discover map
SINDy
$[1, u, u^2, \sin(u), \dots]$
Discover ODE
Everything is $\boldsymbol{\theta}^\top \phi$. The art is choosing $\phi$.