(PC-12xx~14xx) qasi Adaptive Simpson quadrature
|
04-15-2022, 01:45 AM
Post: #2
|
|||
|
|||
RE: (PC-12xx~14xx) qasi Adaptive Simpson quadrature
Hi, robve
I translated your BASIC code for HP71B Example is for ∫(surd(x,-3), x=-2..3) ≈ 0.739024156626 10 DEF FNF(X)=SGN(X)*ABS(X)^(-1/3) 20 A=-2 @ B=3 @ E=.0001 @ DIM Z(210) 30 T2=TIME @ I=FNF(A) @ J=FNF((A+B)/2) @ K=FNF(B) 40 U=(B-A)*(I+4*J+K)/6 @ M=A @ N=B @ T=0 @ O=1 100 H=(N-M)/2 @ P=FNF(M+H/2) @ Q=FNF(N-H/2) 110 L=H*(I+4*P+J)/6 @ R=H*(J+4*Q+K)/6 @ S=L+R @ D=(S-U)/15 120 IF E<1.E-15 OR ABS(D)<E THEN T=T+S+D @ GOTO 160 130 Z(O+1)=N @ N=M+H @ Z(O)=N @ Z(O+2)=J @ Z(O+3)=Q @ Z(O+4)=K @ Z(O+5)=R 140 E=E/2 @ Z(O+6)=E @ K=J @ J=P @ U=L @ O=O+7 150 GOTO 100 160 O=O-7 @ IF O<1 THEN DISP T,TIME-T2 @ END 170 M=Z(O) @ N=Z(O+1) @ I=Z(O+2) @ J=Z(O+3) @ K=Z(O+4) @ U=Z(O+5) @ E=Z(O+6) 180 GOTO 100 >RUN .739024205098 10.99 HP71B can do recursive calls, without us handle recursive calling stacks. I think this version is simpler, which I posted a few days ago. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(PC-12xx~14xx) qasi Adaptive Simpson quadrature - robve - 03-28-2021, 01:40 PM
RE: (PC-12xx~14xx) qasi Adaptive Simpson quadrature - Albert Chan - 04-15-2022 01:45 AM
RE: (PC-12xx~14xx) qasi Adaptive Simpson quadrature - robve - 04-16-2022, 01:45 PM
RE: (PC-12xx~14xx) qasi Adaptive Simpson quadrature - Albert Chan - 04-16-2022, 04:09 PM
|
User(s) browsing this thread: 1 Guest(s)