Skip to content
Omnikalc

Taylor series calculator: how close is the polynomial to the function?

Choose a function, a value of x and a number of terms to get the series approximation, the exact value, the absolute error and the relative error.

Updated on
Your inputs

Value out of range

Value out of range

Results

Approximation from the series

2.716667

Exact value
2.718282
Absolute error
0.00162
Relative error
0.0594 %
Good: under 1 percent
Highest power of x used
5

A Taylor series approximates a function by a sum of powers of x. The Taylor series calculator takes a function (e^x, sin x, cos x or ln(1 + x)), a value of x and a number of terms and gives the approximation, the exact value, the absolute error, the relative error and the highest power used.

How the calculation works

  • e^x = 1 + x + x²/2! + x³/3! + …, which converges for every x.
  • sin x = x − x³/3! + x⁵/5! − …, and cos x = 1 − x²/2! + x⁴/4! − …, with x in radians. Both converge for every x.
  • ln(1 + x) = x − x²/2 + x³/3 − …, which converges only for x between −1 and 1 (and x = 1).
  • The calculator adds the first n terms, compares the sum with the exact value, and gives the absolute error and the relative error in percent.

Example

The function is e^x with x = 1 and 6 terms: 1 + 1 + 0.5 + 0.16667 + 0.04167 + 0.00833 = 2.716667. The exact value is e = 2.718282, so the absolute error is 0.001615 and the relative error is 0.0594 percent. The highest power of x used is 5. Adding a seventh term brings the sum to 2.718056, and the error to under 0.01 percent.

Why it matters

Seeing the error shrink as terms are added is the best way to understand convergence. The calculator helps students to check homework, to decide how many terms an approximation needs, and to compare how fast different series converge for the same x.

Good to know

The sums use ten terms at most. Sine and cosine take x in radians, so convert degrees first. The exact value is computed in double precision. The series of ln(1 + x) needs x between −1 and 1, and it converges slowly near the ends. The approximations are not the way real computers evaluate functions near large x, which first reduce the argument.

The arithmetic-geometric series calculator sums progressions, and the definite integral calculator finds the area under a curve with numerical methods.

Frequently asked questions

What is a Taylor series?

It is an infinite sum of powers of x that equals a function near a point. When the point is zero it is called a Maclaurin series. The coefficients come from the derivatives of the function at the point. Cut off after n terms, it becomes a polynomial that approximates the function.

How many terms do I need?

It depends on the function and on how big x is. For e^x at x = 1, six terms give an error of about 0.06 percent, and ten terms give an error about a million times smaller. The error grows with the size of x, so a large x needs many more terms.

Why does the series of ln(1 + x) fail for x above 1?

Its radius of convergence is 1. For x bigger than 1 the terms grow instead of shrinking, and the sum does not approach the function, however many terms you add. The calculator still shows the sum so that you can see how it diverges.

Where are Taylor series used?

They are behind the way calculators and computers evaluate sin, cos and exp, in the approximations of physics such as sin x ≈ x for a small angle, and in numerical methods for equations. The error after n terms can be bounded, which makes the approach reliable.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.