# Numerical Integration

N[Integrate[expr,{x,x_{min},x_{max}}]] | try to perform an integral exactly, then find numerical approximations to the parts that remain |

NIntegrate[expr,{x,x_{min},x_{max}}] | find a numerical approximation to an integral |

NIntegrate[expr,{x,x_{min},x_{max}},{y,y_{min},y_{max}},...] | |

multidimensional numerical integral | |

NIntegrate[expr,{x,x_{min},x_{1},x_{2},...,x_{max}}] | |

do a numerical integral along a line, starting at , going through the points , and ending at |

Numerical integration functions.

In[1]:= |

Out[1]= |

In[2]:= |

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 endpoints of the integration region.

In[3]:= |

Out[3]= |

In[4]:= |

Out[4]= |

In[5]:= |

Out[5]= |

NIntegrate automatically looks for singularities at the endpoints of the integration region and any subregions defined by piecewise functions (such as Piecewise and Abs) in the integrand. If additional singularities are present, NIntegrate may not give you the right answer for the integral. Nevertheless, in following its adaptive procedure, NIntegrate will often detect the presence of potentially singular behavior, and will warn you about it.

In[6]:= |

Out[6]= |

If you know that your integrand has singularities at particular points, you can explicitly tell NIntegrate to deal with them. NIntegrate[expr, {x, x_{min}, x_{1}, x_{2}, ..., x_{max}}] integrates expr from to , looking for possible singularities at each of the intermediate points .

In[7]:= |

Out[7]= |

You can also use the list of intermediate points in NIntegrate to specify an integration contour to follow in the complex plane. The contour is taken to consist of a sequence of line segments, starting at , going through each of the , and ending at .

In[8]:= |

Out[8]= |

In[9]:= |

Out[9]= |

option name | default value | |

MinRecursion | 0 | minimum number of recursions for the integration method |

MaxRecursion | Automatic | maximum number of recursions for the integration method |

MaxPoints | Automatic | maximum total number of times to sample the integrand |

Special options for NIntegrate.

When NIntegrate tries to evaluate a numerical integral, it samples the integrand at a sequence of points. If it finds that the integrand changes rapidly in a particular region, then it recursively takes more sample points in that region. The parameters and MaxRecursion specify the minimum and maximum number of recursions to use. Increasing the value of guarantees that NIntegrate will use a larger number of sample points. and MaxRecursion limit the number of sample points which NIntegrate will ever try to use. Increasing or MaxRecursion will make NIntegrate work more slowly.

In[10]:= |

Out[10]= |

In[11]:= |

Out[11]= |

In[12]:= |

Out[12]= |

In[13]:= |

Out[13]= |

For integrals in many dimensions, it can take a long time for NIntegrate to get a precise answer. However, by setting the option , you can tell NIntegrate to give you just a rough estimate, sampling the integrand only a limited number of times.

In[14]:= |

Out[14]= |