Post Reply 
A digression around VA's SRC #012b
11-25-2022, 11:14 PM
Post: #5
RE: A digression around VA's SRC #012b
(11-25-2022 02:00 PM)J-F Garnier Wrote:  Computation speed and memory were quite limited on the HP-71B, but emulators running on modern computers greatly extent the usability of the HP-71B BASIC.

When I run your code in Emu71/DOS, I get hit with  "ERR L40:Insufficient Memory"
How do I add more memory to Emu71/DOS ?

Anyway, I removed DOT(A,B) code, and simply do horner's rule.
BTW, I wish we had HORNER, with the extra speed and precision.

I added two extra roots ±1, and solve below polynomial real roots instead.
Last term served only to straighten the curve, to speed up FNROOT a bit.

FNQ(x) = (2 + 3x + 5x^2 + 7x^3 + ... + p(n+1)*x^n) * (1-x) * (1+x)^3

10 DESTROY ALL @ OPTION BASE 1
20 N=10000 @ INTEGER D(N) ! PRIME INTERVALS, USE ABOUT 30kb
30 DISP "SETUP..."; @ T=TIME
40 D(1)=1 @ P=3
50 FOR I=2 TO N @ Q=P @ P=FPRIM(P+2) @ D(I)=P-Q @ NEXT I
60 DEF FNQ(X) ! = F(X)*(1-X)*(1+X)^3
70 Q=-P @ FOR I=N TO 1 STEP -1 @ Q=Q*X+D(I) @ NEXT I
80 Q=Q*X+2 @ FNQ=Q*(1+X)^3 @ END DEF
90 DISP "DONE",TIME-T
100 !
110 ! FIND THE REAL ROOTS
120 T=TIME @ X1=FNROOT(-.996,-.997,FNQ(FVAR))
130 DISP "X1=";X1,TIME-T
140 T=TIME @ X2=FNROOT(-.999,-.9999,FNQ(FVAR))
150 DISP "X2=";X2,TIME-T

>run
SETUP...DONE           102.86
X1=-.996168277368      177.95
X2=-.999296380168      208.74
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: A digression around VA's SRC #012b - Albert Chan - 11-25-2022 11:14 PM



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