The 71B/Turtle and the 49G+/Hare: The Harder 2nd Half [LONG]



#29

Hi again,

For the purpose of testing the speed and accuracy of Saturn-based HP calculators such as the HP-71B, HP28S, HP42S, and HP-48/49 series (most specially the all-new, super-fast HP49G+), here's the second (and harder) part of my original advanced test suite, which adds the remaining tests 6 to 10 to the already posted half-suite, tests 1 to 5.

I would be very obligued to those of you who own one of those models (or a suitable emulator) and are willing to run these tests on their machines and take due note of the times and accuracy achieved. Ideally, a minimum of two independent tests per model would be needed to confirm the results. Of course, you can try other HP models instead, but the tests are hard enough to require significant computing muscle which usually restricts the choice to the specified models.

That said, these are the tests comprising the second, more difficult half of the suite. Code and results for the HP-71B are provided for all of them, as well as some relevant comments where necessary:

  • Test 6 - Complex-valued Matrix operations:

    Set up the test by creating a complex-valued matrix Z with the specified dimensions, and fill it up with different random complex values between (0,0) and
    (1,1)
    . Then create a second complex matrix W with the same dimensions and perform the specified matrix operations.

    HP-71B setup code:

            OPTION BASE 1
    COMPLEX Z(15,15), W(15,15)
    FOR I=1 TO 15 @ FOR J=1 TO 15 @ Z(I,J)=(RND,RND) @ NEXT J @ NEXT I
    HP-71B code:
            MAT W = INV(Z)    185.3 sec
    MAT W = Z*Z 107.2 sec.
    MAT W = Z+Z 1.8 sec


  • Test 7 - Solving a definite integral of an implicit function:

    Find X in [0,1] such that

                /X                         
    |
    | y(x).dx = 1/3
    |
    /0
    where y(x) is an ultra-radical function (a member of the family of elliptic functions) implicitly defined by:
                5 
    y + y = x
    using precisions of 1E-3 and 1E-6 for the integral.

    HP-71B code:

         X=FNROOT(0,1,INTEGRAL(O,FVAR,1E-3,FNROOT(0,1,FVAR^5+FVAR-IVAR))-1/3)
    this gives:
          X = 0.854136725005  in 433 seconds (precision = 1E-3)
    = 0.854138746461 in 771 seconds (precision = 1E-6)


  • Test 8 - Integrating a recursively-defined function:

    Find the value of the definite integral:

               /PI
    |
    I = | F(x).dx
    |
    /0
    using precisions 1E-3 and 1E-6, where F(x) is recursively defined as follows:
        if ABS(x) < 1E-6 then F(x) = x 
    else F(x) = 2*F(x/2)*Sqrt(1-F(x/2)^2)
    HP-71B code:

    10 DEF FNF(X) @ IF ABS(X) < 1E-6 THEN FNF = X @ END
    20 DIM Y @ Y = FNF(X/2) @ FNF = 2*Y*SQR(1-Y*Y) @ END DEF
    30 I = INTEGRAL(0, PI, 1E-3, FNF(IVAR))

    this gives
           I = 2.00000022021   in  85 seconds (precision = 1E-3) 
    = 2.00000000021 in 171 seconds (precision = 1E-6)



  • Test 9 - Polynomial Solver for roots of High Multiplicity

    Find all roots real and complex of:

          x^10 +  10*x^9 +  45*x^8 + 120*x^7 + 210*x^6
    + 252*x^5 + 210*x^4 + 120*x^3 + 45*x^2
    + 10*x + 1 = 0
    HP-71B code:
          10 OPTION BASE 1 @ DIM C(11) @ COMPLEX R(10)
    20 DATA 1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1
    30 READ C @ MAT R=PROOT(C) @ MAT DISP R
    This gives (in 26 seconds) the following computed roots:
         R(1) = (-0.999999998810, 0) 
    R(2) = (-0.999998488294, 0)
    R(3) = (-0.999973753013, 0)
    R(4) = (-1.000003962220, 0)
    R(5) = (-0.989330355306, 0)
    R(6) = (-1.005339673390, -9.33448992061E-3)
    R(7) = (-1.005339673390, -9.33448992061E-3)
    R(8) = (-0.994615440783, -9.24298394994E-3)
    R(9) = (-0.994615440783, -9.24298394994E-3)
    R(10)= (-1.010783214010, 0)
    All roots should be equal to (-1, 0). As it always happens with roots of high multiplicity (10 in this case), the accuracy deteriorates, but nevertheless all roots are computed accurate to nearly 3 digits, and in some cases even more accurately (for example, R1 is correct to 8 digits).

    This is so because the polynomial is extremely flat near X = -1 and evaluates to 0 for most any X within (-1.01 .. -0.99). You can globally check the accuracy of the roots by computing their sum and product. In this case, we get

       Sum of the roots = (-9.99999999999, 0)
    Product of roots = ( 0.999999999994, 7.00472767309E-15)
    extremely close to the correct values, (-10, 0) and (1,0) respectively.

  • Test 10 - A probabilistic theoretical application

    The expected distance D between two random points on different faces of the unit cube is given by the following expression, involving the sum of two quadruple definite integrals:

                      /1 /1 /1 /1                            
    | | | |
    D = 4/5 * | | | | Sqrt(x^2 + y^2 + (z-w)^2) .dw.dx.dy.dz
    | | | |
    /0 /0 /0 /0

    /1 /1 /1 /1
    | | | |
    + 1/5 * | | | | Sqrt(1 + (y-u)^2 + (z-w)^2) .du.dw.dy.dz
    | | | |
    /0 /0 /0 /0

    HP-71B code:
          10 DEF FNF(X,Y,Z,W) = SQR(X*X + Y*Y + (Z-W)*(Z-W))
    20 DEF FNJ(Y,Z,U,W) = SQR(1 + (Y-U)*(Y-U) + (Z-W)*(Z-W))
    30 DEF FNG(X,Y,Z) = INTEGRAL(0, 1, 1E-3, FNF(X,Y,Z, IVAR))
    40 DEF FNK(Y,Z,U) = INTEGRAL(0, 1, 1E-3, FNJ(Y,Z,U, IVAR))
    50 DEF FNH(X,Y) = INTEGRAL(0, 1, 1E-3, FNG(X,Y, IVAR))
    60 DEF FNL(Y,Z) = INTEGRAL(0, 1, 1E-3, FNK(Y,Z, IVAR))
    70 DEF FNI(X) = INTEGRAL(0, 1, 1E-3, FNH(X, IVAR))
    80 DEF FNM(Y) = INTEGRAL(0, 1, 1E-3, FNL(Y, IVAR))
    90 D = 4/5*INTEGRAL(0,1,1E-3,FNI(IVAR)) + 1/5*INTEGRAL(0,1,1E-3,FNM(IVAR))
    using a precision of 1E-3 for all integrals, this gives:
          D = 0.92639 (correct to all 5 digits shown)
    in 5h 49 min (23,325.95 seconds). [For the purpose of testing emulators, the value returned is, to 12 digits, 0.926385069656]

    In case your machine can't compute quadruple integrals conveniently, here is a MonteCarlo-based simulation in HP-71B code:

          10 INPUT "NUM. POINTS="; N @ RANDOMIZE 1 @ S=0 
    20 FOR I=1 TO N
    30 X1=RND @ Y1=RND @ Z1=0 @ X2=RND @ Y2=RND @ Z2=1 @ X3=RND @ Y3=0 @ Z3=RND
    40 D1=SQR((X2-X1)*(X2-X1)+(Y2-Y1)*(Y2-Y1)+1)
    50 D2=SQR((X3-X1)*(X3-X1)+Y1*Y1+Z3*Z3)
    60 S=S+D1/5+4/5*D2
    70 NEXT I
    80 DISP "PROBABILITY: ";S/N
    running this gives:
           with N =  10  ->  0.940 
    N = 100 -> 0.924
    which certainly approaches the theoretical value.


Thanks for any and all results you can contribute, and

Best regards from Valentin Albillo


#30

Valentín:

Would you consider to collect all the findings in this very interesting series (71B vs. 49G, Pioneers, etc.) in an article for the "persistent" Articles Forum?

These are very interesting and enjoyable findings to read, and I think they deserve a more permanent place that the regular and "volatile" Forum...


#31

Andrés posted:

"Would you consider to collect all the findings in this very interesting series (71B vs. 49G, Pioneers, etc.) in an article for the "persistent" Articles Forum?"

Certainly. I'll let a few days pass by, in order to try and gather as many results as possible and will integrate them in a suitable article, together with comments, both mine and from kind contributors, where appropriate. I'll make a PDF version too, with proper tables, graphs, etc.

"These are very interesting and enjoyable findings to read, and I think they deserve a more permanent place that the regular and "volatile" Forum... "

Thanks a lot for your kind words and interest. Would you consider contributing some results to these tests, perhaps by running them in an HP28S or any other Saturn model or emulator you might own ?

In any case, thanks again and, BTW, I've been an enthusiastic fan of "Les Luthiers" all my life long. :-)

Best regards from V.


#32

I just have a 42S, which I think is already tested (is it?), a couple of 32Sii which I don't think could undertake the tests, and a 48G+ (as I can't adjust myself to RPL, its main application are the error messages like "Drop: Too few arguments"). A couple of Woodstocks, and a battered HP41C complete my small collection. A 71B is something I may add in the future, but is rather expensive for me at the time being.

Given your mathematical prowess, I suppose one of your favorite Les Luthiers pieces is the "Teorema de Thales", circa 1975.

Best regards


#33

Hola, Andrés:

Andrés wrote:

"I just have a 42S, which I think is already tested"

No, it isn't [hint, hint] :-)


"A 71B is something I may add in the future, but is rather expensive for me at the time being."

They were pretty inexpensive for a while, a few years ago. So much so that the HPCC club gave one for free to each and every attendant at one of their annual conferences. A friend of mine got one of his this way. If you ever get the opportunity, get one. It's a marvelous machine with the traditional quality of the HP of old (the keyboard, for instance, is awesome).

"Given your mathematical prowess, I suppose one of your favorite Les Luthiers pieces is the "Teorema de Thales", circa 1975."

Correct. It's incredible that they even considered the possibility of setting to music and lyrics an ancient purely mathematical theorem, and so successfully it's incredibly funny.

Thanks for your supporting comments, I encourage you to run these tests (all 10 of them) on your 42S (which is a Saturn machine, as desired) and post the time and results here, for me to compile them in a final article.

Best regards from V.


Best regards


#34

Valentin:

I thank you for inviting me to run the tests on my HP42S. While it it possible that I try to do so, I'm in very busy times and not sure to answer in the short time you would like to have the results for your article. So I regret for saying I'm not sure about running the tests, and would not like to commit to something I'm not sure I can do.

Thank you again, and also thank you for recalling something from my country that is not soccer-, tango-, or "bad government"- related.


#35

Hi again, Andrés:

Andrés posted:


"I thank you for inviting me to run the tests on my HP42S [...] I'm not sure about running the tests, and would not like to commit to something I'm not sure I can do."

Sure, no problem, I understand. The only free time I get myself to do this kind of things is very late in the night (I sleep extremely few hours a day, 3 or 4 average). Let's hope some kind soul with a 42S and/or 28S will find it proper to run the tests and post the results, I'd love to see what those intermediate Saturns can do against the original and the latest offerings.

"thank you for recalling something from my country that is not soccer-, tango-, or "bad government"- related."

Matter of fact, there are *tons* of things I love related to your wonderful country, from Les Luthiers to Mafalda to dulce de leche to panqueques to mate to most everything. I've got a number of Argentinian friends and thanks to them I've come to appreciate your country and culture even more.

Best regards from Spain.

V.


#36

Valentín:

Thank you for your kind words. While I cannot commit on the benchmarks issue, I just printed out your requests, just in case I find some free time (rather unlikely).

About the 71B: I take your advice and will be alert for any feasible chance to get or buy one. I think it was not even sold in Argentina (other models as the 41, 42, 48, 32, etc. were much more likely to be found here). I learned about it in 1984, in my first trip to the USA; but I was in that particular stage in life when, in the lapse of a little more than a year, you go through the single=>married=>father transformation. That left little attention, time, and/or money for calculators. After a eight-years pause, I just resync-ed with HP calculators in 1990, when my 42S replaced the aging 41C...


#37

Great ! When you finally get an HP-71B, don't forget to
also get its Math ROM. This machine isn't complete without it, it's really an integral part of its operating system in all respects and to all purposes. It was left out purely for marketing reasons and had to be laboriously 'extracted' from the finished ROM code.

