# 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.
We can draw the graphs with JavaScript; for example, see x21 (see the code; se also here).
The graph, in PHP, here.
The graph, in R:
source("http://macosa.dima.unige.it/r.R")
g = function(x) -3*x^2 + 2*x + 5
BF=4.5; HF=3 # base, height of window
graphF(g, -3,5, "brown")
integral(g, -3,5)
# -96
The graph with Desmos: