Formula: Taylor Series & Lagrange Error Formula
- evaluationPointX: Evaluation Point X (x)
- polynomialDegreeN: Polynomial Degree N (degree n)
Evaluate N-th degree Maclaurin expansion of e^x and exact truncation remainder |R_N(x)|.
It evaluates P_n(x) = Σ_{k=0..n} (x^k / k!); LagrangeErrorBound |R_n(x)| ≤ max|f^(n+1)(c)| × |x|^(n+1) / (n+1)! directly in your browser and updates three custom SVG visualizations in real time.
A Maclaurin series is a Taylor series centred at zero. The general Taylor form uses powers of x minus a around a chosen centre a. This calculator always expands around 0, so it builds Maclaurin polynomials. To approximate e^x near some other point, you would shift the centre, and the bound would use |x minus a| in place of |x|.
The bound assumes the next derivative takes its largest value everywhere on the interval. The real remainder uses one particular point between 0 and x where the derivative is smaller. At the default x = 1.5, degree 5, the bound of 0.0709 is roughly three and a half times the true error of 0.01997. That gap is normal for a guaranteed bound.
Use the largest value of e^c for c between 0 and x. Because e^x always increases, that is e^x when x is positive and 1 when x is negative. The calculator follows that rule, which is why the bound at x = minus 1.5 is 0.01582 while the bound at x = 1.5 is 0.0709 with the same degree.
Raise the degree one step at a time and watch the bound line until it drops below your tolerance. At x = 1.5 a target of 0.001 is guaranteed first at degree 8, where the bound is 0.00047. Degree 7 already has a true error of 0.00076, but its bound of 0.00285 does not prove it, and exam answers usually require the proof.
For negative x the terms alternate in sign and partly cancel. Far from zero the individual terms grow large before they shrink, so the partial sums swing widely until enough terms are included. At x = minus 5, degree 10 gives 0.86404 against an exact 0.00674. It takes about degree 20 before the error falls to 0.00001.
No. It only builds polynomials for e^x. You can still use it for the sine or cosine Lagrange bound, since that bound is |x| to the n+1 over (n+1)! with M = 1, which equals what the calculator prints for a negative x of the same size. The polynomial value itself must be worked out by hand.
You get the constant polynomial P_0 = 1. At x = 1.5 that leaves a true error of 3.48169, and the bound becomes M times |x|, or e^1.5 times 1.5, which is 6.72253. It is a useful sanity check of the bound formula, since the arithmetic is short enough to do in your head. Degrees above 30 or fractional degrees return an input error.
The supporting lines are rounded to three decimals. At x = 0.5 and degree 5 the true error is 0.00002 and the bound 0.00004, both of which round to 0 on screen. The interpretation sentence underneath shows five decimals, so read the values there when the approximation becomes very accurate or when you need to compare small errors.
No. For an alternating series whose terms decrease in size, the error is no larger than the first omitted term, which is often tighter. At x = minus 1.5, degree 5, the first omitted term is about 0.0158, identical to the Lagrange figure here because M is 1. For positive x the series does not alternate, so the Lagrange form or a geometric-series bound is the usual choice.
Mathematically, no. For e^x every added term moves the partial sum closer to the true value in the long run, and the bound always shrinks once n is larger than |x|. In floating-point code, very large alternating sums can lose accuracy to rounding, but within this calculator's range of degrees 0 to 30 that is not a practical concern at moderate x.
The defaults ask for a degree-5 Maclaurin polynomial of e^x evaluated at x = 1.5. The calculator returns 4.462, against an exact value of 4.482, with an actual error of 0.02 and a Lagrange bound of 0.071. The interpretation line gives the same figures to five decimals: P_5(1.5) = 4.46172, e^1.5 = 4.48169, true error 0.01997, bound 0.0709.
You can rebuild the polynomial value by hand in a minute. Each term is x to the k divided by k factorial. For x = 1.5 the six terms are 1, then 1.5, then 2.25 divided by 2 which is 1.125, then 3.375 divided by 6 which is 0.5625, then 5.0625 divided by 24 which is 0.2109, and finally 7.594 divided by 5! which is 0.0633.
Add them and you get 4.46172, matching the calculator. Notice how quickly the terms shrink once k passes x. The fifth term is already only about 1.4% of the total, which is why a short polynomial gets this close.
The missing 0.01997 is everything from the x to the 6 term onward. The next term on its own would be about 0.0158, so most of the error lives in the very first term you left out.
The Lagrange form of the remainder says the error after degree n equals the (n+1)th derivative at some unknown point c between 0 and x, times x to the n+1, divided by (n+1)!. Since c is unknown, the bound replaces the derivative with its largest possible value M on that interval.
Every derivative of e^x is e^x itself, and e^x is increasing, so on the interval from 0 to 1.5 the largest value is at the right end: M = e^1.5, about 4.4817. The rest of the formula is 1.5 to the sixth, which is 11.39, divided by 6!. Multiply it out and the bound is 0.0709.
That is about three and a half times the true error of 0.01997. The bound is loose because it assumes the derivative is as large as it ever gets across the whole interval, while the real remainder averages over smaller values. A guarantee that is three or four times the real error is normal for this kind of estimate.
The important property is that the bound is never below the true error. Every run on the page should show actual error less than or equal to the bound, and if you ever see otherwise you have found a bug.
Change x to minus 1.5 and keep degree 5. The polynomial gives 0.21016, the exact value is 0.22313, the true error is 0.01297 and the bound is 0.01582.
The bound dropped by a factor of about 4.5 even though the distance from zero is the same. The reason is M. On the interval from minus 1.5 to 0, e^c is largest at c = 0, where it equals 1. So M is 1 instead of e^1.5, and the bound is simply 1.5 to the sixth divided by 6!.
The calculator handles this correctly, choosing the larger of e^x and 1 as M. That small detail is a common homework mistake: students use e^x as M for a negative x, which gives a bound that is far too small, since e^minus 1.5 is about 0.22, and can even fall below the true error.
For negative x the terms also alternate in sign, so partial sums swing above and below the true value. With degree 5 the last term is negative and the polynomial comes in slightly under the exact answer.
Degree controls how many terms you keep, and the error falls quickly. At x = 1.5 with degree 3 the polynomial gives 4.1875, an error of 0.29419 with a bound of 0.94536. Degree 5 is the default with error 0.01997. Degree 6 gives an error of 0.00415 and a bound of 0.01519. Degree 7 brings the error to 0.00076 with a bound of 0.00285, and degree 8 to 0.00012 with a bound of 0.00047.
Each extra degree cuts the error by a factor that grows as you go, because the factorial in the denominator eventually outruns the power of x in the numerator. Going from degree 7 to 8 cut the error by about six times.
The degree must be a whole number from 0 to 30; anything else returns an input error. Degree 0 is the constant 1, which at x = 1.5 gives an error of 3.48169 against a bound of 6.72253. Degree 1 is 1 plus x, giving 2.5 against 4.48169, an error of 1.98169 and a bound of 5.0419.
To pick a degree for a target accuracy, increase n until the bound, not the true error, falls below your tolerance. At x = 1.5, a tolerance of 0.001 is first guaranteed at degree 8, even though degree 7 already achieves it in practice.
The Maclaurin series of e^x converges for every x, but convergence can be slow far from zero. Try x = 5 with degree 10. The polynomial comes in about 2.03 short of the exact value, and the Lagrange bound is larger than e^5 itself, which shows how loose the estimate becomes when M is large.
Negative values are worse in a different way. With x = minus 5 and degree 10, the polynomial gives 0.86404 while the exact answer is 0.00674. The terms alternate between large positive and negative values that cancel almost completely, and ten terms are nowhere near enough for that cancellation to finish. The bound of 1.22325 honestly reports that the approximation could be off by more than the answer.
More terms do eventually win. At x = minus 5, degree 20 gives 0.00675, within 0.00001 of the exact value, and degree 30 matches it to five decimals. In real floating-point code, large alternating sums also lose digits to rounding, so needing that many terms is a warning sign.
A standard fix is to compute e^5 with the series and take its reciprocal, or to split x into an integer part and a small fraction. Taylor approximations work best when the evaluation point is kept close to the centre.
This calculator is built for e^x only. It has just two inputs, x and degree, and there is no function selector, but the same reasoning carries over to other functions if you work them by hand.
The same method works for sine and cosine with one simplification. Every derivative of sin x or cos x is plus or minus sin or cos, so its absolute value is never more than 1. You can always use M = 1, and the Lagrange bound becomes |x| to the n+1 divided by (n+1)!. That is exactly the number this calculator prints for any negative x, so you can borrow it: enter minus |x| and your degree, and read the bound line.
The polynomials themselves differ. Sine keeps only the odd powers with alternating signs, x minus x cubed over 6 plus x to the fifth over 5! and so on. Cosine keeps only the even powers. So the degree-5 sine polynomial has three nonzero terms rather than six.
Because a sine polynomial of degree 5 is also the degree-6 polynomial (the x to the sixth coefficient is zero), you may use the tighter bound with n+1 = 7. That trick is worth knowing for exams.
The main result and supporting lines show three decimals. That is fine for the defaults but hides detail once the polynomial gets accurate. At x = 0.5 and degree 5, both the error and the bound display as 0, while the interpretation line shows a true error of 0.00002 and a bound of 0.00004.
Similarly at degree 8 and x = 1.5 the error line rounds to 0 and the bound to 0.001. If you are checking homework, read the five-decimal figures in the interpretation sentence, not the rounded lines above it.
The answer line also writes approximately e^1.5 rather than giving the exact value inline, and the exact value line itself is rounded to 4.482. For comparisons to the third decimal or finer, use the longer figures.
At x = 0 everything collapses: P equals 1 exactly, the error is 0 and the bound is 0. That is correct, since every term after the constant vanishes at the centre of the expansion.
A good habit for calculus homework is to do the problem on paper first, then use the page to check three things in order.
First, the polynomial value. Write out the terms, add them, and compare with the interpretation line. If yours differs, the usual causes are a wrong factorial, a missed term, or starting the sum at k = 1 instead of k = 0.
Second, M. Decide where on the interval the (n+1)th derivative is largest and compute it. For e^x with positive x that is e^x, and for negative x it is 1. Then compute the bound and compare.
Third, the comparison. Confirm that the true error is below the bound. If your bound is smaller than the true error, M was too small, which is almost always the result of evaluating it at the wrong end of the interval.
Once those three match, change the degree by one in each direction to see how sensitive the answer is. That builds intuition faster than any single run.