Maclaurin Series Calculator


Maclaurin Series Calculator

Approximate functions like sin(x), cos(x), and e^x using polynomial expansions centered at zero. This powerful tool helps visualize how simple polynomials can represent complex functions.



Select the function you want to approximate.


The point at which to evaluate the function. For sin(x) and cos(x), this value is in radians.


The number of terms in the polynomial approximation (degree of the polynomial). More terms generally mean better accuracy.

Approximation:

0.84147

Intermediate Values & Comparison

The table below shows each term of the Maclaurin series and the running total of the approximation.


Term (k) Term Value Cumulative Sum

Chart: Blue line is the true function. Red line is the Maclaurin approximation.

What is a Maclaurin Series?

A Maclaurin series is a special type of Taylor series expansion of a function where the expansion is centered around zero. It represents a function as an infinite sum of terms, calculated from the values of the function’s derivatives at a single point (x=0). In essence, this powerful mathematical tool allows us to approximate complex functions, such as trigonometric (sin, cos) or exponential (e^x) functions, using simpler polynomial functions. The more terms you include from the series, the closer the polynomial’s graph gets to the original function’s graph around x=0.

This maclaurin series calculator is designed for students, engineers, and scientists who need to understand and apply these approximations. It is particularly useful for visualizing how a function can be built from a series of simpler polynomial terms and for understanding approximation errors.

The Maclaurin Series Formula

The general formula for the Maclaurin series of a function f(x) is given by:

f(x) ≈ ∑ [ (f(n)(0) / n!) * xn ] for n = 0 to ∞

This breaks down to:

f(x) ≈ f(0) + f'(0)x + (f”(0)/2!)x2 + (f”'(0)/3!)x3 + …

Variables Explained

Description of variables in the Maclaurin series formula.
Variable Meaning Unit Typical Range
f(n)(0) The n-th derivative of the function f, evaluated at x=0. Unitless (for these functions) Depends on the function (e.g., cycles through 0, 1, -1 for sin/cos).
n! The factorial of n (e.g., 3! = 3 * 2 * 1 = 6). Unitless Non-negative integers.
x The independent variable or the point of evaluation. Unitless (or Radians for trig functions) Real numbers. Accuracy decreases as x moves away from 0.

Practical Examples

Example 1: Approximating ex at x = 0.5

Let’s use our maclaurin series calculator‘s logic to approximate f(x) = ex with 4 terms.

  • Inputs: Function=ex, x=0.5, n=4
  • Formula: ex ≈ 1 + x + x2/2! + x3/3!
  • Calculation:
    • Term 0 (n=0): 1
    • Term 1 (n=1): 0.5
    • Term 2 (n=2): (0.5)2 / 2 = 0.25 / 2 = 0.125
    • Term 3 (n=3): (0.5)3 / 6 = 0.125 / 6 ≈ 0.02083
  • Result: Sum ≈ 1 + 0.5 + 0.125 + 0.02083 = 1.64583
  • Actual Value: e0.5 ≈ 1.64872

Example 2: Approximating cos(x) at x = π/4 (0.7854 rad)

Let’s approximate f(x) = cos(x) with 3 terms.

  • Inputs: Function=cos(x), x=0.7854, n=3
  • Formula: cos(x) ≈ 1 – x2/2! + x4/4!
  • Calculation:
    • Term 0 (n=0): 1
    • Term 1 (n=2): -(0.7854)2 / 2 ≈ -0.61685 / 2 = -0.30843
    • Term 2 (n=4): (0.7854)4 / 24 ≈ 0.3805 / 24 ≈ 0.01585
  • Result: Sum ≈ 1 – 0.30843 + 0.01585 = 0.70742
  • Actual Value: cos(π/4) ≈ 0.70711

How to Use This Maclaurin Series Calculator

