Post Reply 
HP 48SX real/complex algebra
06-24-2024, 11:27 PM
Post: #1
HP 48SX real/complex algebra
Using an HP 48SX, how can I get 'RE((A+B*i)*(C+D*i))' to simplify to 'A*C-B*D'?
Maybe I missed how to tell the calculator "A, B, C and D are real"?
Find all posts by this user
Quote this message in a reply
06-25-2024, 04:02 PM
Post: #2
RE: HP 48SX real/complex algebra
You would have to write your own expression-manipulating rules using the very powerful MATCH commands: MATCH↓ (top-down) or MATCH↑ (bottom-up), depending on your needs.

In your case, for instance, applying MATCH↑ to the following arguments:

2: 'RE((A+B*i)*(C+D*i))'
1: { 'RE((&1+&2*i)*(&3+&4*i))' '&1*&3-&2*&4' }


where the second-level argument represents the expression to be altered and the first-level argument the replacement rule, gives the desired result:

'A*C-B*D'


Along the same lines: If you don't want to limit the result to the sole real part, use the following replacement rule:

{ '(&1+&2*i)*(&3+&4*i)' '(&1*&3-&2*&4)+i*(&1*&4+&2*&3))' }


Applying MATCH↑ to the following arguments:

2: '(A+B*i)*(C+D*i)'
1: { '(&1+&2*i)*(&3+&4*i)' '(&1*&3-&2*&4)+i*(&1*&4+&2*&3))' }


would then give the following result:

'(A*C-B*D)+i*(A*D+B*C))'


Note that, within the replacement rule, any name that begins with the ampersand character "&" is interpreted as a wild card. Thus, "&1", "&2", "&3", and "&4" denote four, in principle different, expressions of arbitrary complexity.

As a further refinement, the list object containing the rule allows an optional third algebraic object which, when evaluated, must return a user flag determining whether the replacement should take place or not. For example, while simplifying square roots of squares, you may want to make sure that the arguments of the square function are actually positive:

{ '\v/(&1^2)' &1 '&1\>=0' }
Find all posts by this user
Quote this message in a reply
06-25-2024, 09:23 PM
Post: #3
RE: HP 48SX real/complex algebra
Thank you Giuseppe. I read your reply, read the Owner's Manual regarding MATCH (that was new to me), tried your suggestions, and understand.

But it seems what you suggested requires knowing the desired answer and then telling the calculator to display it. I was hoping for some way to get the calculator to do the multiplication to 4 terms, simplify i*i = -1, collect the real and imaginary parts, and return the real part, all on its own. For example I also use Derive for symbolic algebra and it simplifies RE((a+b*i)*(c+d*i)) to a*c-b*d with a single click of "Simplify". I was hoping the HP 48SX could do likewise, perhaps with several clicks of some provided operations.

The closest I can come on the HP 48SX to what I want is to start with '(A+B*i)*(C+D*i)', EXPAN twice, COLCT twice, and see 'A*D*i+B*C*i+A*C-B*D'. Now (in this simple case) I can see the real and imaginary parts. But I would expect the calculator to be able to do the same, finish the job, and return 'A*C-B*D'. So far, it doesn't appear that the HP 48SX can do that.
Find all posts by this user
Quote this message in a reply
06-25-2024, 11:37 PM (This post was last modified: 06-25-2024 11:45 PM by Gil.)
Post: #4
RE: HP 48SX real/complex algebra
The calculator cannot guess that A, B, C and D are supposed to be real.

Put RE(A), instead of A
Put RE(B), instead of B
Put RE(C), instead of C
Put RE(D), instead of D

'RE((RE(A)+RE(B)*i)*(RE(C)+RE(D)*i))'


And you will get the simplified "expected" answer with each time RE before the letters A, B, C and D:

'-(RE(D)*RE(B)-RE(C)*RE(A))'
Find all posts by this user
Quote this message in a reply
06-26-2024, 12:04 AM
Post: #5
RE: HP 48SX real/complex algebra
(06-25-2024 11:37 PM)Gil Wrote:  'RE((RE(A)+RE(B)*i)*(RE(C)+RE(D)*i))'
And you will get...
'-(RE(D)*RE(B)-RE(C)*RE(A))'
Thank you Gil, but what steps are done at "And you will get..."? I tried various combinations of EXPAN, COLCT and EVAL on my HP 48SX and can't seem to get the result you show.
Find all posts by this user
Quote this message in a reply
06-26-2024, 01:02 AM
Post: #6
RE: HP 48SX real/complex algebra
'RE((RE(A)+RE(B)*i)*(RE(C)+RE(D)*i)'

Then press EVAL key.

But I acknowledge that I am using right now HP50G.
Find all posts by this user
Quote this message in a reply
06-26-2024, 01:15 AM
Post: #7
RE: HP 48SX real/complex algebra
(06-26-2024 01:02 AM)Gil Wrote:  'RE((RE(A)+RE(B)*i)*(RE(C)+RE(D)*i)'
Then press EVAL key.
But I acknowledge that I am using right now HP50G.
'RE((RE(A)+RE(B)*i)*(RE(C)+RE(D)*i)' EVAL on the 48SX makes no change to the expression. That may be the result of this thread and is why I brought it up -- I was surprised that the 48SX doesn't seem to be able to do this seemingly simple operation that other symbolic algebra systems can do.
Find all posts by this user
Quote this message in a reply
06-26-2024, 01:27 AM
Post: #8
RE: HP 48SX real/complex algebra
I tried on my Droid48: indeed EVAL does not solve here the problem, contrarily to the HP50G. Strange!
Find all posts by this user
Quote this message in a reply
06-26-2024, 02:54 AM
Post: #9
RE: HP 48SX real/complex algebra
(06-26-2024 01:15 AM)Rick314 Wrote:  'RE((RE(A)+RE(B)*i)*(RE(C)+RE(D)*i)' EVAL on the 48SX makes no change to the expression. That may be the result of this thread and is why I brought it up -- I was surprised that the 48SX doesn't seem to be able to do this seemingly simple operation that other symbolic algebra systems can do.

I didn't even realize that the HP-48 series was considered to have a CAS system. But I see from this thread from 8 months ago (CAS & 48SX/GX), that it is considered to have "limited CAS".

Coincidentally, I was consulting my TI-89/92+ manual today, and I came across this tidbit: the TI-89/92+ considers all undefined single-letter variables (a-z) to be Real. To include a complex variable, we can append an underscore (_) after the name (e.g. a_, or z_). So for this problem, I entered:

real((a+b*i)*(c+d*i) + z_)

and got

a · c - b · d + real(z_)

Pretty impressive for a calculator that I picked up a few weeks ago for $14.
Find all posts by this user
Quote this message in a reply
06-26-2024, 04:18 AM (This post was last modified: 06-26-2024 05:59 AM by Steve Simpkin.)
Post: #10
RE: HP 48SX real/complex algebra
Although the exact definition of Computer Algebra System (CAS) is somewhat fuzzy, the HP-28C, introduced in 1987, is among the first calculators that performed symbolic math and is largely considered the first with an early functional CAS. Casio had introduced the first calculator that could do simple formula manipulation (the fx-5500 in 1986), but they was nowhere near as powerful as the HP-28C.
https://en.m.wikipedia.org/wiki/Computer_algebra_system

It's interesting that in creating the HP-28C, HP created their own processor (Saturn), created their own computer language (system RPL) and wrote all of their own software. When TI decided to make their first symbolic calculator (the TI-92) eight years later, they used an off the shelf processor (Motorola 68000) and acquired a company (the Soft Warehouse) with an existing computer-based CAS application (Derive) to help implement it. It is also interesting to note that the specs on the TI-92 are very similar to the first Apple Macintosh (and Lisa).

Edit: The following post had a discussion of the early history of CAS on handhelds.
What was the 1st CAS pocket calculator?
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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