Function Repository Resource:

# NumericalIntegralApproximation

Determine the value of an integral using a numerical method

Contributed by: Jason Martinez
 ResourceFunction["NumericalIntegralApproximation"][f,{x,xmin,xmax},method] gives a numerical approximation to the integral using the specified method.

## Details and Options

ResourceFunction["NumericalIntegralApproximation"] supports the following methods:
 "Midpoint" midpoint rule "RightHand" right Riemann sum "LeftHand" left Riemann sum "Simpson" Simpson's rule "Trapezoidal" trapezoidal rule "Boole" Boole's rule
"LeftHand", "Midpoint" and "RightHand" methods disregard all option settings except "Intervals".
ResourceFunction["NumericalIntegralApproximation"] takes the following options:
 "Intervals" Automatic the number of subintervals to divide the integral into WorkingPrecision MachinePrecision the precision used in internal computations
By default, "Intervals" takes the value Automatic, corresponding to a single interval.

## Examples

### Basic Examples (2)

Integrate expressions using classic numerical methods such as Simpson’s rule:

 In[1]:=
 Out[1]=

Compare left hand, right hand, and midpoint integrations:

 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

### Scope (1)

Compute integrals with "Trapezoidal" or "Boole" rules:

 In[5]:=
 Out[5]=
 In[6]:=
 Out[6]=

### Options (1)

Increase accuracy by using multiple intervals:

 In[7]:=
 Out[7]=

### Applications (2)

Examine how increasing the number of intervals affects the result:

 In[8]:=
 In[9]:=
 Out[9]=

Compare the results to the exact answer:

 In[10]:=
 Out[10]=
 In[11]:=
 Out[11]=

## Version History

• 2.0.0 – 09 August 2022
• 1.0.0 – 08 November 2019