# Revision history [back]

### How derive minimization frequencies formula ?

Fourier DFT transformation of sawtooth wave (0, a, 2 a, 3a..a*(N-1).) has coefficients

$a \frac{N(N+1)}{2}, k=0$

$-a \frac{N}{1-e^{-j2\pi k/N}}$, $k\in [1,N-1]$

I want remove it from samples, but I must compute optimal slope a.

X means Fourier transformation of samples, S - Fourier transformation of sawtooth wave

Slope is optimal when difference (X-S) has minimum high frequencies <=>

$\sum_{frequencies} (frequency \cdot amplitude^2)$ is minimal.

Maybe better $\sum_{frequencies} (frequency^2 \cdot amplitude^2)$ is minimal.

I must equate to zero the derivative of this sum and compute slope a. How do it with SageMath?

### How derive minimization frequencies formula ?

Fourier DFT transformation of sawtooth wave (0, a, 2 a, 3a..a*(N-1).) has coefficients

$a \frac{N(N+1)}{2}, k=0$

$-a \frac{N}{1-e^{-j2\pi k/N}}$, $k\in [1,N-1]$

https://dsp.stackexchange.com/questions/34309/expression-for-discrete-fourier-transform-of-linear-ramp

I want remove it from samples, but I must compute optimal slope a.

X means Fourier transformation of samples, S - Fourier transformation of sawtooth wave

Slope is optimal when difference (X-S) has minimum high frequencies <=>

$\sum_{frequencies} (frequency \cdot amplitude^2)$ is minimal.

Maybe better $\sum_{frequencies} (frequency^2 \cdot amplitude^2)$ is minimal.

I must equate to zero the derivative of this sum and compute slope a. How do it with SageMath?