Lesson 12 of 18
Taylor Series Error
Taylor Series Error
The error of a degree- Taylor approximation is:
Taylor's Remainder Theorem
There exists some between and such that:
E_n(x) = rac{|f^{(n+1)}(c)|}{(n+1)!} cdot |x-a|^{n+1}
This bounds the error by the next term of the series (at the worst ).
Intuition
- The degree- polynomial matches through all derivatives up to order at
- The first "mismatch" comes from the -th derivative
- The further is from , the larger the error (raised to the power)
Example: with
For , the Taylor polynomial at with :
P_2(x) = f(0) + f'(0)x + rac{f''(0)}{2!} x^2 = 0 + 0 + 0 = 0
At : error 8.
The bound from the theorem: rac{|f'''(c)|}{3!} cdot |2|^3 = rac{6}{6} cdot 8 = 8. Tight!
Convergence Check
For polynomial , a Taylor polynomial of degree at has zero error (it's exact).
Your Task
Implement double taylor_error(double (*f)(double), double a, double x, int n, double h) that returns .
Helper functions from the Taylor polynomial lesson are provided.
TCC compiler loading...
Loading...
Click "Run" to execute your code.