HP50g Bug - Troubling



#12

I believe I've found a bug on the HP50g, and I'm hoping others can confirm this.

The calculator is in the following mode (non-approx mode):

DEG XYZ HEX C= 'X'

The program is entered into 'GSP' variable as follows (replace SQR with square root symbol):

<< -> V A W B << 'SQR(W^2+V^2-2*W*V*COS(180-B+A))' EVAL >> >>
'GSP'
STO

I enter the following values onto the stack and execute GSP:

4: 400
3: 45
2: 5
1: 180
GSP

The calculator hangs. After a second or two, I press CANCEL, and the stack is filled with garbage.

If I switch the calculator to approximate mode:

DEG XYZ HEX C~ 'X'
Then, the program returns a correct result: 396.48

I entered the same program into 'GS2' in full RPN-style (again, replace SQR with the square root symbol):

<< -> V A W B << 180 B - A + COS W * V * 2 * NEG V SQ + W SQ + SQR >> >>

I can run this program in either approximate or exact modes without problems.

It appears to be some sort of problem parsing the algebraic expression in the first program example; however, the problem didn't become apparent until I entered the exact test input above. If 180 - B + A = 45, the program crashes.

I'm hoping someone can reproduce the problem.

Thanks,
MikeO


Edited: 4 Sept 2008, 2:36 a.m.


#13

Curious, it just happened to me too.

I tried with this slightly different set of input:

4: 400
3: 45
2: 5
1: 179.99
GSP

getting 396.480852718, which I assume is the right result.

ANy explanations? The problem seems to lie in the algebraic execution of COS.

-- Antonio


#14

Quite strange.
Just tested the program with algebraic expression and got this result: 396.480230119
I did not get any problem at all.

Program runned on HP50g, rom 2.09, serial (sticker) CNA 715xxxxx.

Regards
Marco Polo


#15

49g+ ROM 2.09 and 48gII ROM 1.23
V as Square Root function

I have narrowed the bug down to
CASCFG
'V(3-V7)' EVAL
Press [ON] after a second

setting flag -125 avoids evaluation error
and gives (when -114 is clear)
'V-(V7-3)'

In the ALG mode it evaluates to:
'(3*V2-V2*V7)*V(3+V7)/2'

THEN...after visiting the ALG mode
it begin to work in RPN, too! both calcs!
Even after warm-start [ON]&[F3 C] no change
it just works!! in both calcs 49g+ and 48gII

The original problem gives:
'5*V-(160*COS(45)-6401='
remember that V=Sqrt

Edited: 4 Sept 2008, 5:29 a.m.


#16

Ok.
I tried to reproduce the error on my calculator.
If i press "ON" after 1 sec. i get some data on the stack, clearly coming from the EVALuation of the expression.
In the other cases, no errors at all.


#17

I have managed to narrow the expression causing the problem down to (replace SQR with the squareroot symbol):

'SQR(5^2+400^2-2*5*400*SQR2/2'

If I enter this expression into the calculator and EVAL it, I get the same behaviour as the example program.

The COS(180-B+45) expression evaluated to SQR2/2. On a hunch I simply put that back into the expression. So the problem is a little simpler now.

Thanks,

MikeO

Edited: 4 Sept 2008, 10:58 a.m.

#18

The original ALG program runs for about 2 minutes and delivered the correct result on my 50G.

But then I took out the SQR from the program. Like so:

<< -> V A W B << '(W^2+V^2-2*W*V*COS(180-B+A))' EVAL >> >>
'GSP'
STO

and pressed SQR after I had the result from the above program on the stack. Then ->NUM and got the right result. Much faster than 2 minutes.

It will also work if I put the SQR back in after the ALG expression and EVAL. Like so:

<< -> V A W B << '(W^2+V^2-2*W*V*COS(180-B+A))' EVAL SQR >> >>
'GSP'
STO


Edited: 4 Sept 2008, 10:56 a.m. after one or more responses were posted


#19

Hi George,

See my post immediately above this one.

I have managed to narrow the expression causing the problem down to (replace SQR with the squareroot symbol):

'SQR(5^2+400^2-2*5*400*SQR2/2'

If I enter this expression into the calculator and EVAL it, I get the same behaviour as the example program.

Thanks!

MikeO

Edited: 4 Sept 2008, 10:59 a.m.


#20

Hi MikeO,

just edited my post above. Have you tried to leave the original program run for 2 minutes? Should show the correct result.

Regards,
George


#21

I did, and it does eventually come back with an expression to evaluate. So, I guess the question is why does it take two minutes? We're probably looking at a CAS algorithm problem.

Thanks,

MikeO

#22

Quote:

'SQR(5^2+400^2-2*5*400*SQR2/2'

If I enter this expression into the calculator and EVAL it, I get the same behaviour as the example program.


Not so here. If I enter 'SQR(5^2+400^2-2*5*400*SQR2/2)' and press ->NUM I instantly get the right result.

Might really be some operator precedence issue.

Edited: 4 Sept 2008, 11:10 a.m.


#23

George,
Make sure your calculator is in the same mode as mine, then try the expression again:

DEG XYZ HEX C= 'X'

Oh yes - to replicate the behavior I'm seeing, you have to enter the expression, then EVAL.

It's the EVAL which is hanging up for so long.

-MikeO


Edited: 4 Sept 2008, 11:21 a.m.

#24

Quote:
X
I have managed to narrow the expression causing the problem down to (replace SQR with the squareroot symbol):

'SQR(5^2+400^2-2*5*400*SQR2/2'

If I enter this expression into the calculator and EVAL it, I get the same behaviour as the example program.
X


Ther is a bug in a sense:
the 'Algebraic' needs a huge time to be EVALuated symbolically
and if you interrupt it at the middle
it does not clean up the Virtual Stack at ATTN
That is the bug...

If you just let it finish, run for long enough time, about two minutes, it will be OK


#25

Thanks all for verifying this. Yes, it does eventually finish, just unexpectedly slow (2 minutes!). I guess that's a good reason to put the calculator on approximate mode when looking for numerical results.

Thanks,

MikeO


Possibly Related Threads...
Thread Author Replies Views Last Post
  hp50g screen weird line Sok-khieng Chum Hun 2 511 09-10-2013, 08:11 AM
Last Post: Sok-khieng Chum Hun
  Documentation about Hp50g / 49g+ / 48gII and wikis Pier Aiello 9 1,026 09-10-2013, 04:22 AM
Last Post: Software49g
  "A Penny for your thoughts" on the HP50g Tom Grydeland 3 593 08-01-2013, 03:57 AM
Last Post: Les Koller
  Is there a HP50g emulator for Linux? Matti Övermark 2 533 07-03-2013, 07:40 AM
Last Post: Matti Övermark
  HP50G advanced applications for mathematics CompSystems 0 436 06-17-2013, 08:38 AM
Last Post: CompSystems
  HP50g rebind stat key Chris Smith 1 445 05-26-2013, 06:21 PM
Last Post: Software49g
  How I use my HP50G at work. David Bengtson 7 838 05-06-2013, 02:57 PM
Last Post: Ingo
  HP50g emulator Richard Berler 1 410 03-24-2013, 02:43 PM
Last Post: aurelio
  Focus on the HP50g Mic 13 1,221 01-22-2013, 09:18 PM
Last Post: Ronald Williams
  HP50g and rechargeables Chris Smith 11 1,053 01-07-2013, 02:43 AM
Last Post: Derek Walker (UK)

Forum Jump: