The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

CAS hp50g non equivalent commands
Message #1 Posted by peacecalc on 16 Dec 2012, 2:47 p.m.

Hello CAS fans,

The CAS of the hp 50g is powerfull but restricted, restricted in that way, that it doesn't perform non-equivalent term changes (don't misunderstand me, that is good!).

But the built in mechanism to fix a range of a variable is (in my eyes clumsy) and don't work properly in such situations.

So my idea is using the match command (to versions: bottom-up or top-down) for programming in user-RPL such non-equivalent rules (for example: ln(x^2) --> 2*ln(x) which is only possible for x > 0).

So the responsiblity is on the side of the user. He has to have in mind what the range of the used variables is.

It would be nice to have a lot of this programs for extending the CAS.

I will start with two rules:

The first one: XR2EXP will change the writing with root-sign into writing with exponents (this doesn't touch the problem above, but it is a good exercise in using the match-command).

XR2EXP:
%%HP: T(3)A(R)F(,);
\<<
  WHILE { '\v/&A' '&A^(1/2)' } \|^MATCH SWAP { 'XROOT(&A;&B)' '&B^(1/&A)' } \|^MATCH ROT OR
  REPEAT
  END
\>>
The second: COLEX (COLlect EXponents) uses the rule: (A^B)^C = A^(B*C) (this touches the problem above) :

COLEX:
%%HP: T(3)A(R)F(,);
\<<
  WHILE { '(&A^&B)^&C' '&A^(&B*&C)' } \|^MATCH SWAP EVAL EXP2POW XR2EX SWAP
  REPEAT
  END
\>>
Greetings

peacecalc

Edited: 16 Dec 2012, 2:48 p.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall