15.6 Numerical Integration
Numerical integration functions.
This finds a numerical approximation to the integral .
In[1]:= NIntegrate[Exp[-x^3], {x, 0, Infinity}]
Out[1]=
Here is the numerical value of the double integral .
In[2]:= NIntegrate[x^2 + y^2, {x, -1, 1}, {y, -1, 1}]
Out[2]=
An important feature of NIntegrate is its ability to deal with functions that "blow up" at known points. NIntegrate automatically checks for such problems at the end points of the integration region.
The function blows up at , but NIntegrate still succeeds in getting the correct value for the integral.
In[3]:= NIntegrate[1/Sqrt[x], {x, 0, 1}]
Out[3]=
Mathematica TE can find the integral of exactly.
In[4]:= Integrate[1/Sqrt[x], {x, 0, 1}]
Out[4]=
NIntegrate detects that the singularity in at is not integrable.
In[5]:= NIntegrate[1/x, {x, 0, 1}]
Out[5]=
Here is a double integral over a triangular domain. Note the order in which the variables are given.
In[6]:= NIntegrate[ Sin[x y], {x, 0, 1}, {y, 0, x} ]
Out[6]=