HP Forums
Romberg Integration - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Romberg Integration (/thread-209135.html)



Romberg Integration - Paul Dale - 01-14-2012

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


Re: Romberg Integration - Paul Dale - 01-14-2012

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


Re: Romberg Integration - Namir - 01-14-2012

Paul,

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?

Namir


Re: Romberg Integration - Marcus von Cube, Germany - 01-14-2012

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


Re: Romberg Integration - Paul Dale - 01-14-2012

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


Re: Romberg Integration - Namir - 01-14-2012

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
Do
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?

Namir

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


Re: Romberg Integration - Paul Dale - 01-14-2012

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