Best regards from V.

P.D.: Just for you to appreciate the power and ease of use the HP-71B can offer, here's a 4-line program (POLYC) I wrote which will find the coefficients of the Nth degree polynomial that exactly fits N given data points (x,y):

  1 OPTION BASE 1 @ DESTROY ALL @ STD @ INPUT "# Data Points = "; N @ DIM X(N,N),Y(N),A(N)
2 FOR I=1 TO N @ DISP "X" & STR$(I) & ",Y" & STR$(I) & "="; @ INPUT P,Y(I)
3 FOR J=1 TO N @ X(I,J) = P^(N-J) @ NEXT J @ NEXT I @ MAT A = SYS(X,Y)
4 DISP "Coefficients" @ FOR I=1 TO N @ DISP USING "'A(',K,')=', 4D.4D"; I, A(I) @ NEXT I
Usage:

RUN, at the prompt enter number of data points and then each data point in turn. After the last one, it computes and outputs the polynomial coefficients a0,a1, ..., an of the polynomial y = a0 + a1 * x + a2 * x^2 + ... + an * x^n which passes through all of them.

Remarks:

  • The data points need not be equally spaced, they can have arbitrary values as long as the x are all different, of course.

  • It works for general N >= 1, limited only by available memory (up to N=40 in a bare bones 71B), has fully prompted input and output, and it's as easy to write and understand as it gets, taking less than 300 bytes.

  • If desired, you can make it work for *complex* data points (generally resulting in complex coefficients as well) by simply changing DIM in line 1 to COMPLEX.

  • Also, greater degrees can be achieved and larger sets of data points can be processed by simply changing DIM to SHORT or COMPLEX to COMPLEX SHORT.
#38

Some results for an HP28S (normal speed without fast mode):

No results for polynomials, the progs Polyroot3 from Wayne H Scott give extremely long results with an HP49G+, so I didn't use them on the 28S.

Modes : RAD NO UNDO NO COMMAND NO LASTX
28S normal mode


Test 01
-------

Matrix

Crmat
<< -> N << 10 RDZ { N N } 0 CON 'AA' STO 'AA' { 1 1 } 1 N SQ START RAND PUTI NEXT >> >>
M01
<< AA 'A' STO << A INV 'A' STO >> TEVAL >>
M02
<< AA 'A' STO << A 'A' STO* >> TEVAL >>
M03
<< AA 'A' STO << A 'A' STO+ >> TEVAL >>

A=INV(A) A=A*A A=A+A
10x10 10.65 5.26 1.44
20x20 64.20 38.06 6.36
30x30 180.05 350.15 15.07
40x40 N/A N/A N/A (not enough memory)

Remarks: the HP28S doesn't give the same results for the matrix calculus
as the HP49G+ for the same inputs (the RAND function is the same with
same RDZ)

Test 02
-------

Polynomial solver

N/A by default

Test 03
-------

Integrate & solve

IS01
<< << 'SIN(SQ(X))' { X 0 Y } 1E-5 \int DROP .5 - >> 'Y' {1 2} << ROOT >> TEVAL >>

1.20391532662 in 44.18 sec


Test 04
-------

Double integrals

DI01
<< << << 'X+Y' { Y 1 X } 1E-3 \int DROP >> { X 1 2 } 1E-3 \int DROP >> TEVAL >>

1.49999542236 in 18.46 sec

DI02
<< << << 'EXP(SQ(X)*SQ(Y))' { Y 0 1 } 1E-3 \int DROP >> { X 0 1 } 1E-3 \int DROP >> TEVAL >>

1.13509856804 in 29.86 sec

Test 05
-------

Triple integrals

TI01
<< << << << 'X*Y*Z' { Z 0 'X*Y' } 1E-3 \int DROP >> { Y 0 X } 1E-3 \int DROP >> { X 0 2 } 1E-3 \int DROP >> TEVAL >>

3.9999873874 in 1356.55 sec

Test 06
-------

Complex matrices

