Search code examples
javanumerical-methodsnumerical-integrationnumerical-analysisnumerical-computing

Romberg Integration algorithm


I want to solve a basic integral over a given interval [a,b], for an arbitrary n and m values in R(n,m) with Romberg integration.

I have derived Boole's rule from the Trapezoid Rule, so I know how to do this on paper. I've even drawn a flow chart showing all the dependencies. It is not helping me code this.

I have a feeling that this requires some sort of recursion.

I am programming this in Java.

EDIT: I AM NOT ASKING FOR ANYONE TO CODE THIS FOR ME. All information above, including that which was edited out by others, was to give context of my relative experience and understanding of technical vocabulary and my ability to apply it. This is helpful to those who actually desire to help, rather than to show off. Thank you to the gentleman who provided me with some good links and information below.


Solution

  • The pseudo-code for Romberg integration with J an given integer could look like:

    1. h = b-1
    2. Iterate j = 1,2,...,J
    3. Calculate T(j,1) with composite trapezoidal rule
    4. Iterate k = 2,...,j
    5. Calculate T(j,k) with Richardson extrapolation
    6. End loop
    7. h = h/2
    8. End loop

    Note that this is not the most efficient way but should make you familiar with the concept.

    The Wikipedia article has an implementation in C if you want to have further reading.

    An detailed explanation with examples and pseudo-code can be found here.