The Museum of HP Calculators

HP Forum Archive 15

[ Return to Index | Top of Index ]

HP 48g+: How do I solve multiple eqns with multiple variables?
Message #1 Posted by Tiffany on 13 Nov 2005, 8:00 p.m.

I have a hp 48g+ calculator. I need to solve multiple equations (containing complex number) with multiple variables but I do not know how. I was trying to follow the section in the user manual about solving multiple eqns with the Multiple Eqn Solver but I kept getting errors. Can anybody help me with this please? This relates specifically to solving AC circuits using nodal analysis. Thanks! Tiffany

      
Re: HP 48g+: How do I solve multiple eqns with multiple variables?
Message #2 Posted by Gerson W. Barbosa on 13 Nov 2005, 10:55 p.m.,
in response to message #1 by Tiffany

Say your equations are:

'7*V1 + 11*(V1-V2) = 3'
'5*V2 + 11*(V2-V1) = 2'
Your system matrix should be:

A * X = B

| 18 -11 | | V1 | | 3 | | | * | | = | | | -11 16 | | V2 | | 2 |

All you have to do is the following:
[ [ 3 ] [ 2 ] ]

ENTER

[ [ 18 -11 ] [ -11 16 ] ]

/

(in fact, the actual operation is X=B*[A]^-1, since matrices cannot be divided one by another)

you should obtain

[ [ .419161676647 ]
  [ .413173652695 ] ]

Or V1 = 0.419161676647 and V2 = 0.413173652695

(Of course, you could have complex numbers in your equations, like (3,/_120) or (1.5,2.6) for instance.)

Or just read the manual at page 18-11 (Solving a System of Linear Equations:)

Green arrow SOLVE ^ ^ OK. Perhaps you find this easier.

You can also use the program below and enter your equations exactly as they appear:

'7*V1 + 11*(V1-V2) = 3'

ENTER

'5*V2 + 11*(V2-V1) = 2'

ENTER

{ V1 V2 }

SYS

You would get a menu with
V1 = 70/167           

V2 = 68/167

MAT = [ [ 18 -11 3 ] [ -11 16 2 ]]

EQS = (a list with the two equations)

For clean-up, use .<- (all objects at left will be purged)

Regards,

Gerson.

------------------------------------------------

Program by Francisco Matheus, who has authorized his free use. He was one of my colleagues in Circuit Analyses classes many years ago. At the time, we ran this program on our 28S's. It was useful as we didn't to rework the equations by hand to obtain the system matrix. This saved some time for larger systems (up to 5 x 5). If results in rational form are not needed, use ->NUM or change the program.

%%HP: T(2)A(D)F(.);
DIR
  \<-
     VARS 1 OVER
'\<-' POS 1 - SUB
PURGE
    
  SYS
     DUP SIZE \-> l
n
       n \->LIST
'EQS' STO 0 n
        FOR i 1 n
          FOR j i j
== 1 0 IFTE l j GET
STO
          NEXT 1 n
          FOR j '
EQS(j)' \->NUM
          NEXT n
\->ARRY i
          IF NOT
          THEN NEG
'VET' STO
          ELSE VET
+ ARRY\-> DROP
          END
        NEXT { n n
} \->ARRY l PURGE TRN
CONJ 'MAT' STO VET
MAT / n 1
        FOR i DUP i
GET \->Q l i GET STO
-1
        STEP DROP
MAT VET n 1 + COL+
'MAT' STO 'VET'
PURGE
      
    
END
            
Re: HP 48g+: How do I solve multiple eqns with multiple variables?
Message #3 Posted by Tiffany on 14 Nov 2005, 10:16 a.m.,
in response to message #2 by Gerson W. Barbosa

Thanks for the information. I wanted to just be able to put the equations in my calculator as is after finding them from the circuit since the problems usually entail at least 4 equations. I know the TI 89 can do this with a function called 'C Solve' which most of my classmates have. On the test I will not have time to simply these kinds of problems.

One of my problems looks like this:

1) V1-V2 = 10Ix

2) V1/j20 + (V1-V3)/20 + V2/10 + (V2-V3)/-j10 = 0

3) V3/j10 + (V3-V2)/-j10 + 2<-45 + (V3-V1)/20 = 0

4) Ix = -V3/j10

where: j is sqrt of -1 all V's and I are phasors 2<-45 is 2 angle -45

And if the HP 48g is not able to do this, do you know if the 49 is able to do so? I have had my calcualtor for about 8 years and I was thinking of upgrading anyways. Thanks again for the help! Tiffany

                  
Re: HP 48g+: How do I solve multiple eqns with multiple variables?
Message #4 Posted by Gerson W. Barbosa on 14 Nov 2005, 12:39 p.m.,
in response to message #3 by Tiffany

Using the given program, you'd enter the four equations and the list of unknowns on the stack:

'V1-V2 = 10*IX'

'V1/(0,20) + (V1-V3)/20 + V2/10 + (V2-V3)/(0,-10) = 0'

'V3/(0,10) + (V3-V2)/(0,-10) + (2,|_-45) + (V3-V1)/20 = 0'

'IX = -V3/(0,10)'

{V1 V2 V3 IX}

In the second equation, |_ stands for the angle symbols (right arrow + SPC). Notice that if your calculator is in rectangular mode, as soon as you enter this equation (2,|_-45) will be automatically converted to rectangular coordinates.

After entering these five objects, just press SYS. The answer will show up in about 15 seconds. It is necessary to press left arrow + EVAL, that is, ->NUM, since the answer will be in a rational form. It will be convenient to identify the section at the end of the program that does this and eliminate it.

If I haven't made any mistake, the answer will be:

V1=(-1.886,-24.513)
V2=(-1.886,-5.657)
V3=(-18.856,0.000)
IX=(0.000,-1.886)

Change the coordinate mode to polar, if you need the answer this way. You might want to press EQS in the menu, then VIEW, and check if the equations were keyed in correctly.

You should replace IX in the first equation with -V3/(0,10), so that you have to solve a 3x3 system rather than a 4x4 one.

As you can see, there's no need to upgrade your 48G+ just because of this. By the way, I haven't been able to put this program to work in the 49G (perhaps I should also read the manual).

Regards,

Gerson.

--------------------------

P. S.:

You can copy and paste the program to a file named LSYS, for instance, and then transfer it to the 48G+ (ASCII, cksum=3, translate=2). Or create a directory named 'LSYS' and key in both programs.

Just replace

\<- with <- (right arrow + 0)

Save the first program as '.<-' and the second as 'SYS', in this order.

                        
Re: HP 48g+: How do I solve multiple eqns with multiple variables?
Message #5 Posted by Tiffany on 14 Nov 2005, 1:31 p.m.,
in response to message #4 by Gerson W. Barbosa

Thank you so much for your help!! Tiffany

                              
Re: HP 48g+: How do I solve multiple eqns with multiple variables?
Message #6 Posted by Ed Look on 14 Nov 2005, 2:40 p.m.,
in response to message #5 by Tiffany

Hold on to that 48G+!! It's hard to "upgrade" that unless you get a 48GX or... dream of dreams... get a 41CX!

                              
Re: HP 48g+: How do I solve multiple eqns with multiple variables?
Message #7 Posted by Gerson W. Barbosa on 14 Nov 2005, 3:25 p.m.,
in response to message #5 by Tiffany

You're welcome!

I wrote:

Quote:
It will be convenient to identify the section at the end of the program that does this and eliminate it.

Just remove \->Q in the 9th line from the last.

Correction: This program won't run on the HP-28S and on the 48 series, because they lack the COL+ instruction . This is due to a slight modification I made later. Matheus's original program ends like this:

    FOR i DUP i GET 
l i GET STO -1
    STEP VET ARRY\-> 
DROP {n 1} \->ARRY 
'VET' STO DROP
  

Regards,

Gerson


[ Return to Index | Top of Index ]

Go back to the main exhibit hall