In[1]:= Integrate[Sin[x] / x, {x, 1, 3}] SinIntegral[1] SinIntegral[3] In[2

ApproxInt.nb
In[1]:=
Out[1]=
In[2]:=
Out[2]=
Integrate@Sin@xD  x, 8x, 1, 3<D
- SinIntegral@1D + SinIntegral@3D
Integrate@Sin@xD  x, 8x, 1, 3<D  N
0.902569
H* Trapezoidal Rule, FHxL=HSin xLx, n=2, Delta x=H3-1L2=1, x0=1, x1=2, x2=3,
T2=HDelta xL2*HFHx0L+2FHx1L+FHx2LL
*L
In[3]:=
Out[3]=
In[4]:=
Out[4]=
In[5]:=
T2 = 1  2 * HSin@1D  1 + 2 Sin@2D  2 + Sin@3D  3L  N
0.898904
ErrorTrapezoidal2 = Integrate@Sin@xD  x, 8x, 1, 3<D - T2
0.00366525
Plot@Sin@xD  x, 8x, 1, 3<D
0.8
0.6
Out[5]= 0.4
0.2
1.5
In[6]:=
2.0
Integrate@Exp@- x ^ 2D, 8x, 0, 1<D
2.5
3.0
1
Π Erf@1D
Out[6]=
2
In[7]:=
Out[7]=
NIntegrate@Exp@- x ^ 2D, 8x, 0, 1<D
0.746824
H*Midpoint Rule, FHxL=E^H-x^2L,n=4, Delta x=H1-0L4=14,
x0=0, x1=14, x2=24, x3=34, x4=1,
m1=18, m2=38, m3=58, m4=78,
M4=HDelta xL*HFHm1L+FHm2L+FHm3L+FHm4LL
*L
In[8]:=
Out[8]=
In[9]:=
Out[9]=
M4 = 1  4 * HExp@- H1  8L ^ 2D + Exp@- H3  8L ^ 2D + Exp@- H5  8L ^ 2D + Exp@- H7  8L ^ 2DL  N
0.748747
ErrorMidpoint4 = Integrate@Exp@- x ^ 2D, 8x, 0, 1<D - M4
- 0.001923
1
ApproxInt.nb
In[10]:=
Plot@Exp@- x ^ 2D, 8x, 0, 1<D
1.0
0.9
0.8
Out[10]= 0.7
0.6
0.5
0.2
0.4
0.6
0.8
1.0
2