![]() |
Compact Simpson's Rule - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP-41C Software Library (/forum-11.html) +--- Thread: Compact Simpson's Rule (/thread-5324.html) |
Compact Simpson's Rule - Namir - 12-13-2015 02:06 AM This listing calculates the integral for f(X)=1/X (see label E) using Simpson's rule. The code is based on the compact pseudo-code that I posted in a thread in the General area. Code: Memory Map RE: Compact Simpson's Rule - Thomas Klemm - 12-13-2015 07:13 AM (12-13-2015 02:06 AM)Namir Wrote: You could use: Code: 30 6 # toggle between 4 and 2 Cheers Thomas RE: Compact Simpson's Rule - Dieter - 12-13-2015 02:20 PM (12-13-2015 02:06 AM)Namir Wrote: This listing calculates the integral for f(X)=1/X (see label E) using Simpson's rule. The code is based on the compact pseudo-code that I posted in a thread in the General area. Here's my version with yet another method of toggling between 2* and 4*f(x): use a flag. This also frees up one register, and even one more can be saved as once h is calculated the value of b is no longer required. So that's two registers less and some bytes of code saved. And one function call as f(b) is not calculated twice. Code: 01 LBL "SIMP" Maybe t's also fun to watch the flashing "2" annunciator. ;-) Dieter |