Skip to content

FourierSeries ​

The order-nn complex exponential Fourier series of ff on [−π,π][-\pi, \pi], ∑k=−nnck eikx\sum_{k=-n}^{n} c_k\, e^{ikx}, each ckc_k from FourierCoefficient.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageFourierSeries!
FourierSeries(f, x, n)the order-nn Fourier series of f(x)f(x) on [−π,π][-\pi, \pi], for a nonnegative integer nn.
Typed signatures
TypePackageApplies
(expression, expression, integer<0..>) -> expressionanalyticalways

Domain: Transforms

Details
  • Built entirely from closed forms, not a call through compute-engine's own Integrate — probing found Integrate both too weak to reach most of these forms (it declines x^2 * Cos(2x) outright) and, worse, silently wrong on one it does answer (Integrate(Abs(x) * Exp(-ix), {x, -pi, pi}) comes back exactly half of what an independent numeric quadrature gives). See FourierCoefficient for exactly what's covered.
  • Always period 2π2\pi on [−π,π][-\pi, \pi], matching Wolfram's own default — there's no period argument here.

Examples

Basic #

The order-2 series of the sawtooth xx — every ckc_k nonzero, none of it collapses

live ↗
InFourierSeries(x,x,2)\mathrm{FourierSeries}(x, x, 2)Out−iexp⁡(ix)+(−12i)exp⁡(−2ix)+12iexp⁡(2ix)+iexp⁡(−ix)-i\exp(i x)+(-\frac{1}{2}i)\exp(-2i x)+\frac{1}{2}i\exp(2i x)+i\exp(-i x)

A truncated series of t/2t/2 with a few exponential terms

live ↗
InFourierSeries(t2,t,3)\mathrm{FourierSeries}(\frac{t}{2}, t, 3)Out(−12i)exp⁡(it)+(−14i)exp⁡(−2it)+(−16i)exp⁡(3it)+16iexp⁡(−3it)+14iexp⁡(2it)+12iexp⁡(−it)(-\frac{1}{2}i)\exp(i t)+(-\frac{1}{4}i)\exp(-2i t)+(-\frac{1}{6}i)\exp(3i t)+\frac{1}{6}i\exp(-3i t)+\frac{1}{4}i\exp(2i t)+\frac{1}{2}i\exp(-i t)
Scope #

sin⁡(x)\sin(x) is already band-limited to k=±1k = \pm1, so raising the order past 1 adds nothing

live ↗
InFourierSeries(sin⁡(x),x,3)\mathrm{FourierSeries}(\sin(x), x, 3)Out(−12i)exp⁡(ix)+12iexp⁡(−ix)(-\frac{1}{2}i)\exp(i x)+\frac{1}{2}i\exp(-i x)

cos⁡2(x)=12+14e2ix+14e−2ix\cos^2(x) = \tfrac12 + \tfrac14 e^{2ix} + \tfrac14 e^{-2ix}, via the binomial expansion, not integration

live ↗
InFourierSeries(cos⁡(x)2,x,2)\mathrm{FourierSeries}(\cos(x)^2, x, 2)Out14(exp⁡(−2ix))+14(exp⁡(2ix))+12\frac{1}{4}(\exp(-2i x))+\frac{1}{4}(\exp(2i x))+\frac{1}{2}

Order 0 is just c0c_0, the average value π2/3\pi^2/3

live ↗
InFourierSeries(x2,x,0)\mathrm{FourierSeries}(x^2, x, 0)Outπ23\frac{π^2}{3}

The series of ∣t∣|t| has a constant and 1/k21/k^2 odd terms

live ↗
InFourierSeries(∣t∣,t,2)\mathrm{FourierSeries}(\vert t\vert, t, 2)Out−1π(2exp⁡(−it))−1π(2exp⁡(it))+π2-\frac{1}{π}(2\exp(-i t))-\frac{1}{π}(2\exp(i t))+\frac{π}{2}
live ↗
InFourierSeries(exp⁡(−t),t,3)\mathrm{FourierSeries}(\exp(-t), t, 3)Out1π((−12−12i)sinh⁡(π)exp⁡(−it))+1π((15−25i)sinh⁡(π)exp⁡(2it))+1π((−110−310i)sinh⁡(π)exp⁡(−3it))+1π((−110+310i)sinh⁡(π)exp⁡(3it))+1π((15+25i)sinh⁡(π)exp⁡(−2it))+1π((−12+12i)sinh⁡(π)exp⁡(it))+sinh⁡(π)π\frac{1}{π}((-\frac{1}{2}-\frac{1}{2}i)\sinh(π)\exp(-i t))+\frac{1}{π}((\frac{1}{5}-\frac{2}{5}i)\sinh(π)\exp(2i t))+\frac{1}{π}((-\frac{1}{10}-\frac{3}{10}i)\sinh(π)\exp(-3i t))+\frac{1}{π}((-\frac{1}{10}+\frac{3}{10}i)\sinh(π)\exp(3i t))+\frac{1}{π}((\frac{1}{5}+\frac{2}{5}i)\sinh(π)\exp(-2i t))+\frac{1}{π}((-\frac{1}{2}+\frac{1}{2}i)\sinh(π)\exp(i t))+\frac{\sinh(π)}{π}
Possible issues #

Declines a polynomial-times-trig product like xcos⁡(x)x\cos(x) -- Wolfram has a closed form here, but it falls outside the atoms this covers (see FourierCoefficient)

live ↗
InFourierSeries(xcos⁡(x),x,1)\mathrm{FourierSeries}(x\cos(x), x, 1)OutFourierSeries(xcos⁡(x),x,1)\mathrm{FourierSeries}(x\cos(x), x, 1)
About
Examples8
Checked againstWolfram Language 7 agree1 differ
CrosswalkWolfram Language

Implementation

primitive · kernela kernel — an algorithm over mutable state that would not be readable as a tree

nativeenginetypescriptpackages/symbols/analysis/analytic/src/fourier-series.ts

See also: FourierCoefficient, Fourier