Post Reply 
[VA] SRC #009 - Pi Day 2021 Special
03-16-2021, 08:28 PM
Post: #15
RE: [VA] SRC #009 - Pi Day 2021 Special
(03-16-2021 06:36 PM)Valentin Albillo Wrote:  
robve Wrote:The improper integral can be evaluated [...] using a vintage HP or SHARP BASIC calculator using Romberg with midpoint quadrature

I seem to remember that in some other post in another thread you said something along the lines of "every programmer should write their own integration procedure".

Well, I could agree in principle with that statement, writing quadrature programs is fun, but I've never bothered to write Romberg-based ones, as they are extremely inefficient in my not-so-humble opinion. Said procedures were OK for very limited HP calcs of old such as the slow, RAM-starved HP-34C, but for powerful models such as the HP-71B, say, there are much, much better, faster alternatives, some of which I've programmed in the far past, with excellent results.

Which ones you wrote are better? Adaptive Simpson is one of my favorites, but does not allow open intervals, at least not "out of the box". It easily beats Romberg in terms of speed for most integrands as long as they are well behaved. However, compared to other methods it may require much more memory for the recursive calls (with up to 9 parameters!) or a stack to simulate recursion. Recursive calls are typically 20 levels deep and typically more to get a decent accuracy.

Newton-Cotes formulas such as Romberg variants are quite popular. The methods also allow you to monitor the convergence error closely. The HP 71B appears to use a modified version of Romberg to avoid evaluating the endpoints, like my "QROMO" version.

Monte Carlo methods of integration with quasi random number generators are good for integrals over multiple dimensions.

When implementing algorithms, be aware that high-quality numerical analysis code is hard to find. Rolling out your own method that differs from existing methods is risky. My versions closely follow the methods published in NR and elsewhere in the literature (not in fake journals, LOL).

I never posted "every programmer should write their own integration procedure". as the quotation suggests. What post are you referring to? I may have encouraged code because the challenges are also about writing and reusing code as you've stated.

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #009 - Pi Day 2021 Special - robve - 03-16-2021 08:28 PM



User(s) browsing this thread: 1 Guest(s)