The Turtle (HP71B) and the Hare (HP49G+) [LONG] Message #1 Posted by Valentin Albillo on 25 Feb 2004, 10:33 a.m.
Hi all,
For some time now, I've been reading in this forum, the comp.sys.hp48 newsgroup and several other such places lots and lots of posts about the new HP49G+, both pointing out its deficiencies and its virtues.
Among the later, the one most frequently mentioned is its "amazing speed", or that it is "incredibly fast", and many other such praises. However, some actual running times posted here and there I find somewhat contradictory, specially when confronting posted speeds with that of the most venerable Saturn CPU holder of all, the HP71B itself.
Now, what amazes me is this: first of all, I do not own an HP49G+ (nor any other HP48/49 models for that matter) and thus I may be wrong on this, but I believe that both the oldest HP71B and the newest HP49G+ boast Saturn CPUs, (physical in one case, emulated in the other), and so ...
 The HP71B's Saturn CPU is the oldest version and runs
at a meager 650 Khz, while the HP49G+ emulates the most modern Saturn version and allegedly the emulation runs appreciably faster than a real 4 Mhz Saturn CPU. This alone should mean that the HP49G+ should be faster than the HP71B by a factor larger than 4/0.65 = 6.15 times.
 Besides, there's also the fact that the HP49G+ uses RPL for its programming language, and RPL is supposedly much more efficient and thus faster than slow BASIC linebyline interpretation, which presumably should also give it an additional speed boost when doing complex calculations or running nontrivial programs.
Considering both facts together, I fully expected the 49G+ to be between 6.15 times faster than the 71B at the very least, and probably more like 10 times faster. However, some recent timings posted here and there resulted in factors around 3x, far from the expected 6x10x range, so I would like to settle down this matter for good, in order to ascertain the real speed of the 49G+ when compared to the 71B, and if it's indeed inferior to 6x, to ask for the reasons why this is so against expectations.
To that effect, I would like to ask that those of you who own a 49G+ and who are willing to do me this favour, please run the following test examples. Of course, discussing as we are such powerful machines, no willynilly "ASIN(ACOS(ATAN(SIN(COS(TAN(9))))))" test will do, nor some simple loops or computing some ancillary expression. We are after timings for powerful, complicated algorithms and that's what we shall try here. Bear with me:
 Matrix operations:
Set up the test by creating a realvalued matrix A with the specified dimensions, and fill it up with different random values between 0 and 1.
These are the HP71B times in seconds for the following dimensions and operations. Times are given just for the operation, not for any set up or displaying results.
Matrix True matrix Matrix
inversion multiplication addition

Dimensions MAT A=INV(A) MAT A=A*A MAT A=A+A

10x10 7.5 7.3 0.4
20x20 57 57 1.7
30x30 185 188 3.7
40x40 432 435 6.7
Notice that all operations should be in place, i.e.: no additional
matrix is required to hold the result. The matrix inversion, for
instance, is done in the same space occupied by the original
matrix being inverted, so no extra RAM is allocated for the result
or intermediate operations. Also, the matrix multiplication is
true matrix multiplication, not every element being replaced
by its square, and should be done also in place, not allocating another matrix to hold the result. Same for the addition.
 Polynomial Solver
Find all roots (both real and complex), of the 100thdegree equation:
x^100 + x^99 + x^98 + ... + x^2 + x + 1 = 0
These are the setup steps for the HP71B:
OPTION BASE 1 lower indexes will be 1
COMPLEX R(100) dimensions the roots' vector (100 complex roots)
DIM C(101) dimensions the coefficients' vector (101 coefficients)
MAT C = (1) makes all coefficients equal to 1
Now we compute all 100 complex roots at once and time the result:
MAT R = PROOT(C)
which in my HP71B takes 1939 seconds. Half the computed roots are correct
to 12 digits, the other half are correct within a few counts in the 12th place.
You can quickly check the correctness of the computed roots by simply
adding and/or multiplying all 100 roots together, the result should be 1
in both cases. For instance, using the HP71B, you can compute the product of all 100 complex roots
by executing this multistatement command from the command line:
COMPLEX P @ P=1 @ FOR I = 1 TO 100 @ P = P * R(I) @ NEXT I @ DISP P
which promptly returns (0.999999999944, 1.312E12). The exact value is (1,0)
 Integrate & Solve combined
Find the value of X in [1,2] such that the value of the integral of Sin(x^2).dx within limits 0 and X equals 1/2. We care to get about 5 correct decimal places for X:
/X
 2
 Sin(x ).dx = 1/2

/0
For the HP71B, we make sure RADIANS mode is set and then execute from the keyboard (and time) this command:
FNROOT(1, 2, INTEGRAL(0, FVAR, 1E5, SIN(IVAR * IVAR))  0.5)
which gives X = 1.2039153, correct to all 8 digits shown, in just 42 seconds.
 Double integrals
Compute the following double integrals:
/2 /X
 
I =   (x + y).dy.dx
 
/1 /1
A doubly nested INTEGRAL keyword (with precision 1E3), gives I = 1.50000 (correct to all 6 digits shown) in just under 17 seconds.
/1 /1
  x^2*y^2
I =   e .dy.dx
 
/0 /0
Using the same 1E3 precision, it gives I = 1.1351 (correct to all 5 digits shown) in 35 seconds.
 Triple integrals
Computing the triple integral:
/2 /X /X*Y
  
I =    (x * y * z).dz.dy.dx
  
/0 /0 /0
with a precision of 1E3, gives I = 4.0000 (correct to the 5 digits shown) in 1242 seconds
That's all. Please run these tests as stated, making extrasure that no symbolic features or 'algebraicaware' simplifications are used (just numerical results), and post here the values obtained and the time. Of course this is no Aesop's fable and I know that the Hare will easily win this time, only I want to know by how much and why that much.
Thank you very much in advance, and
Best regards from V.
