# Math Help - Numerical approximation for Integration

1. ## Numerical approximation for Integration

Hello,

Can anyone please let me know some information regarding the numerical approximation of integration.
Basically, I need to use that to write a program in Java.

I dont know if this makes sense but for example

For summation i.e. sigma , I use a for loop
For integration, what do I need to do....I'm stuck with this..

2. Might want to:

1) Read this: Numerical integration - Wikipedia, the free encyclopedia
2) Use programs that have built-in integral approximation functions, such as Maple, Mathematica etc.
3) Wait for someone with more experience to recommend a numerical analysis book for self-study, though I doubt this was your original intention.

Good luck.

3. ## Best numerical approximation for Integration

hello,

can anyone please let me know which is the best numerical approximation for integration ?? I'm thinking of using Simpson's rule but not very sure about how accurate it is ??

Basically, I have a very large dataset( several inputs and outputs the bounds of the integral) which I need to use to integrate the univariate function.
If I use the Simpson's rule or for that matter the other numerical approximations as well, except the minimum and maximum values of inputs which form the bounded limits for the integral I dont have to use the other values at all. So, I just dont know if it is a good idea to use the Simpson's rule.

Can anyone please suggest me what to do ??

4. Originally Posted by kiranpvsr
hello,

can anyone please let me know which is the best numerical approximation for integration ?? I'm thinking of using Simpson's rule but not very sure about how accurate it is ??

Basically, I have a very large dataset( several inputs and outputs the bounds of the integral) which I need to use to integrate the univariate function.
If I use the Simpson's rule or for that matter the other numerical approximations as well, except the minimum and maximum values of inputs which form the bounded limits for the integral I dont have to use the other values at all. So, I just dont know if it is a good idea to use the Simpson's rule.
I don't know what you mean by this. why would you use only part of the values given?

The standard formula for Simpson's rule requires that there be an odd number of data points and that they be equally spaced. If this not true then I would recommend the trapezoid rule:
If two consecutive data points are $(x_1, y_1)$ and $(x_2, y_2)$, then we can approximate the function by the straight line between those points and the integral by the area under that line. The region is a trapezoid with two parallel bases of lengths $y_1$ and $y_2$ and height the x- distance between the points, $x_2- x_1$. The area of the trapezoid is given by $\frac{y_1+ y_2}{2}(x_1- x_2)$. Now, add the area of all trapezoids formed.

For example, if three consecutive data points are $(x_1, y_1)$, $(x_2, y_2)$, and $x_3, y_3)$, the two adjacent trapezoids have areas $\frac{y_1+ y_2}{2}(x_2- x_1)$ and $\frac{y_2+ y_3}{2}(x_3- x_2)$.

Can anyone please suggest me what to do ??