[WP34S] Numeric Integrator Has Max Iterations Set?



#7

The subject-line query says it all.

I was fiddling around with numeric integration, and the first integral I usually attempt is the one discussed in Kahan's 1980 paper on the 34C integration (on the MoHPC DVD). Namely, we are talking the integral of the following between w=0 and w=1:

2*w^2/((w-1)*(w+1)) - w/ln(w)

The WP34S emulator is fast but it seems to top out at 7 accurate significant digits even if one sets the display to the max possible (i.e., ALL 11, FIX 11, or SCI 11).

My HP15C LE is pretty fast and gets more like 8 or 9 digits even if I use something as low as SCI 6 or SCI 7. My 35S is much slower but, still, does better than the best attainable with the 34s.

This is admittedly a challenging integral (Kahan presents it as a potentially pathological example in the aforementioned paper), but I was wondering if the programmers here limited the number of function computations in the Romberg Integration or whatever other algorithm was used.

I note that Thomas Okken, via Hugh Steers, uses Romberg Integration in Free42. Free42 gets all 12 displayed digits correct for this integral, and quickly at that.

I am very interested in numerical integration and wondering if anyone could tell me about the innards of the algorithm.

Les

P.S. I am working with 2.2, not the version 3 beta. Indeed, I don't know where to get the latter.

Edited: 23 Nov 2011, 4:01 a.m.


#8

The 34S does not use an adaptive integration method. It doesn't deal with the difficult cases at all well.

There is a wrapper somewhere to provide some degree of adaption over the top and I've thought about implementing Romberg but haven't done it yet and might never get to it.


- Pauli

Edited: 23 Nov 2011, 5:33 a.m.


#9

Well, Pauli, that explains perfectly the speed and the fact that the accuracy stays put irrespective of how many digits I choose to display. The algorithm only samples 31 points no matter what.

The 90 step Romberg Integration routine in the PPC module I am sure is easily adapted to the 34s, since it looks like 34s has all of the functions of the 41C series and then some. I could work on that eventually.

BTW, I recall that the TI-83 and TI-84 actually use Gauss-Kronrod but may sample more points according to desired accuracy? I can't remember--haven't touched my Tis forever.

Les


#10

It only performs 21 function evaluations. Gauss/Kronrod quadratures share the points between the two methods. A major aspect of their appeal.

The PPC Romberg routine would port easily -- when I wrote the integration code several years ago, I had exactly five registers to work with. Romberg was simply not possible in so few. This is a limitation of the internal keystroke programming model. Thus, the 2.x firmware will never get an adaptive built in integrator. However, check out Miguel Toro's integration wrapper for a way to use the internal integration somewhat adaptively.

With the 3.x firmware, we have dynamically allocated local registers and it would be possible to use the PPC routine as the basis of the internal integration function. It will still need quite some reworking to make it behave exactly like the built in command must (near enough isn't acceptable for this unfortunately).

Time is my issue :-( The current integrator works okay mostly, I've better things to do at the moment than recode it. Maybe eventually.


- Pauli

#11

Hi,

The wrapper is in the Article section.

Regards,

Miguel


#12

Quote:
Hi,

The wrapper is in the Article section.

Regards,

Miguel


Miguel, this is a great routine. I may tweak it a bit so that the desired accuracy can be entered directly, like we do with the 42s or Free42, rather than inferred from the number of digits in SCI, FIX, ALL, etc.

It isn't an adaptive routine like Richardson extrapolation, but it still is quite fast on what is a very fast calculator. I like it just fine. Thank you!

Les

#13

Quote:
I am very interested in numerical integration and wondering if anyone could tell me about the innards of the algorithm.

The 34S uses a 10/21 point Gauss/Kronrod quadrature. The source code is in xrom.wp34s in trunk in the source tree.

Also see pages 99 and 100 of the 2.2 manual.


- Pauli

Edited: 23 Nov 2011, 5:48 a.m.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP35s Calculator Max Rope Tension Program Jean-Marc Biram (Australia) 10 4,462 12-12-2013, 12:03 AM
Last Post: Jean-Marc Biram (Australia)
  HP Prime suggestion to avoid Numeric/Symbolic confusion Chris Pem10 4 1,894 11-19-2013, 05:49 AM
Last Post: bluesun08
  Prime as laptop numeric keypad Jose Gonzalez Divasson 1 1,180 10-31-2013, 02:25 AM
Last Post: debrouxl
  How to set the Date.Time etc on a WP34S Harold A Climer 4 1,934 10-29-2013, 09:32 PM
Last Post: FORTIN Pascal
  Prime Program number of set bits kris223 3 1,924 10-23-2013, 03:05 PM
Last Post: David Hayden
  Using units in Numeric Solver Harold A Climer 1 1,292 10-13-2013, 10:44 AM
Last Post: Tim Wessman
  Able to set HP 48G axis tick marks at integers? Randal B 1 1,100 01-24-2013, 12:40 AM
Last Post: Chris Dreher
  Full (for now) Numeric CAS section up Eddie W. Shore 0 926 12-06-2012, 01:22 AM
Last Post: Eddie W. Shore
  My Numeric CAS series begins Eddie W. Shore 0 876 12-01-2012, 03:02 PM
Last Post: Eddie W. Shore
  [WP34S] WP34S firmware on the AT91SAM7L-STK dev kit? jerome ibanes 1 1,226 10-04-2012, 04:59 PM
Last Post: Paul Dale

Forum Jump: