# Every thing is a sin()

December 1st 2022 -

Draft

In this second blog post I'm going to explain *Fourier series* from the perspective of a developper who doesn't really understand mathematics.

What do heat transfer, music, SVG, and Wi-Fi have in common? In 1807 Fourier wrote "*Treatise on the propagation of heat in solid bodies*" and it made a lot nerds happy.

## Inanimate carbon rod

We'll start by looking at this rod with an infrared camera:

If we graph the temperature we get a beautifiul sine wave:

Let's measure the rod temperature while it cools off:

Fourier found that for a perfect sine wave like ours, we can get the temperature over time using this formula:

$\cos(\omega x)e^{-k\omega^2t}$

In the programming world we can translate this to the following code currently running on your graphic card:

```
float curve(float x, float t) {
float o = 2 * pi; // omega: adjust frequency
float k = 1; // conductivity: adjust how fast heat propagates
return cos(o * x) * exp(-k * o * o * t);
}
```

`ω`

: angle in radians` * π`

`k`

: how fast heat propagatesNow here is what happens when we make contact between a hot rod and a cold rod:

How can we compute the heat flow in this case? We have a formula for sine waves, but what we have here is a square wave.