Compute the Taylor (or Maclaurin) polynomial of any order for a given function f(x) around any expansion point a. Visualize the approximation, inspect coefficients, and understand convergence — an essential tool for calculus, numerical analysis, and physics.
A Taylor series represents a function as an infinite sum of terms calculated from its derivatives at a single point. For a smooth function f(x), the Taylor expansion around x = a is:
The Taylor polynomial of degree N truncates the series after the Nth term, providing a local polynomial approximation. This is the foundation of numerical methods, optimization, and physical modeling. The polynomial becomes increasingly accurate near x = a as N grows (within the radius of convergence).
Our calculator uses symbolic differentiation via math.js to compute exact derivatives f(k)(x) up to the specified order. It then evaluates each derivative at the expansion point a and divides by k! to obtain coefficient ck. The final polynomial is reconstructed as Σ ck (x-a)k. This approach delivers exact rational coefficients where possible (e.g., for sin, exp). For interactive exploration, the graph renders both the original function and the Taylor polynomial over an adaptive interval around a, allowing you to see the quality of approximation and the effect of increasing N.
The error (remainder) is governed by the Lagrange or Cauchy form, and the radius of convergence depends on the function’s analytic structure. For common functions like e^x, sin(x), cos(x) the series converges ∀x; for others like ln(1+x) the convergence radius is limited to |x-a| < 1 (if a=0).
The relativistic kinetic energy formula K = mc²(γ - 1) with γ = 1/√(1-v²/c²). Expanding K as a Taylor series in β = v/c around 0 yields K ≈ ½ mv² + ⅜ mv⁴/c² + ... The first term recovers classical kinetic energy, while higher terms provide relativistic corrections. This series is vital for particle accelerators and GPS satellite timing adjustments. Our tool can model f(x) = (1/sqrt(1-x²)-1) and observe the classical limit.
sin(x), exp(x), tanh(x)).
When a = 0, the Taylor series is called a Maclaurin series. Many fundamental series are Maclaurin expansions: ex = Σ xk/k!, sin(x) = Σ (-1)k x2k+1/(2k+1)!, cos(x) = Σ (-1)k x2k/(2k)! and ln(1+x) = Σ (-1)k+1 xk/k for |x|<1.
While Taylor polynomials provide excellent local approximations, they may diverge far from the center or for functions with singularities. Moreover, for non-analytic functions (e.g., f(x)=e-1/x² for x≠0), the Taylor series at 0 yields zero but fails to represent the function. The graph will visually reveal poor approximation outside the radius of convergence – a powerful learning experience.
| Function | Expansion point a | Radius of convergence | Typical behavior |
|---|---|---|---|
| e^x | 0 | ∞ | Converges everywhere |
| sin(x), cos(x) | 0 | ∞ | Converges everywhere |
| ln(1+x) | 0 | 1 | Converges only for |x|<1 |
| 1/(1-x) | 0 | 1 | Geometric series converges strictly inside unit disk |
| sqrt(1+x) | 0 | 1 | Converges for |x|≤1 (binomial) |