Numerical integration of a function specified numerically

In summary, the conversation is about finding a routine or command to perform numerical integration of a function that is specified numerically on a one dimensional grid with equal spacing. The speaker mentions that there are routines available for analytical functions but not for functions specified only numerically. They also mention finding one in the NAG library, but it is not free. The function in question is widely varying and cannot be handled with simple numerical integration schemes, and generating additional data on other grid points is not possible. The suggestion is to use Simpson's rule to make assumptions about how the function behaves between grid points.
  • #1
praban
13
0
Dear All,

Can someone suggest me an appropriate routine (in Fortran) or command (in mathematica) to perform numerical integration of a function, which is specified numerically on a one dimensional grid with equal spacing (and we cannot generate additional data on other grid points)? There are many routines (e.g. in numerical recipe) to do numerical integration of analytical functions but I haven't found one for functions specified only numerically. I found one in NAG library (d01gaf) but NAG is not free. My numerical function is widely varying one and cannot be handled with simple numerical integration schemes (but at the same time additional data on other grid points cannot be generated).

Thanks,

Pradipta
 
Physics news on Phys.org
  • #2
You need to make some assumption as to how your function behaves between grid points. Simpson's rule will suffice.
 

1. What is numerical integration?

Numerical integration is a method used to approximate the definite integral of a function when the function is not known analytically. It involves dividing the interval of integration into smaller subintervals and using a numerical method, such as the trapezoidal rule or Simpson's rule, to calculate the area under the curve within each subinterval.

2. How is a function specified numerically?

A function can be specified numerically by providing a set of ordered pairs, where the first value represents the input (x-value) and the second value represents the output (y-value) of the function. These pairs can be used to plot the function on a graph and can also be used to calculate the integral of the function.

3. What is the purpose of numerical integration?

The purpose of numerical integration is to approximate the definite integral of a function when it is not possible to find the exact value using traditional methods, such as the fundamental theorem of calculus. It is often used in scientific and engineering applications to calculate areas, volumes, and other quantities represented by integrals.

4. What are some common numerical integration methods?

Some common numerical integration methods include the trapezoidal rule, Simpson's rule, and Gaussian quadrature. These methods differ in their level of accuracy and complexity, but all involve dividing the interval of integration into smaller subintervals and using a formula to approximate the area under the curve within each subinterval.

5. Can numerical integration always provide an exact result?

No, numerical integration can only provide an approximation of the definite integral. The accuracy of the approximation depends on the method used and the number of subintervals used to divide the interval of integration. However, as the number of subintervals increases, the approximation will become closer to the exact result.

Similar threads

Replies
3
Views
417
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
Replies
5
Views
3K
Replies
1
Views
1K
  • Atomic and Condensed Matter
Replies
4
Views
1K
  • Programming and Computer Science
Replies
15
Views
2K
Replies
5
Views
3K
Replies
8
Views
4K
Replies
14
Views
2K
Back
Top