Skip to main content

Function: orderCoefficients()

orderCoefficients(coefficients, order): FourierCoefficient[]

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

Return a reordered copy of the coefficients for the vector chain.

  • 'amplitude' (best approximation per term): largest amplitude first; ties broken by smaller |freq|, then by larger signed freq.
  • 'frequency' (the iconic 3Blue1Brown look): 0, +1, -1, +2, -2, …; that is, smaller |freq| first, positive before negative within a |freq|.

The input array is not mutated.

Parameters​

coefficients​

FourierCoefficient[]

Coefficients to order.

order​

FourierOrder = 'frequency'

Ordering strategy. Default 'frequency'.

Returns​

FourierCoefficient[]

A new, reordered array.