Post Reply 
(PC-12xx~14xx) qasi Adaptive Simpson quadrature
04-16-2022, 04:09 PM (This post was last modified: 04-16-2022 04:39 PM by Albert Chan.)
Post: #4
RE: (PC-12xx~14xx) qasi Adaptive Simpson quadrature
(04-16-2022 01:45 PM)robve Wrote:  A bit surprised to see that the recursive version on the HP 71B takes much longer,
about 1.7 times the execution time of the stack version:

If we replace stack version FNF(x) as subroutine, 11s goes up to 14s.
About half of the slowdown is because of the more efficient FNF(x).

SUB SIMPSON() does not see FNF(x), thus required slower SUB F(x,y)

The other half is due to different recurse conditions. (see below)

Quote:The quadrature should be comparable, but not necessarily identical as the summation order differs
(in-order traversal sum versus a bottom-up sum in the recursive version that is typically more precise).

Also, recurse condition of two versions are close, but not identical.

Stack version recurse if E = [1E-15, ABS((S-U)/15)]
SUB SIMPSON recurse if E = [1E-15/16, ABS((S-U)/16)]

For our test example, with undefined value at x=0, SIMPSON version recurse deeper.
With SIMPSON version matching stack version E recurse condition, it produce similar result.
> RUN
 .73902420507      15.44

Compare apples to apples, both using SUB F(x,y), timing difference is now minor.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (PC-12xx~14xx) qasi Adaptive Simpson quadrature - Albert Chan - 04-16-2022 04:09 PM



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