Lesson 14 of 15
Fundamental Theorem of Calculus
Fundamental Theorem of Calculus
The FTC connects differentiation and integration -- the two central operations of calculus.
Part 1
If (f) is continuous on ([a, b]) and (F(x) = \int_a^x f(t),dt), then (F) is differentiable and (F'(x) = f(x)).
Part 2
If (f) is continuous on ([a, b]) and (F) is any antiderivative of (f), then:
Numerical Verification
We can verify the FTC numerically:
- Compute (F(x) = \int_a^x f(t),dt) using numerical integration
- Compute (F'(x)) using numerical differentiation
- Check that (F'(x) \approx f(x))
Simpson's Rule
For more accurate numerical integration, use Simpson's rule:
where (n) must be even.
Your Task
Implement:
integrate(f, a, b, n)-- Simpson's rule with (n) subintervals ((n) must be even)antiderivative_at(f, a, x, n)-- computes (F(x) = \int_a^x f(t),dt) using Simpson's ruleverify_ftc(f, a, x, h, n)-- checks that the numerical derivative of (F(x)) approximately equals (f(x)) (within 0.001). Uses (F'(x) \approx (F(x+h) - F(x-h)) / (2h)).
Pyodide loading...
Loading...
Click "Run" to execute your code.