HP Forums
HP50G and solving equations with complex numbers - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: HP50G and solving equations with complex numbers (/thread-7838.html)



HP50G and solving equations with complex numbers - jgharris - 02-28-2017 03:00 AM

Am I correct that the HP50G cannot solve equations with complex numbers. For an easy example: V=I*Z where I=50A@-35 degrees and Z=(4,8) ohms? The calculator returns: Error: Bad Guess(es).

I saw somewhere searching online that one can use the MSLV command but that doesn't really work as a solver. Does a newer firmware fix this issue? I have Version: HP50-C Revision $2.15 which I believe is the latest one.

I'm just shocked since I have used the HP35S for the past 8 years as my workday calculator (calculating CT/PT ratios, relay settings, etc.), to pass the F.E. and later the P.E. exam. On the P.E. exam I was even able to store equations such as symmetrical components (zero, positive and negative sequence) equations which of course require solving an equation with complex values as inputs and giving a complex number output. I'm shocked that the HP50G can't do this and the 35S can do this and more. According to my searches the release dates on the these two calculators was 2006 (HP50G) and 2007(HP35S). I know the 35s was designed to cater to colleges and to the NCEES exam standards which prohibits graphing calculators with qwerty keyboard entry and storage ability.

Not to beat a dead horse just surprised and wondering if I overlooked something and there is a way to solve equations with heavily involved complex numbers since I'm an EE and that's what we do...


RE: HP50G and solving equations with complex numbers - Han - 02-28-2017 04:07 AM

Have you tried using the Solvesys library? http://www.hpcalc.org/search.php?query=solvesys


RE: HP50G and solving equations with complex numbers - Vtile - 02-28-2017 10:11 AM

Hmm... I can do it (v2.15). Although I just tried with the solve command and a random nonsolved equation.
10+j20 = ( 5+j5 ) * Z => 3+j

I think atleast if you only tried out some easy single function like impedance law, it is a user error.


RE: HP50G and solving equations with complex numbers - Gerson W. Barbosa - 02-28-2017 12:16 PM

(02-28-2017 10:11 AM)Vtile Wrote:  Hmm... I can do it (v2.15). Although I just tried with the solve command and a random nonsolved equation.
10+j20 = ( 5+j5 ) * Z => 3+j

Of course simple equations like these can be solved simply by doing

(10,20) (5,5) ÷ --> (3.,1.)

Alternatively for more complex ones (pun not intended), we can use this program and do

'(10,20)=(5,5)*Z'
{Z}
SYS
Z --> (3.,1.)


RE: HP50G and solving equations with complex numbers - Han - 02-28-2017 12:26 PM

(02-28-2017 03:00 AM)jgharris Wrote:  Not to beat a dead horse just surprised and wondering if I overlooked something and there is a way to solve equations with heavily involved complex numbers since I'm an EE and that's what we do...

Was complex mode enabled?


RE: HP50G and solving equations with complex numbers - Vtile - 02-28-2017 01:39 PM

(02-28-2017 12:16 PM)Gerson W. Barbosa Wrote:  
(02-28-2017 10:11 AM)Vtile Wrote:  Hmm... I can do it (v2.15). Although I just tried with the solve command and a random nonsolved equation.
10+j20 = ( 5+j5 ) * Z => 3+j

Of course simple equations like these can be solved simply by doing

(10,20) (5,5) ÷ --> (3.,1.)

Alternatively for more complex ones (pun not intended), we can use this program and do

'(10,20)=(5,5)*Z'
{Z}
SYS
Z --> (3.,1.)
Of course, it were just test of given example.

[V1 - V2 = 10*Ix
V1/j20 + (V1 - V3)/20 + V2/10 + (V2 - V3)/-j10 = 0
V3/j10 + (V3-V2)/-j10 + 2<45deg + (V3 - V1)/20 = 0
Ix = -V3/j10]
[V1 V2 V3 Ix]
SOLVE

as in https://www.youtube.com/watch?v=vj9K_bXKEY4

Can be used for system of complex equations, but I don't know the limits of the solve command, it seems to have odd pitfalls at times.

One question is are the OP after a numerical solver with complex numbers as by definition (numerical) it should also do single equations with complex input. I haven't tested and I have no time just now to play it around to see if it is possible somehow. Edit. Yes, numerical solver do not like complex input and gives the "bad quess" error, I'm suprised actually.


RE: HP50G and solving equations with complex numbers - Vtile - 02-28-2017 07:22 PM

Rather interesting the Num.slv/SOLVE EQUATION do list a complex number as a valid type, but can't solve for them. Is that a bug / feature of the recent firmware or is it something that never got implemented? . ..Or is it dependaple from certain flag settings etc. to work.


RE: HP50G and solving equations with complex numbers - jgharris - 02-28-2017 08:25 PM

[Was complex mode enabled?]

Yes, I went into CAS and tried enabling and turning off the complex settings as well as the exact/approximate and verbose and other settings (I don't have the calc with me since I'm still at work...). No change, same error.


I was hoping that the HP50G would be able to do this without any external programs.

When I say using an equation solver i mean being able for the calculator to store a library of equations in memory and then when you want to solve for a variable in chosen equation you select the variable to solve for and the calc will prompt you for each variable input in the equation [1 equation, 1 unknown...]. For an easy example we can calculate the positive sequence current of an unbalanced load/fault: P=(1/3)*(A+a*B+a^2*C), where a=1@120 degrees and a^2=1@240 degrees. On my HP35s I can enter that equation then hit solve (it prompts me for what variable I want it to solve for, in this case P) and it then prompts me for all of the remaining variables/unknown constants in the equation. So for the case where A=120A@-18deg, B=960A@-191deg, C=120A@-326deg my beloved HP35s quickly spits out the answer for P which is: P= 383A@-67.7 deg.