Czmat
<< -> N << 10 RDZ { N N } ( 0 0 ) CON 'AA' STO 'AA' { 1 1 } 1 N SQ START RAND RAND R->C PUTI NEXT >> >>
M01
<< AA 'A' STO << A INV 'A' STO >> TEVAL >>
M02
<< AA 'A' STO << A 'A' STO* >> TEVAL >>
M03
<< AA 'A' STO << A 'A' STO+ >> TEVAL >>

Z=INV(Z) Z=Z*Z Z=Z+Z
15x15 94.06 57.36 6.69

Test 07
-------

Implicit solve integrate

FY
<< -> x << 'Y^5+Y-x' 'Y' {0 1} ROOT >> >>
T07
<< << << 'FY(Z)' {Z 0 X} precision /int DROP 1 3 / - >> 'X' {0. 1.} ROOT >> TEVAL >>

X = 0.854136725005 in 373.12 seconds (precision = 1E-3)
X = 0.854138746460 in 757.47 seconds (precision = 1E-6)

Test 08
-------

Recursive integrate

FF
<< -> X << IF X ABS 1E-6 < THEN X END X 2 / FF DUPDUP * 1 SWAP - /sqr * DUP + END>> >>
T08
<< << 'FF(Z)' { Z 0 /pi } precision /int DROP >> TEVAL >>

2.00000022025 in 63.51 seconds (precision = 1E-3)
2.00000000021 in 127.19 seconds (precision = 1E-6)

Test 09
-------

High order polynomial roots

N/A by defaults

Test 10
-------

<<
<<
<<
<<
<< '\v/(SQ(X)+SQ(Y)+SQ(Z-W))' { W 0 1 } precision \int DROP
>> { X 0 1 } precision \int DROP
>> { Y 0 1 } precision \int DROP
>> { Z 0 1 } precision \int DROP 4* 5 /
<<
<<
<< '\v/(1+SQ(Y-U)+SQ(Z-W))' { U 0 1 } precision \int DROP
>> { W 0 1 } precision \int DROP
>> { Y 0 1 } precision \int DROP
>> { Z 0 1 } precision \int DROP 5 / +
>> TEVAL
>>

precision 1E-0 0.926035852784 in 1204.07 sec (HP49G+ : 230)
1E-1 0.926034651558 in 1205.02 sec (HP49G+ : 230)
1E-2 0.926121853294 in 1274.13 sec (HP49G+ : 249)
1E-3 0.926385077770 estimated 21424 sec (HP49G+ : 4187)

The last result is estimated from other comparison between the 28S and 49G+


#39

Are you intentionally "dumbing down" the test programs for the RPL
models to execute as much as possible like the "true RPN" models? It
occurs to me that the 28S, for example, might execute a lot faster if
the programs were to take advantage of the deeper stack available,
instead of storing things in local or (Gasp!) global variables.

The 28S doesn't have a built-in TEVAL command; perhaps you should show
the source code for your TEVAL program?

Regards,
James


#40

I tried to have the same logic as the 71B programs. Btw for integration and solve tests you have to use vars. The only lasy approach is the recursive test (08). For TEVAL it's just something like: (with 64 as wordsize)

<< #11CAh SYSEVAL -> t << EVAL t >> #11CAh SYSEVAL SWAP - B-R 8192 / 0.02 - >>

I'm not sure for 11CAh (from memory) it's used to read the 8192 Hz timer (similar to TICKS).

Olivier

#41

Hi,

Some results for the proposed tests with the programs used on a HP49G+:

Test6

Czmat

<< -> N << 1. N SQ START RAND RAND C->R NEXT { N N } ->ARRY 'AA' STO >> >>

M01

<< AA 'A' STO << A INV 'A' STO >> TEVAL >>

M02

<< AA 'A' STO << A 'A' STO* >> TEVAL >>

M03

<< AA 'A' STO << A 'A' STO+ >> TEVAL >>

Time

       Z=INV(Z)  Z=Z*Z Z=Z+Z
15x15 20.86 14.50 1.06

Test7

FY

<< -> x << 'Y^5+Y-x' 'Y' {0. 1.} ROOT >> >>

T07

<< << << 0. X 'FY(Z)' 'Z' /int 1. 3. / - >> 'X' {0. 1.} ROOT >> TEVAL >>

X = 0.854136725005 in 83 seconds (precision = 1E-3)

X = 0.854138746460 in 179 seconds (precision = 1E-6)

Test8

FF

