Skip to main content

Function: fourierSeriesApproximation()

fourierSeriesApproximation(func, options): (x) => number

Defined in: src/mobjects/graphing/fourier.ts:183

Build the truncated Fourier approximation of a real periodic function.

The function is sampled over one period, its discrete coefficients are computed, the numTerms largest are kept, and the returned function evaluates the real part of the partial sum at any x. With numTerms equal to the sample count the approximation reproduces the samples.

Parameters​

func​

(x) => number

The real periodic function y = f(x).

options​

FourierSeriesApproximationOptions = {}

Period, sampling, and term-count options.

Returns​

A function x -> y giving the truncated approximation.

(x): number

Parameters​

x​

number

Returns​

number