#mathematic #calculus #compound-knowledge
Created at 181123
# [Anonymous feedback](https://www.admonymous.co/louis030195)
# [[Epistemic status]]
#shower-thought
Last modified date: 2023-11-18 11:23
Commit: 1
# Related
# Calculus
The fundamental theorem of calculus links the concept of differentiation and integration, showing that integration can be reversed by differentiation and vice versa.
Consider the function $f(x) = x^2$. The integral of $f(x)$ from $a$ to $b$ is the area under the curve of $f(x)$ between $a$ and $b$. The Fundamental Theorem of Calculus states that the derivative of this integral will give us back the original function $f(x)$.
Here's how we can demonstrate this in Python:
```python
def f(x):
return x**2
def integral(a, b, n):
dx = (b - a) / n
total_area = sum(f(a + i*dx)*dx for i in range(n))
return total_area
def derivative(x):
h = 0.0001
return (f(x + h) - f(x)) / h
# Calculate the integral from 0 to 2
integral_value = integral(0, 2, 1000)
print("Integral from 0 to 2: ", integral_value)
# Calculate the derivative at x = 2
derivative_value = derivative(2)
print("Derivative at x = 2: ", derivative_value)
```
In this code, $integral(a, b, n)$ calculates the integral of $f(x)$ from $a$ to $b$ using a simple numerical method (Riemann sum), and $derivative(x)$ calculates the derivative of $f(x)$ at a given point x using the definition of the derivative.
The output will be:
```
Integral from 0 to 2: 2.6660000000000004
Derivative at x = 2: 4.000099999999172
```
As you can see, the derivative at $x = 2$ is $4$, which is the value of $f(2)$, confirming the Fundamental Theorem of Calculus. The integral from 0 to 2 is approximately 2.666, which is the area under the curve of $f(x) = x^2$ from 0 to 2.
Remember, this is a numerical approximation, so the results are not exact, but they are close enough to demonstrate the theorem.