<< -> X << IF X ABS 1E-6 < THEN X END X 2. / FF DUPDUP * 1. SWAP - /sqr * DUP + END>> >>

T08

<< << 0. /pi 'FF(Z)' 'Z' /int >> TEVAL >>

2.00000022025 in 14.06 seconds

2.0000000001 in 28.19 seconds

Text9

T09

<< [1. 10. 45. 120. 210. 252. 210. 120. 45. 10. 1.] 'C' STO
<< C PROOT 'R' STO >> TEVAL
R DUP OBJ-> OBJ-> DROP ->LIST DUP /piLIST SWAP /sumLIST >>

gives

(-.999999998809,0.)

(-.999999986025,0.)

(-.999885613311,0.)

(-.994455152447,-2.80278374009E-2)

(-.994455152447,2.80278374009E-2)

(-.973968536044,-1.29188673815E-2)

(-.973968536044,1.29188673815E-2)

(-1.02742908134,0.)

(-1.01791897177,2.12884708006E-2)

(-1.01791897177,-2.12884708006E-2)

in 3.01 seconds

product (1.00000000014, 7.34E-14)

sum (-10., 0.)

btw

<< 'X^10+10*X^9+45*X^8+120*X^7+210*X^6+252*X^5+210*X^4+120*X^3+45*X^2+10*X+1' << FROOTS >> TEVAL >>

gives [-1 10.] in 1.1 seconds ( root -1 as EXACT integer with a multiplicity of 10) using the CAS of the 49G

Test10

T10

%%HP: T(3)A(R)F(.);
\<<
\<<

'4/5*\.S(0,1,\.S(0,1,\.S(0,1,\.S(0,1,\v/(SQ(X)+SQ(Y)+SQ(Z-W)),W),X),Y),Z)+1/5*\.S(0,1,\.S(0,1,\.S(0,1,\.S(0,1,\v/

(1+SQ(Y-U)+SQ(Z-W)),U),W),Y),Z)' \->NUM
\>> TEVAL
\>>

precision 1E-0  0.926035852784 in  230 seconds
1E-1 0.926034651558 in 230 seconds
1E-2 0.926121853293 in 249 seconds
1E-3 0.926385077770 in 4187 seconds also correct for 5 digits


Edited: 6 Mar 2004, 8:07 a.m.

#42

Valentín:

These are my results for both packs of tests.
All tests have been done in numeric mode, no algebra or symbolic functions used. However, I am not sure if the requirements about in place computations can be guaranteed in RPL machines, at least with the user language. I think the system will use temporary variables for the matrix operations.

Test 1. Matrix operations

inversion multiplication addition
----------------------------------------
10×10 2.16 s 1.25 s 0.33 s
20×20 13.59 s 9.22 s 1.21 s
30×30 42.03 s 29.52 s 2.74 s
40×40 92.20 s 68.86 s 4.97 s

Test 2. Polynomial solver

300.69 s
Product of roots: (0.999999994032, 2.066E-12)

Test 3. Integrate and solve

1.20391530969, 15.18 s

Test 4. Double integrals

1.49999542236, 3.19 s
1.13509856804, 6.30 s

Test 5. Triple integral

3.999873874, 236.67 s

Test 6. Complex matrix operations

Matrix inversion: 21.58 s
Matrix multiplication: 14.59 s
Matrix addition: 1.02 s

Test 7. Solve integral of implicit function

1.E-3 precision: 0.854136725005, 81.66 s
1.E-6 precision: 0.854138746460, 165.83 s

Test 8. Integrate recursive function

1.E-3 precision: 2.00000022021, 11.29 s
1.E-6 precision: 2.00000000009, 23.49 s

Test 9. Polynomial solver (high multiplicity)

3.01 s
Sum of roots: (-10, 0)
Product of roots: (1.00000000014, 7.34E-14)

Test 10. Quadruple integrals

0.926385077770, 4795 s


#43

... which model did you use ? :-)

If it was neither an HP42S nor an HP28S and you do own any of those models, would you please try and run the tests on
them as well ?

Best regards from V.


#44

HP49G+, rom version 1.23, build 31.

No 42 or 28 by here.

#45

The results for HP-71X are as following:

Test 6:

MAT W = INV(Z)    58.85 seconds
MAT W = Z*Z 34.60 seconds
MAT W = Z+Z 0.60 seconds

BTW, the line

20 DIM Y @ Y = FNF(X/2) @ FNF = 2*Y*SQR(1-Y*Y) @ END DEF

produces an 'ERR L20: Var Context' error so I have to change it to:

20 Y = FNF(X/2) @ FNF = 2*Y*SQR(1-Y*Y) @ END DEF

Is this OK? According to the HP-71B Reference Manual, this means that 'An attempt has been made to explicitly or implicitly create or destroy a variable within a multiple-statement user-defined function, where that variable is already defined as either a destination in an assignment statement or as a function parameter.'

Test 7:

128.05 seconds (precision 1E-3)
228.18 seconds (precision 1E-6)

Test 8:

28.55 seconds (precision 1E-3)
57.67 seconds (precision 1E-6)

Test 9:

7.98 seconds

Test 10:

6590.23 seconds (1 h 49 min 50.23 s)

Some measurements have been done on HP-48GX and some on HP-49G so I could enter one test while executing another. Some tests were done on both HP-48GX and HP-49G and the executing times were always almost the same so you can safely assume that HP-71X speed is equal for both 48/49. Of course, the numerical results were exactly the same as on HP-71B ...

Best regards.


#46

Hi, Hrastprogrammer:

Many thanks for your results, it continues to amaze me just how fast and accurate your 71B emulator is. Just a comment:

"BTW, the line

20 DIM Y @ Y = FNF(X/2) @ FNF = 2*Y*SQR(1-Y*Y) @ END DEF
produces an 'ERR L20: Var Context' error so I have to change it to:
20 Y = FNF(X/2) @ FNF = 2*Y*SQR(1-Y*Y) @ END DEF
Is this OK? According to the HP-71B Reference Manual, this means that 'An attempt has been made to explicitly or implicitly create or destroy a variable within a
multiple-statement user-defined function, where that variable is already defined as either a destination in an assignment statement or as a function parameter.'"

Well, on my physical HP-71B, your error message appears when DIM Y is *absent* ! i.e.: I need to dimension (declare) Y or else said error shows up. I suggest you may try again, but manually performing a DESTROY ALL inmediately before running the test, and see whether including the DIM Y statement makes the error appear or disappear. Perhaps you had some Y variable already existing in the context. DESTROY ALL should then get rid of it.

Thanks again for taking the time to obtain and post your interesting and valuable results, and

Best regards from V.


#47

Well, on my physical HP-71B, your error message appears when DIM Y is *absent* ! i.e.: I need to dimension (declare) Y or else said error shows up. I suggest you may try again, but manually performing a DESTROY ALL inmediately before running the test, and see whether including the DIM Y statement makes the error appear or disappear. Perhaps you had some Y variable already existing in the context. DESTROY ALL should then get rid of it.

No help with DESTROY ALL. I tried it on Emu71 with the same result (ERR L20: Var Context). Both Emu71 and HP-71X are using ROM 2CDCC. What ROM version do you have on your HP-71B? It is possible that HP fixed a bug in 2CDCC because reporting this error when an DIM Y is absent seems like a bug to me ...

Best regards and thanks for your excellent tests.

BTW, am I waiting to receive the Mathematics Library ROM for TI-95 so I can try your tests on my just finished Texas Instruments TI-95 Emulator for Windows and compare it to the HP machines in the term of speed and numerical precision.


#48

I have one you could borrow if you'd like to consider including it too.


#49

Thanks.

I think I will receive the Stats ROM as well. If not, I will borrow that one from you ...

Greetings.

#50

Hrastprogrammer wrote:

"Both Emu71 and HP-71X are using ROM 2CDCC. What ROM
version do you have on your HP-71B?"

Version 1BBBB

"It is possible that HP fixed a bug in 2CDCC because reporting this error when an DIM Y is absent seems like a bug to me ..."

I agree, the DIM Y shouldn't be necessary, so it's quite possible it was a bug corrected by HP in later ROM updates. I do know that most of the bugs in 1BBBB had to do with multi-line user-defined functions so perhaps this is one of them.

"Best regards and thanks for your excellent tests."

Thank you very much for your appreciation but you are the one to thank for taking the time to run these tests on your fabulous emulator.

"BTW, am I waiting to receive the Mathematics Library ROM for TI-95 so I can try your tests on my just finished Texas Instruments TI-95 Emulator for Windows
and compare it to the HP machines in the term of speed and numerical precision."


Great ! I'm all eager to see your results. In the meantime, I'll try and see if I can get hold of a 42S or 28S to see how well they cope.

Thanks again and best regards from V.


#51

In the meantime, I'll try and see if I can get hold of a 42S or 28S to see how well they cope.

After you write the tests for HP-42S, please, send them to me so I can test my HP-42X emulator. I know, I know, I can modify and use HP-71B tests but I am just too lazy :-) ... and have a lot of other work to do ...

Best regards.

Hrast


#52

Hrastprogrammer wrote:

"After you write the tests for HP-42S, please, send them to me so I can test my HP-42X emulator."

Certainly. Some of the 71B suite's tests could be adapted to the 42S, but I'm afraid the 100th-degree polynomial solve and the multiple integrals would require extensive programming and thus it wouldn't be a fair comparison.

If I can get a workhorse 42S I'll try and create a new suite of tests for it, suitable for other (more powerful) Saturns and your emulator, of course.

Thanks for your interest and best regards from V.

#53

Has anyone documented the bugs in the different 71B ROM versions? I would like a copy.

#54

The Monte Carlo simulation routine listed in Test 10 doesn't seem to use variables Z1 or Z2. Is this a typographical error or am I missing something?

Best regards,
Tom Scott


#55

Hi, Tom:

Tom posted:

"The Monte Carlo simulation routine listed in Test 10 doesn't seem to use variables Z1 or Z2. Is this a typographical error or am I missing something?"

There's no typo, the simulation routine is correct as written. Z1 and Z2 are indeed "used", only as their values are always constant (0 and 1 respectively), the values themselves are included directly in the computation of the distances, instead of referring to the variables, for the sake of speed.

For instance, line 40 is computing the spatial distance between the first and the second points randomly generated.
The distance is, of course:

  D1 = Sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)
but as Z2 is always 1 and Z1 is always 0, (z2-z1)^2 is always 1, which is why there's a "+1" at the end of the line.
Same thing for line 50, where you can see that Y3 and Z1 aren't used either, as both are always 0.

Perhaps I should have either removed the assignments to Z1, Z2, and Y3 completely (I didn't because I wanted the generation of the random points in the different cube faces to be completely understandable) or else use them in the computation of the distances (I didn't for efficiency's sake, to gain a little speed). Anyway the code is correct and there's no typo at all.

Thanks for pointing it out and for your interest.

Best regards from V.


#56

Thanks Valentin for the explanation.

Tom Scott


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime: Long integers (continued) Helge Gabert 2 1,149 11-07-2013, 11:24 AM
Last Post: Helge Gabert
  HP Prime: Pass "Long" Integers to a Program Helge Gabert 6 1,940 11-03-2013, 01:12 PM
Last Post: Helge Gabert
  My 2nd and 3rd Prime Programs Jeff O. 7 1,932 10-31-2013, 08:18 AM
Last Post: Jeff O.
  HP Prime polynomial long division bluesun08 13 2,850 10-30-2013, 03:29 AM
Last Post: parisse
  OT: Reversing Sinclair's amazing 1974 calculator hack - half the ROM of the HP-35 Egan Ford 6 2,122 09-02-2013, 10:54 PM
Last Post: Thomas Klemm
  Virtual HP-IL Video Interface ILVideo the 2nd! Christoph Giesselink 3 1,218 08-15-2013, 06:49 PM
Last Post: Sylvain Cote
  Elliptic integrals of 1st and 2nd kind calculated by complex agm Gjermund Skailand 3 1,133 06-29-2013, 03:39 PM
Last Post: Gjermund Skailand
  A very long HP-17BII equation Gerson W. Barbosa 22 4,021 04-19-2013, 12:37 AM
Last Post: Gerson W. Barbosa
  A long WP-34S night Siegfried (Austria) 10 2,384 04-16-2013, 02:11 AM
Last Post: Siegfried (Austria)
  HP-25 left on for a long, long, while Matt Agajanian 12 2,888 04-10-2013, 11:33 PM
Last Post: Steve Leibson

Forum Jump: