Fourier Series Calculator — Coefficients, Terms & Partial-Sum Graph

Enter a function and interval, get a₀/2, the aₙ and bₙ tables, the series expression and a live plot of the approximation.

Quick answer: Compute the Fourier series of any f(x) on [−L, L]: a₀, aₙ and bₙ coefficients numerically, the series written out term by term, and a graph of f(x) against its partial sum.

How to use

  1. Type a function of x, e.g. x^2 — supported: sin cos tan asin acos atan sinh cosh tanh exp ln sqrt abs sign floor, π, e, powers with ^.
  2. Set the half-period L (series runs on −L … L) and how many terms N to keep.
  3. Press Compute: the integrals for a₀, aₙ and bₙ run numerically.
  4. Read the series expression and the coefficient table, then compare the graph of f(x) with its N-term partial sum.

About this tool

Any periodic signal — a square wave, a sawtooth, a rectified current — can be written as a sum of sines and cosines, and the Fourier coefficients aₙ and bₙ are what weight each frequency. This calculator computes them numerically for a function you type in, on the symmetric interval [−L, L], using the standard definitions aₙ = (1/L)∫f(x)cos(nπx/L)dx and bₙ = (1/L)∫f(x)sin(nπx/L)dx, each integral evaluated by adaptive Simpson's rule (4,000 subintervals) — accurate to about 6 significant digits for the smooth functions this serves. You choose how many terms to keep; the tool prints a₀/2, the coefficient table with each value rounded, skips terms below 10⁻⁶ in the written series (so cos-heavy functions don't print rows of zeros), and graphs f(x) against the N-term partial sum so the Gibbs phenomenon at jump discontinuities — the overshoot that never dies no matter how many terms you add — is visible instead of just described. Presets for x², |x|, x, x³, square and sawtooth waves give you textbook answers to check the numbers against. The theory behind the coefficients: the Fourier series guide.

FAQ

What is the formula for the Fourier series?
f(x) ≈ a₀/2 + Σₙ [aₙ·cos(nπx/L) + bₙ·sin(nπx/L)] on −L ≤ x ≤ L, with aₙ = (1/L)∫₋Lᴸ f(x)cos(nπx/L)dx and bₙ = (1/L)∫₋Lᴸ f(x)sin(nπx/L)dx. The coefficients measure how much of each frequency lives inside f.
Why is my bₙ zero for an even function?
Because cos × (even) integrates symmetrically to a nonzero value while sin × (even) cancels: even functions (x², |x|, cos x) have only cosine terms, odd functions (x, x³, sign(x)) have only sine terms. The calculator prints both tables either way — a bₙ column of ~10⁻¹⁵ values is rounding noise, not a mistake.
What is the Gibbs phenomenon, exactly?
Near a jump discontinuity the partial sum overshoots by about 9% of the jump, forever — adding terms moves the overshoot closer to the jump but never shrinks it. It is visible in the graph whenever you pick sign(x) or a square wave. This is a property of the Fourier series itself, not numerical error.
How many terms do I need?
It depends on how rough f is. Coefficients shrink like 1/n² for functions with corners (|x|) and like 1/n for functions with jumps (square wave), so accuracy grows slowly: for x² on [−π, π] the 6-term sum is still about 0.61 off at the endpoints (≈6% of π²) but already visually indistinguishable in the middle — the graph shows exactly where. Corners need 20–50 terms for endpoint accuracy; jumps never fully converge (Gibbs). Watch the max-error readout as you raise N.
Can I compute coefficients for a non-symmetric interval?
Enter the half-width as L and shift the function: the tool integrates on [−L, L]. For a signal defined on [0, T], substitute the shifted argument, e.g. f(x + L) — or just use L = T/2 with the function written around zero.
How accurate are the numbers?
Simpson's rule with 4,000 subintervals over [−L, L] gives roughly (Δx)⁴ error — for smooth f that is 10⁻⁸ relative or better, which is why textbook checks like x² on [−π, π] → a₀/2 = π²/3 ≈ 3.2899 and aₙ = 4(−1)ⁿ/n² match to every digit shown. Discontinuous integrands lose some of that accuracy at the jump itself.

Rate this tool

Your rating stays in this browser (local storage) — nothing is sent to any server.

Related tools

🎂

Age Calculator

Calculators

%

Percentage Calculator

Calculators

🏦

EMI / Loan Calculator

Calculators

⚖️

BMI Calculator

Calculators

🎓

CGPA / Percentage Converter

Calculators

📏

Land Area Converter

Calculators

📆

Date Difference Calculator

Calculators

🧁

Cooking Unit Converter

Calculators

🏷️

Unit Price Comparator

Calculators

🐕

Pet Cost Calculator

Calculators

⛽

