maclaurin series expansion calculator

Maclaurin Series Expansion Calculator

Choose a function, set the polynomial degree n, and enter a value of x to approximate f(x) using its Maclaurin polynomial.

What is a Maclaurin series?

A Maclaurin series is a special case of the Taylor series centered at x = 0. It rewrites a function as an infinite polynomial:

f(x) = f(0) + f’(0)x + f’’(0)x2/2! + f(3)(0)x3/3! + ...

In practice, we usually keep only the first few terms (degree n). That finite polynomial is called a Maclaurin approximation or partial sum. It is often much easier to evaluate than the original function.

How this calculator works

  • Select a built-in function such as e^x, sin(x), or ln(1+x).
  • Pick a maximum degree n.
  • Enter a specific x value.
  • Click Calculate Expansion to see:
    • The Maclaurin polynomial Pn(x)
    • The approximation Pn(x) at your x
    • The exact function value (when defined)
    • Absolute and relative error
    • A term-by-term table

Supported functions and series patterns

1) Exponential

e^x = 1 + x + x2/2! + x3/3! + ...

2) Sine and cosine

sin(x) = x - x3/3! + x5/5! - ...
cos(x) = 1 - x2/2! + x4/4! - ...

3) Natural log near zero

ln(1+x) = x - x2/2 + x3/3 - x4/4 + ... for |x| < 1 (with endpoint behavior that needs care).

4) Geometric function

1/(1-x) = 1 + x + x2 + x3 + ... for |x| < 1.

5) Inverse tangent and hyperbolic functions

arctan(x) = x - x3/3 + x5/5 - ...
sinh(x) = x + x3/3! + x5/5! + ...
cosh(x) = 1 + x2/2! + x4/4! + ...

Convergence and accuracy tips

  • Higher degree usually improves accuracy near x = 0.
  • For functions with finite radius of convergence, accuracy can break down outside that radius.
  • At large |x|, you often need many terms to get a good approximation.
  • Alternating series (like sin, cos, arctan, ln(1+x)) often provide useful error intuition.

Example workflow

Suppose you choose sin(x), set n = 7, and use x = 0.5. The calculator returns a polynomial up to x7, evaluates it, then compares that value against JavaScript’s exact Math.sin(0.5). You can then raise n to 9, 11, and so on to watch error shrink.

Why Maclaurin expansions matter

Maclaurin polynomials are foundational in numerical analysis, differential equations, physics, machine learning, and engineering. They help convert hard functions into finite algebra, making computation and analysis more tractable.

🔗 Related Calculators