Using this calculator is straightforward. Follow these steps for an accurate approximation.

  1. Select a Function: Choose sin(x), cos(x), or e^x from the dropdown menu.
  2. Enter the Value of x: Input the point ‘x’ at which you want to evaluate the function. Remember that for trigonometric functions, this calculator assumes the input is in radians.
  3. Set the Number of Terms: Specify how many terms of the series you want to use. A higher number provides a more accurate approximation but requires more computation.
  4. Interpret the Results: The calculator automatically updates, showing you the approximated value, a table of intermediate terms, and the difference between the approximation and the true value calculated by JavaScript’s Math library.
  5. Analyze the Chart: The chart visualizes the true function (blue) and the polynomial approximation (red). Observe how the red line mirrors the blue line more closely as you increase the number of terms, especially near x=0.

Key Factors That Affect Maclaurin Series Accuracy

Several factors influence how well a Maclaurin series approximates a function. Understanding them helps in interpreting the results from any maclaurin series calculator.

1. Number of Terms (n)
This is the most critical factor. The more terms included in the polynomial, the more derivatives are matched at x=0, and the better the approximation becomes over a wider interval.
2. Value of x (Distance from Zero)
Maclaurin series are centered at x=0. The approximation is most accurate at and very close to zero. As ‘x’ moves further away from zero, the approximation error typically increases.
3. The Nature of the Function f(x)
Some functions are “better behaved” than others. Functions whose derivatives do not grow rapidly tend to be approximated well. For example, the series for e^x converges for all x, but the series for other functions might only converge within a specific radius.
4. Taylor’s Remainder Theorem
Mathematically, the error (or remainder) of the approximation can be calculated. The remainder term, R_n(x), depends on the (n+1)-th derivative of the function, which quantifies the “leftover” part of the function that the n-th degree polynomial did not capture.
5. Computational Precision
In digital calculators, floating-point arithmetic can introduce tiny errors, especially when dealing with large factorials and high powers of x.
6. Periodicity and Symmetry (for Trig Functions)
For functions like sin(x) and cos(x), the series reflects their inherent properties. The series for sin(x) only contains odd powers of x, matching its odd symmetry, while the series for cos(x) only contains even powers, matching its even symmetry.

Frequently Asked Questions (FAQ)

1. What is the difference between a Taylor and a Maclaurin series?

A Maclaurin series is a specific case of the Taylor series where the expansion point ‘a’ is set to 0. A Taylor series can be centered around any point ‘a’.

2. Why are the units for x in radians for sin(x) and cos(x)?

The derivative formulas (e.g., d/dx sin(x) = cos(x)) are only valid when x is in radians. Since the series is built from these derivatives, the input must also be in radians for the approximation to be correct.

3. Why do I see “NaN” (Not a Number) in the results?

This can happen if the number of terms is too high. Factorials (n!) grow extremely fast, and standard JavaScript numbers can’t handle values beyond roughly 170!, leading to an overflow error represented as ‘Infinity’ or ‘NaN’.

4. When is a Maclaurin series a perfect representation, not just an approximation?

For certain functions known as “analytic” functions (like sin(x), cos(x), and e^x), the infinite Maclaurin series converges to the function for all values of x. Our calculator uses a finite number of terms, so it’s always an approximation.

5. Why does the sin(x) series only have odd powers?

This is due to the derivatives of sin(x) at x=0. The even derivatives (f(0), f”(0), f””(0), etc.) are all sin(0) or -sin(0), which equals 0. Therefore, all even terms in the series become zero.

6. Why use a Maclaurin series when a calculator already knows sin(x)?

Modern calculators and computers actually use polynomial approximations, very similar to Maclaurin series, to compute these values! They don’t store a giant table of sin values; they compute them on the fly using efficient polynomial formulas. Understanding the series gives insight into how computers perform these calculations.

7. What is the “radius of convergence”?

It is the distance from the center (x=0) for which the infinite series converges to a finite value. For e^x, sin(x), and cos(x), the radius is infinite, meaning the series works for any x. For other functions like 1/(1-x), the radius is 1, so the series only works for x between -1 and 1.

8. Can I use this for other functions like tan(x) or ln(1+x)?

This specific calculator is hardcoded for sin, cos, and exp because their series have relatively simple patterns. The Maclaurin series for functions like tan(x) involve more complex coefficients (Bernoulli numbers) and are not included here.

© 2026 Your Website. All Rights Reserved. For educational purposes only.


Leave a Reply

Your email address will not be published. Required fields are marked *