Romberg Integration


The latest 34S firmware now has a modified version of the PPC IG Romberg integration routine in the firmware. The non-adaptive Gauss-Kronrod quadrature is gone -- for good I hope.

The main modification I made to the PPC IG routine is a little bit of extra code to ensure the final three estimates are equal like the 34c's integration code. The original PPC IG routine only required the final two to be equal. I made a few other small tweaks to Les Wright's port of the PPC IG routine but nothing too significant.

Yet another reason to upgrade to the upcoming v3 firmware. As if there weren't enough reasons already :-) Version 3 is far and away better than version 2!

- Pauli


Version 3 features: A proper END statement and real separate programs. A proper delete the current program. No flash banks anymore -- all of flash is used now. Local registers for subroutines, deeply nested subroutines limited only by free RAM. Extra commands to check convergence of series and rearrange the stack in any manner. Extra complex constants.

Lots of program memory: 927 maximum program steps in RAM. 3838 program steps in flash. 927 steps in the backup flash region. A massive 5692 program steps maximum -- almost every command being fully merged.

Single and double precision real and complex numbers.

Plus all the old 34S features.

Expect a pre-release once were done with our internal testing and the documentation is updated.

As you can probably tell, I'm excited by this one.

- Pauli



I am under the impression that the Gauss-Kronrod quadrature is better than Romberg's method. I am wrong (I always find it soooo hard to type in this sentence :-))?

I assume your implementation reduces errors in a manner that exceeds any work with Gauss-Kronrod quadrature?



The main advantage of the Romberg integrator as implemented is that it is adaptive. GK was always using the same number of points.


They are different.

Gauss-Kronrod isn't adaptive. It selects a number of fixed points (in our case 21 points) from within the integration interval and then produces an estimate for the integral. It is very good for some functions and utterly hopeless for others.

Romberg's method is adaptive. It refines the sampling until successive estimates agree. Generally, it works better with difficult functions.

Ideally I'd have provided an adaptive method that used G-K quadrature underneath & have had the best of both worlds. This would consume more resources but it is typical of mathematical packages these days.

- Pauli


How about an algorithm that uses the G-K quadrature in the following quasi-adaptive manner:

Set Area2 = G-K quadrature over the entire integral
Number_of_Integral_Divisions = 1
Area1 = Area2
Increment Number_of_Integral_Divisions
Set Area2 = G-K quad applied over Number_of_Integral_Divisions sub-intervals.
Until Abs(Area1 - Area2) < Tolerance

Would that work?


Edited: 14 Jan 2012, 6:48 p.m.


That ought to work. It is wasting a lot of function evaluations. Adaptive quadratures try to reuse existing evaluations the next time around. G-K isn't all that suited to this -- a method I have seen used is to increase the order of the G-K quadrature reusing the existing evaluated points. This isn't all that suitable for a small memory device. It is also better to be clever about when to subdivide the intervals and make it recursively applied. BTW: G-K gives you an error estimate -- well it gives you two estimates of the integral which is effectively the same which would simplify things a bit.

The problem was that I originally had exactly five registers when I coded the integrator. G-K quadrature just fitted into these. Now that we've local registers, this isn't so much a problem. Romberg does use more e.g.. Doing an adaptive G-K would also use more.

Ever since the 34S was first released, people have been wanting an adaptive integrator, so I've finally provided one. I don't have time to maintain two integrators and I've huge amounts of other coding for the 34S that needs doing so I won't be looking to improve the integration code for a long while yet, if ever. Nevertheless, feel free to code up an adaptive G-K quadrature and we'll look at including it :-)

- Pauli

Possibly Related Threads...
Thread Author Replies Views Last Post
  Integration question and "RPN" mode comment Craig Thomas 16 3,269 12-05-2013, 02:32 AM
Last Post: Nick_S
  WP34s integration trapped in infinite loop Bernd Grubert 25 3,771 10-17-2013, 08:50 AM
Last Post: Dieter
  HP Prime integration Richard Berler 1 747 10-06-2013, 10:52 PM
Last Post: Helge Gabert
  integration on 39gII emulator Wes Loewer 29 4,109 06-07-2013, 05:58 PM
Last Post: Chris Smith
  WP-34S Integration Richard Berler 15 2,246 03-08-2013, 02:29 AM
Last Post: Walter B
  HP 34S integration Richard Berler 16 2,282 02-18-2013, 04:42 PM
Last Post: Marcus von Cube, Germany
  [WP34S] Speeding up the Romberg Integration Les Wright 14 2,179 05-31-2012, 03:39 PM
Last Post: Marcus von Cube, Germany
  New variant for the Romberg Integration Method Namir 8 1,584 04-18-2012, 07:47 AM
Last Post: Nick_S
  Romberg Integration for 33s, 35s Matt Agajanian 9 1,529 03-26-2012, 10:00 AM
Last Post: Nick_S
  HP 32sII Integration Error of Standard Normal Curve Anthony (USA) 4 913 03-14-2012, 03:18 AM
Last Post: Nick_S

Forum Jump: