(50G) (49G+) Trapezoidal rule integration in RPL

11172015, 11:55 AM
(This post was last modified: 06152017 01:57 PM by Gene.)
Post: #1




(50G) (49G+) Trapezoidal rule integration in RPL
Hello,
I have been using this code for years now and due to its simplicity, it has never failed. << \(\rightarrow\) M << M SIZE OBJ\(\rightarrow\) DROP DROP 'p' STO 0 'A' STO 2 p FOR i 'M(i,1)' \(\rightarrow\)NUM 'M(i1,1)' \(\rightarrow\)NUM  'M(i,2)' \(\rightarrow\)NUM 'M(i1,2)' \(\rightarrow\)NUM + x 'A' \(\rightarrow\)NUM + 'A' STO NEXT 'A' \(\rightarrow\)NUM 2 / "AREA" \(\rightarrow\)TAG >> 'A' 'p' PURGE PURGE >> Although not optimized and is actually FORTRAN translated into RPL, this code is fast calculating the area under a curve in accordance with the trapezoidal rule: \[ \int_{x_1}^{x_n} y(x) dx \approx \frac{1}{2} \sum_{k=1}^{n1} (x_{k+1}x_{k})(y_{k+1}+y_{k}) \] Marcio 

« Next Oldest  Next Newest »

Messages In This Thread 
(50G) (49G+) Trapezoidal rule integration in RPL  Marcio  11172015 11:55 AM
RE: [HP50G/49G+] Trapezoidal rule integration in RPL  Thomas Klemm  11172015, 05:56 PM
RE: [HP50G/49G+] Trapezoidal rule integration in RPL  Marcio  11172015, 06:35 PM
RE: [HP50G/49G+] Trapezoidal rule integration in RPL  Thomas Klemm  11172015, 07:04 PM
RE: [HP50G/49G+] Trapezoidal rule integration in RPL  Marcio  11172015, 07:13 PM

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