|# The integral of F (positive function) from A to B is the area below the graph and above the x axis.
It is calculated by approximating it with rectangles in increasing numbers. On the right, the approximation of integral of |
# I F is not always positive, then the areas of rectangles are signed: positive/negative if they are above/below the x axis: in the case shown below on the left, the integral between -1 and 1 of f1 is
# In the case shown below on the right, the integral between -2 and 2 is 0.
This script allows to calculate the integral of polynomial functions.
• The oriented area above left, where f1(x) = −x²+1:
I take 1.333 = 1+1/3 = 4/3.
• ∫[−3, 5] 5 + 2·x − 3·x² dx
I take −96.
The graph, in PHP, here.
The graph, in R:
g = function(x) -3*x^2 + 2*x + 5
BF=4.5; HF=3 # base, height of window
graphF(g, -3,5, "brown")
The graph with Desmos: