Skip to main content

Function: partialSum()

partialSum(coefficients, t, numTerms): Complex

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

Sum only the first numTerms coefficients at normalized time t.

This is the partial reconstruction that an FourierEpicycles pen traces when it shows numTerms vectors: it equals the tip of the vector chain.

Parameters​

coefficients​

FourierCoefficient[]

Ordered coefficients; the first numTerms are summed.

t​

number

Normalized time; one full period spans t ∈ [0, 1).

numTerms​

number

How many leading coefficients to include. Clamped to [0, length].

Returns​

Complex

The summed complex value. numTerms <= 0 yields { re: 0, im: 0 }.