Numerical integration example
Theory:
Integrand: $\,\,\,\ f(x) = 3x^2+4x $
Exact solution
Indefinite integral: $\,\,\,\ F(x)=\int 3x^2+4x \,dx = x^3+2x^2+C$
Definite integral: $\,\,\,\ I=\int_A^B 3x^2+4x \,dx = F(B)-F(A)=\left(B^3+2B^2\right)-\left(A^3+2A^2\right) $
Approximation solution ( N = number of rectangles )
Left hand : $ \,\,\,\,\,I \approx \sum_{i=0}^{N-1} f(x_i) \Delta x \,\,\,\,\,\,\, x_i=A+i\Delta x $
Right hand : $ \,\, I \approx \sum_{i=1}^{N} f(x_i) \Delta x$
User inputs:
Enter numbers:
Integration limits:
A:
B:
N: