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 x → √(1−x²) from −1 to 1 (1.570796… = π/2).
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 > 0, that of f2 is < 0.
In the case shown below on the right, the integral between -2 and 2 is 0.
  
   

•  At the beginning the integral of x → √(x³+1) is calculated.

function F(x) {
with(Math) {
return  sqrt(pow(x,3)+1)
}}

I can take 52.049971104. It is more than enough for each application. With WolframAlpha, with "integrate sqrt(x^3+1) dx between 1 and 7" I can have:
52.049971103763749933450986697949208...

•  If I change F in the following way, I can find the integral of x → exp(x²) from 0 to 3:

function F(x) {
with(Math) {
return  exp(x*x)
}}
1444.5451228899435  if a=0 b=3 n=256e4 [8.363031156477518e-9]
1444.5451228815804  if a=0 b=3 n=128e4 [3.336322151881177e-8]
1444.5451228482172  if a=0 b=3 n=64e4  [1.3355474948184565e-7]
1444.5451227146625  if a=0 b=3 n=32e4  [5.341280484572053e-7]
1444.5451221805344  if a=0 b=3 n=16e4  [0.0000021365635802794713]
1444.5451200439708  if a=0 b=3 n=8e4   [0.000008546221806682297]
1444.545111497749   if a=0 b=3 n=4e4   [0.00003418488427087141]
1444.5450773128648  if a=0 b=3 n=2e4   [0.00013673952230419672]
1444.5449405733425  if a=0 b=3 n=1e4   [1444.5449405733425]

I can take 1444.54512289. With WolframAlpha I can have: 1444.54512289271415471376001340596...

•  If I change F in the following way, I can find the integral of x → sin(x²), from 0 to π²:

function F(x) {
with(Math) {
return  sin(x*x)
}}
0.6773089372424593  if a=0 b=9.8696044010893586 n=64e4 [-5.866825913969365e-10]
0.6773089378291419  if a=0 b=9.8696044010893586 n=32e4 [-2.3466496523738555e-9]
0.6773089401757916  if a=0 b=9.8696044010893586 n=16e4 [-9.386749710849074e-9]
0.6773089495625413  if a=0 b=9.8696044010893586 n=8e4  [-3.754700705904668e-8]
0.6773089871095483  if a=0 b=9.8696044010893586 n=4e4  [-1.501883707399898e-7]
0.6773091372979191  if a=0 b=9.8696044010893586 n=2e4  [-6.007597528334685e-7]

I can take 0 .677308937. With WolframAlpha I can have: 0.677308937046889033108516222836...

•  If I change F in the following way, I can find the integral of x → 1/log(x), from e to 10:

function F(x) {
with(Math) {
return  1/log(x)
}}
4.270481688429555   if a=2.7182818284590452 b=10 n=64e4 [5.799805080641818e-12]
4.2704816884237555  if a=2.7182818284590452 b=10 n=32e4 [2.254640918408768e-11]
4.270481688401209   if a=2.7182818284590452 b=10 n=16e4 [9.033929160295884e-11]
4.27048168831087    if a=2.7182818284590452 b=10 n=8e4  [3.6146730053587817e-10]
4.2704816879494025  if a=2.7182818284590452 b=10 n=4e4  [1.4457457453431743e-9]
4.270481686503657   if a=2.7182818284590452 b=10 n=2e4  [5.783186374230809e-9]
4.27048168072047    if a=2.7182818284590452 b=10 n=1e4  [4.27048168072047]

I can take 4.27048168843. With WolframAlpha I can have: 4.2704816884313611820564608183...

•  The previous integrals, like most integrals, can only be calculated numerically. But it is better to calculate numerically also many of the other integrals, also to better master the precision of the results. An example: to calculate (in a certain sea) the kg of salt present in a column of water 1 square meter wide and 100 meters deep you have to calculate the integral between 1 and 100 of  34.7*(1-0.0176*exp(-0.05*x)*(1+0.04*x)). A famous university manual of "Mathematics for the Life Sciences" developing this calculation in full, gives this value as the correct answer: 3448.50. If we use these script we obtain:

function F(x) {
with(Math) {
return  34.7*(1-0.0176*exp(-0.05*x)*(1+0.04*x))
}}
3448.491419883378  if a=0 b=100 n=8e4 [-9.836185199674218e-10]
3448.4914198843617 if a=0 b=100 n=4e4 [-4.0872691897675395e-9]
3448.491419888449  if a=0 b=100 n=2e4 [-1.637590685277246e-8]
3448.491419904825  if a=0 b=100 n=1e4 [3448.491419904825]

The value is 3448.49141988, or 3448.49. The answer (3448.50) is almost right, but ... the data is approximate. Assuming that − 0.05 and 0.04 are correct, we would have that the solution is between 3443.4 and 3453.6!!! Unfortunately, in this manual (and many others) the calculations are done in this way.

# 34.75*(1-0.01755*exp(-0.05*x)*(1+0.04*x))
3453.5216196594883  if a=0 b=100 n=16e4
# 34.65*(1-0.01765*exp(-0.05*x)*(1+0.04*x))
3443.4613961986424  if a=0 b=100 n=16e4

•  If I change F in the following way, I can find the integral of x → 1/√(x³+1), from 0 to  . I work on [0,100], then on [100,10000], ...

function F(x) {
with(Math) {
return  1/sqrt(pow(x,3)+1)
}}

2.604364224936649   if a=0 b=100 n=16e5 [-7.549516567451064e-15]
2.6043642249366568  if a=0 b=100 n=8e5  [-1.1590728377086634e-13]
2.6043642249367727  if a=0 b=100 n=4e5  [-5.950795411990839e-14]
2.604364224936832   if a=0 b=100 n=2e5  [-4.583000645652646e-13]
2.6043642249372905  if a=0 b=100 n=1e5  [2.6043642249372905]
- - - - -
0.17999997958874092  if a=100 b=10000 n=1e5 [0.17999997958874092]
- - - - -
0.017999999387442685  if a=10000 b=1000000 n=1e5 [0.017999999387442685]

2.604364224936649+0.18·(1+0.1+0.01+...) = 2.604364224936649 + 0.18·10/9 = 2.604364224936649 + 0.2 = 2.804364224936649 = (rounding) 2.804364224937.

•  If I change F in the following way, I can find the integral of x → x/(x²+1), from 0 to  :

function F(x) {
with(Math) {
return  x/(pow(x,2)+1)
}}

2.30756025884133  if a=0 b=10 n=1e5
- - - - -
2.2976599247434124  if a=10 b=100 n=1e5
- - - - -
2.3025355951596063  if a=100 b=1000 n=1e5
- - - - -
2.302584597660238  if a=1000 b=10000 n=1e5

The integral between two successive powers of 10 tends to be the same positive number; I deduce that the integral diverges to infinity

•  If I change F in the following way, I can find the integral of x → sin(x)/x, from −1 to 1; I set: F(0) = 1 because sin(x)/x → 1 as x → 0.

function F(x) {
with(Math) {
if(x==0) {u=1} else {u=sin(x)/x};  return  u
}}

1.892166140734187  if a=-1 b=1 n=64e5 [-2.631228568361621e-13]
1.89216614073445   if a=-1 b=1 n=32e5 [-6.661338147750939e-16]
1.8921661407344508 if a=-1 b=1 n=16e5 [-9.192646643896296e-14]
1.8921661407345427 if a=-1 b=1 n=8e5  [-4.1233683134578314e-13]
1.892166140734955  if a=-1 b=1 n=4e5  [-1.8680612612342884e-12]
1.892166140736823  if a=-1 b=1 n=2e5  [-7.574163518597743e-12]
1.8921661407443973 if a=-1 b=1 n=1e5  [1.8921661407443973]

I take 1.89216614073445 (only up to this point the variation between the outputs is divided approximately by 4).

•  I want to calculate the volume of the solid pictured below.

The solid can be approximated by the union of many disks of thickness dx and radius G(x), i.e. of volume π·G(x)²·dx.  The volume of the solid is  [0,1] π·G(x)² dx. If G(x) = x² it is  [0,1] π·x4 dx.

function F(x) {
with(Math) {
return  PI*pow(x,4)
}}

0.6283185307179291  if a=0 b=1 n=128e5 [-1.4210854715202004e-14]
0.6283185307179433  if a=0 b=1 n=64e5  [3.752553823233029e-14]
0.6283185307179058  if a=0 b=1 n=32e5  [1.6986412276764895e-13]
0.6283185307177359  if a=0 b=1 n=16e5  [5.965228311310966e-13]
0.6283185307171394  if a=0 b=1 n=8e5   [2.457922754217634e-12]
0.6283185307146815  if a=0 b=1 n=4e5   [9.810374734797733e-12]
0.6283185307048711  if a=0 b=1 n=2e5   [3.9273806429207525e-11]
0.6283185306655973  if a=0 b=1 n=1e5   [0.6283185306655973]

I take 0.6283185307180 (only up to this point the variation between the outputs is divided approximately by 4).

We have made this simple example to illustrate the use for calculating volumes. In this case we could have easily calculated the volume directly and found that it holds π/5 = 0.6283185307179586.

•  I want to calculate  [0,3] |x·(x−2)| dx

function F(x) {
with(Math) {
return  abs(x*(x-2))
}}

2.666666666668032   if a=0 b=3 n=1e8  [1.5631940186722204e-12]
2.666666666666469   if a=0 b=3 n=1e7  [1.1231016117108084e-12]
2.666666666665346   if a=0 b=3 n=1e6  [1.2369039126269854e-10]
2.6666666665416554  if a=0 b=3 n=1e5  [1.2374167468465203e-8]
2.666666654167488   if a=0 b=3 n=1e4  [2.666666654167488]

I take 2.666…:  I understand that, if the rounding errors did not intervene, the outputs would continue in this way  (only up to 2.666666666666469 the variation between the outputs is divided approximately by 100; if the approximation errors did not become preponderant, the next exit would be 2.66666666666666...).  2.666… = 2+2/3 = 8/3.

•  I want to calculate  [0,3] F where F(x) = 2·sin(x²) if x ≤ π/2, F(x) = sin(x²) if x > π/2. The approximation to thousandths is enough for me.

(for the graph, see here)

function F(x) {
with(Math) {
if (x<=PI/2) {u=2*sin(x*x)} else {u=sin(x*x)}
return u
}}

1.6016787712180702  if a=0 b=3 n=1024e4 [-1.828905447087692e-7]
1.601678954108615   if a=0 b=3 n=512e4  [-1.6475709685437323e-13]
1.6016789541087797  if a=0 b=3 n=256e4  [7.315614130032344e-7]
1.6016782225473667  if a=0 b=3 n=128e4  [-5.5564441936439835e-12]
1.6016782225529231  if a=0 b=3 n=64e4   [-0.000002926253118484823]
1.6016811488060416  if a=0 b=3 n=32e4   [-8.699263531752877e-11]
1.6016811488930343  if a=0 b=3 n=16e4   [-3.4807401405601013e-10]
1.6016811492411083  if a=0 b=3 n=8e4    [-1.3924066344372932e-9]
1.601681150633515   if a=0 b=3 n=4e4    [-5.56947221674875e-9]
1.6016811562029871  if a=0 b=3 n=2e4    [-2.2277982347773673e-8]
1.6016811784809695  if a=0 b=3 n=1e4    [0.0000023643901312375704]

If I wanted more figures I would take 1.601679. In our case 1.602 is sufficient.

The graph was plotted with R (see), defining function F as follows: F = function(x) ifelse(x <= pi/2, 2*sin(x*x), sin(x*x))


There are not many functions that can be formally integrated, even if (who knows why? ...) they are the only ones that can be integrated in textbooks (not only secondary school). A famous function that cannot be elementally integrated is the Gaussian. /// Non sono molte le funzioni che si sanno integrare formalmente, anche se (chissà perché? …) sono le sole che si trovano da integrare sui libri di testo (non solo di scuola secondaria). Una famosa non integrabile elementarmente è la gaussiana.

Elementary functions (functions of one variable which are the composition of arithmetic operations, powers, exponentials, logarithms, trigonometric functions and their inverses) are closed with respect to derivation but not with respect to integration. Some examples of elementary functions that do not have an elementary antiderivative, using x as the input variable: /// Le funzioni elementari (funzioni di una variabile che sono la composizione di operazioni aritmetiche, potenze, esponenziali, logaritmi, funzioni trigonometriche e loro inverse) sono chiuse rispetto alla derivazione ma non rispetto all'integrazione. Alcuni esempi di funzioni elementari che non hanno una antiderivata elementare, usando x come variabile di input:

√(1+x^3),  √(1-x^4),  1/√(1+x^4),  1/log(x),  log(log(x)),  exp(x^2),  exp(-x^2),  exp(x)/x,  exp(exp(x)),  x^2*exp(-x^2)sin(x^2)cos(exp(x))sin(x)/x.