Fuel Cost Calculator

Calculators

🎓

Grade Calculator

Calculators

📝

Final Exam Grade Calculator

Calculators

📅

Business Days Calculator

Calculators

🔢

Number to Words Converter

Calculators

🧮

Online Calculator

Calculators

📏

Length Converter

Calculators

⚖️

Weight Converter

Calculators

🌡️

Temperature Converter

Calculators

🏎️

Speed Converter

Calculators

🗺️

Area Converter

Calculators

🧪

Volume Converter

Calculators

🎈

Pressure Converter

Calculators

🍳

Cooking Measurement Converter

Calculators

👟

Shoe Size Converter

Calculators

🎲

Random Number Generator

Calculators

🎲

Online Dice Roller

Calculators

🪙

Coin Flip Online

Calculators

🤷

Yes or No Picker

Calculators

⏲️

Online Countdown Timer

Calculators

⏱️

Online Stopwatch

Calculators

🔢

Lucky Number Calculator

Calculators

♈

Zodiac Sign Finder (Star Sign)

Calculators

📈

Biorhythm Calculator

Calculators

🎨

Lucky Color Finder (By Birth Date)

Calculators

🐾

Pet Age Converter (Dog & Cat Years)

Calculators

🥣

Pet Food Calculator (Daily Portions)

Calculators

🎯

GPA Goal Calculator

Calculators

💱

Currency Converter

Calculators

🏛️

Roman Numeral Converter

Calculators

🍅

Pomodoro Timer

Calculators

📐

Aspect Ratio Calculator

Calculators

👥

Age Difference Calculator

Calculators

🌐

Bandwidth Calculator

Calculators

💰

1099 Tax Calculator

Calculators

💰

Annuity Calculator

Calculators

💰

ATS Resume Checker

Calculators

💰

Business Loan Calculator

Calculators

💰

Company Tax Calculator

Calculators

💰

Crypto Tax Calculator

Calculators

💰

CV Maker (Academic Style)

Calculators

💰

Debt Consolidation Loan Calculator

Calculators

💰

Employer Cost Calculator

Calculators

💰

Forex Lot Size Calculator

Calculators

💰

Forex Trade Simulator

Calculators

💰

Freelance Invoice Template

Calculators

💰

Life Insurance Needs Calculator

Calculators

💰

Australia Mortgage Calculator

Calculators

💰

Canada Mortgage Calculator

Calculators

💰

Florida Mortgage Calculator

Calculators

💰

Hawaii Mortgage Calculator

Calculators

💰

Maryland Mortgage Calculator

Calculators

💰

Texas Mortgage Calculator

Calculators

💰

UK Mortgage Calculator

Calculators

💰

Washington Mortgage Calculator

Calculators

💰

Online Will Maker

Calculators

💰

Overtime Calculator

Calculators

💰

Payroll Calculator

Calculators

💰

Georgia Employer Payroll Tax Calculator

Calculators

💰

New York Employer Payroll Tax Calculator

Calculators

💰

North Carolina Employer Payroll Tax Calculator

Calculators

💰

Texas Employer Payroll Tax Calculator

Calculators

💰

Quarterly Tax Calculator

Calculators

💰

Refinance Calculator

Calculators

💰

Resume Score Checker

Calculators

💰

Resume Template (Plain Text)

Calculators

💰

Retirement Investment Calculator

Calculators

💰

Retirement Savings Calculator

Calculators

💰

Reverse Mortgage Calculator

Calculators

💰

Salary Paycheck Calculator

Calculators

💰

Contractor Salary Calculator

Calculators

💰

Self-Employed Tax Calculator California

Calculators

💰

Self-Employed Tax Calculator UK

Calculators

💰

Solar Panel Cost Calculator

Calculators

💰

Stock Market Simulator

Calculators

💰

Federal Tax Calculator

Calculators

💰

Tax Deduction Calculator

Calculators

🧮

Scientific Calculator

Calculators

🎓

A-Level Grade Calculator

Calculators

📝

ACT Score Calculator

Calculators

🏫

SAT Score Calculator

Calculators

🍕

Fraction Calculator

Calculators

📐

Quadratic Equation Solver

Calculators

🐕

Dog Age Calculator

Calculators

⛳

Golf Handicap Calculator

Calculators

🏷️

Stacked Discount Calculator

Calculators

🔢

Mixed Number Calculator

Calculators

✖️

FOIL Calculator

Calculators

🔺

Discriminant Calculator

Calculators

🧮

Gaussian Elimination Calculator

Calculators

📈

Gradient Calculator

Calculators

📐

Diagonal Calculator

Calculators

Related Tools & Guides

Anniversary Gift Finder Annuity Calculator Area Converter Arr Calculator Aspect Ratio Calculator Audio Converter