Taylor Series Calculator

Taylor polynomial of f(x) around a point a

Build the Taylor polynomial of a function \(f(x)\) around a point \(a\) up to degree \(n\). The tool approximates derivatives numerically, computes coefficients, writes the polynomial explicitly, and compares \(f(x)\) with its Taylor approximation at a chosen point and on a plot.

Ideal for students, instructors and engineers who want a transparent, step-by-step Taylor expansion, not just a black-box answer.

1. Define the function and expansion

Use x, operators +, -, *, /, ^, and functions sin, cos, tan, exp, log, sqrt, etc.

Set \(a = 0\) for a Maclaurin series.

Higher degree ⇒ usually better approximation near \(a\), but more terms.

If set, the calculator compares \(f(x)\) and \(P_n(x)\).

Quick examples:

2. Polynomial, values and error

Taylor polynomial \(P_n(x)\)
\(f(x)\) at evaluation point
Exact function value (if x is provided)
\(P_n(x)\) and |error|
Approximation and absolute error

3. Plot of \(f(x)\) and its Taylor approximation

The plot shows the original function \(f(x)\) and the Taylor polynomial \(P_n(x)\) on an interval centred at \(a\). By default the interval is \([a - 2, a + 2]\); if \(|x - a|\) is larger, the interval is enlarged to include the evaluation point.

f(x) Pn(x)

4. Derivatives and coefficients table

Each row shows the numerical estimate of the \(k\)-th derivative at \(a\), the coefficient \(a_k = \frac{f^{(k)}(a)}{k!}\), and the corresponding term of the polynomial.

k f(k)(a) k! ak Term ak(x−a)k

Definition of Taylor series and Taylor polynomial

Let \(f\) be a function that is differentiable many times near a point \(a\). The Taylor series of \(f\) at \(a\) is the formal series

\[ f(x) \sim \sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k!}(x-a)^k, \]

where \(f^{(k)}(a)\) is the \(k\)-th derivative of \(f\) at \(a\) and \(k!\) is the factorial of \(k\). The Taylor polynomial of degree \(n\) is the partial sum

\[ P_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}(x-a)^k. \]

For many standard functions (polynomials, exponentials, trigonometric and logarithmic functions on suitable intervals) the Taylor series converges to \(f(x)\) in a neighbourhood of \(a\). The polynomial \(P_n(x)\) is the best local polynomial approximation of degree \(n\) determined by the derivatives at \(a\).

Remainder term and approximation error

When the Taylor series converges, it is useful to write

\[ f(x) = P_n(x) + R_n(x), \]

where \(R_n(x)\) is the remainder term. Under suitable smoothness conditions one has the Lagrange form

\[ R_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!}(x-a)^{n+1} \] for some \(\xi\) lying between \(a\) and \(x\). Although \(\xi\) is usually unknown, bounds on \(f^{(n+1)}\) make it possible to estimate \(|R_n(x)|\).

In this calculator, the numerical error at a specific point \(x\) is simply computed as \(|f(x) - P_n(x)|\).

Maclaurin series as a special case

If \(a = 0\), the Taylor series is called a Maclaurin series:

\[ f(x) = \sum_{k=0}^{\infty} \frac{f^{(k)}(0)}{k!} x^k. \]

Many classic expansions are Maclaurin series, for example

  • \(e^x = 1 + x + \dfrac{x^2}{2!} + \dfrac{x^3}{3!} + \dots\)
  • \(\sin x = x - \dfrac{x^3}{3!} + \dfrac{x^5}{5!} - \dots\)
  • \(\cos x = 1 - \dfrac{x^2}{2!} + \dfrac{x^4}{4!} - \dots\)

FAQ: using the Taylor series calculator

1. Which functions can I enter?

You can enter any function that can be evaluated numerically, for example: exp(x), sin(x), cos(x), log(1 + x), x^3 - 2*x + 1. The calculator builds a JavaScript function from your expression and uses numerical differentiation.

2. Why do very high degrees sometimes look unstable?

High-order numerical derivatives are sensitive to rounding errors. For large degrees or functions with rapid oscillations, coefficients can become inaccurate. In practice, it is wise to keep \(n \leq 10\) and check the plot and error to ensure the approximation behaves as expected.

3. How should I choose the expansion point a?

The Taylor polynomial gives the best approximation near the expansion point. If you want a good approximation around \(x = x_0\), choose \(a\) close to \(x_0\). A Maclaurin series (\(a = 0\)) is convenient when the function is easily differentiable at 0 and you care about behaviour near the origin.

4. Does the series converge for every x?

No. Each Taylor series has a radius of convergence, which can be finite. Outside that radius the series may diverge, even if the function itself is defined. This calculator focuses on computing partial sums; convergence analysis is a separate theoretical step.