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−ieix+(−12i)e−2ix+12ie2ix+ie−ix-ie^{i x}+(-\frac{1}{2}i)e^{-2i x}+\frac{1}{2}ie^{2i x}+ie^{-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)eit+(−14i)e−2it+(−16i)e3it+16ie−3it+14ie2it+12ie−it(-\frac{1}{2}i)e^{i t}+(-\frac{1}{4}i)e^{-2i t}+(-\frac{1}{6}i)e^{3i t}+\frac{1}{6}ie^{-3i t}+\frac{1}{4}ie^{2i t}+\frac{1}{2}ie^{-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)eix+12ie−ix(-\frac{1}{2}i)e^{i x}+\frac{1}{2}ie^{-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)Out14e−2ix+14e2ix+12\frac{1}{4}e^{-2i x}+\frac{1}{4}e^{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π×2e−it−1π×2eit+π2-\frac{1}{π}×2e^{-i t}-\frac{1}{π}×2e^{i t}+\frac{π}{2}
live ↗
InFourierSeries(e−t,t,3)\mathrm{FourierSeries}(e^{-t}, t, 3)Out1π(−12−12i)sinh⁡(π)e−it+1π(15−25i)sinh⁡(π)e2it+1π(−110−310i)sinh⁡(π)e−3it+1π(−110+310i)sinh⁡(π)e3it+1π(15+25i)sinh⁡(π)e−2it+1π(−12+12i)sinh⁡(π)eit+sinh⁡(π)π\frac{1}{π}(-\frac{1}{2}-\frac{1}{2}i)\sinh(π)e^{-i t}+\frac{1}{π}(\frac{1}{5}-\frac{2}{5}i)\sinh(π)e^{2i t}+\frac{1}{π}(-\frac{1}{10}-\frac{3}{10}i)\sinh(π)e^{-3i t}+\frac{1}{π}(-\frac{1}{10}+\frac{3}{10}i)\sinh(π)e^{3i t}+\frac{1}{π}(\frac{1}{5}+\frac{2}{5}i)\sinh(π)e^{-2i t}+\frac{1}{π}(-\frac{1}{2}+\frac{1}{2}i)\sinh(π)e^{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