Like I said not to beat a dead horse I am just suprised that my fancy graphing calculator struggles to do this type of calculation without a 3rd party program. Not only is the HP35s capable of doing this, it is able to hold dozens of equations which is really helpful in a pinch for the working engineer.


RE: HP50G and solving equations with complex numbers - Simone Cerica - 03-04-2017 11:21 PM

To solve systems of linear equations with complex coefficients you can use both LINSOLVE and SOLVE:

Code:
[ '(1+i)*X-Y=i' '(1-i)*X+(1+i)*Y=1' ] [ 'X' 'Y' ] LINSOLVE


returns

Code:
{ [ '(1+i)*X-Y=i' '(1-i)*X+(1+i)*Y=1' ] [ 'X' 'Y' ] }
:Specific: { '1+i' 1 1 1. }
[ 'X=(1+i)/2' 'Y=0' ]

to solve single equations numerically you can operate directly on the stack:

[Image: attachment.php?aid=4537]

to enter complex numbers in polar form can be useful these programs:

Code:
\<< \-> X Y \<< { X Y } XNUM EVAL DEG -19. SF CYLIN \->V2 \>> \>> 'PN' STO

syntax: "module r" "argument φ" PN --> (r,\<)φ)
ex: '\v/2' 45 PN --> (1.41421356237,\<)45.)

Code:
\<< -16 FS? IF THEN -16 CF ELSE -16 SF END \>> 'RP' STO

RP switches from rectangular to polar notation and vice versa:
(1.,1.) RP --> (1.41421356237,\<)45.)
(1.41421356237,\<)45.) RP --> (1.,1.)

however, for more complex equations and non-linear systems for better use SolveSys as suggested by Han:

SolveSys 49 1.2
http://www.hpcalc.org/details/3145
SolveSys 49 Documentation
http://www.hpcalc.org/details/3146

Furthermore I strongly suggest you read the Complex Numbers Marathon: http://www.hpcalc.org/details/5114


RE: HP50G and solving equations with complex numbers - c3d - 10-17-2024 11:45 PM

(02-28-2017 03:00 AM)jgharris Wrote:  Am I correct that the HP50G cannot solve equations with complex numbers. For an easy example: V=I*Z where I=50A@-35 degrees and Z=(4,8) ohms? The calculator returns: Error: Bad Guess(es).

I saw somewhere searching online that one can use the MSLV command but that doesn't really work as a solver. Does a newer firmware fix this issue? I have Version: HP50-C Revision $2.15 which I believe is the latest one.

Found this old tread while trying to get an answer to the same question.

I ran into the same issue trying to check how the HP48 and HP50G solver dealt with (X-5)^2+3=0. What I find interesting is that it finds a real extremum relatively well, but even if you give (0;1) as initial guess, it still does not explore the complex space.

What I find fascinating about that is that as far as I can tell, the normal solver algorithm should work just as well with complex values, as implemented in DB48x. There is no special code for the complex case, except for a bit of random rotation when a solution is not found.

Code:

«
    '(X-5)²+3' 'X' 0+0ⅈ Root
»

This gives

Code:

:X:5.+1.73205 08075 7ⅈ

I wonder if there was a reason for the HP solver to avoid exploring the complex space.


RE: HP50G and solving equations with complex numbers - Gilles - 10-18-2024 09:47 PM

Years ago, i learned many things with the vidéos of rolinychupetin
An example:
HP-50g Matrices and Complex Numbers


RE: HP50G and solving equations with complex numbers - Gilles - 10-19-2024 08:47 AM

With the 50g, I do like this :

In Complex approx mode C~
'(X-5)²+3' XSOLVE
{ 'X=(5.000,-1.732)' 'X=(5.000,1.732)' }
or in polar display
{ 'X=(5.292 ∡-19.107)' 'X=(5.292 ∡19.107)' }

In complex exact mode C= :
'(X-5)²+3' XSOLVE
{ 'X=5-i*√3' 'X=5+i*√3' }

To switch C <->|R LShift & I
To switch approx~ <-> exact= RShift & ENTER
Note that is ALPHA RShift 6


RE: HP50G and solving equations with complex numbers - John Keith - 10-20-2024 01:16 PM

(10-19-2024 08:47 AM)Gilles Wrote:  In Complex approx mode C~
'(X-5)²+3' XSOLVE
{ 'X=(5.000,-1.732)' 'X=(5.000,1.732)' }
or in polar display
{ 'X=(5.292 ∡-19.107)' 'X=(5.292 ∡19.107)' }

In complex exact mode C= :
'(X-5)²+3' XSOLVE
{ 'X=5-i*√3' 'X=5+i*√3' }

By XSOLVE do you mean SOLVEVX? there is no XSOLVE on my 50g but SOLVEVX returns the results in your post.


RE: HP50G and solving equations with complex numbers - Gilles - 10-20-2024 02:50 PM

(10-20-2024 01:16 PM)John Keith Wrote:  By XSOLVE do you mean SOLVEVX? there is no XSOLVE on my 50g but SOLVEVX returns the results in your post.

Oups. My mistake :/ SOLVEVX you’re right …