help with solving equations with complex values and or phasors
04-22-2016, 07:03 AM
Post: #1
 itsamecameron Junior Member Posts: 2 Joined: Apr 2016
help with solving equations with complex values and or phasors
Hello I am a EE student and I really need help. I have looked in the manual and online and I can not find any way to solve a system of equations with complex values in either polar or rectangular forms.

A quick example of what I am trying to do ill use "<" to represent an angle for a number in polar format i.e. a phasor 5.5<25volts, and j to be the square root of -1 for a number in rectangular format i.e. 4.98+j2.32.

I did a mesh analysis on a circuit and came up with with:

I*(50+40+j*497.418+330)-7<0=0

I need to solve for I, I did this by hand simply by moving the 7<0 over to the right hand side and then dividing by (50+40+j*497.418+330). So I got I = (7<0/(50+40+j*497.418+330)) = 1.075*10^-2 <-49.823 A. This is verified to be the correct answer with my professor.

Now doing that by hand is not a big deal, but when I need to solve say 3 equations with 3 unknowns containing complex values then i'm in real trouble as that would take way longer than I would have on the exam.

Can someone please help, I have tried using the cZeros({X*(50+40+j*497.418+330)=7},{X}) function on the CAS system but get the wrong answer, and the normal solve app that is usually easy to use wont even give me a result just "constant" and "bad guess" errors. This should be possible as Ti-89 and N-spire as well as hp 50g can do it.
04-22-2016, 08:59 AM (This post was last modified: 04-22-2016 09:05 AM by Nigel (UK).)
Post: #2
 Nigel (UK) Senior Member Posts: 360 Joined: Dec 2013
RE: help with solving equations with complex values and or phasors
I have a couple of suggestions to make:
• I don't think you can use "j" for the square root of -1.
• I assume you are using blue-shifted "x" for the angle sign, not "<".
• Capital "I" is a Home variable and this isn't recognised by the CAS.
I entered, in CAS mode,
Code:
 csolve(a*(50+40+i*492.418+330)-7=0,a)
where "i" is blue-shifted "2", and received a complex number in rectangular form as the answer.

CAS mode doesn't seem to have a way to display complex numbers in polar form directly (strange! I hadn't noticed this before). However, in the catalogue there is a function "polar_coordinates" which takes a complex number as argument and returns a vector containing modulus and argument. doing this with the number given by csolve correctly reproduces the solution that you give.

Nigel (UK)
04-22-2016, 11:30 AM
Post: #3
 primer Member Posts: 135 Joined: Sep 2015
RE: help with solving equations with complex values and or phasors
(04-22-2016 07:03 AM)itsamecameron Wrote:  Can someone please help, I have tried using the cZeros({X*(50+40+j*497.418+330)=7},{X})

Hi, I simply tried : csolve(x*(50+40+i*497.418+330)=7)
and I got a result.
to be honnest I don't know your decimal separator setting (your "497.418". with my settings, this is below 500), so I got : 6.93e-3 - 8.21e-3 i

in hope its ok for you.

syntax : [c]solve(equation)
in CAS, I used lowercase 'x' not uppercase 'X'
one single var => no need to specify,
one single equation => no list to build.

primer
04-22-2016, 02:37 PM (This post was last modified: 04-22-2016 05:55 PM by Anders.)
Post: #4
 Anders Member Posts: 102 Joined: May 2014
RE: help with solving equations with complex values and or phasors
For a linear system of 3 equation with 3 unknowns (x, y, z), you can simply use matrix math (works also for complex coefficients and variables). Normalize the equations with the variables and coefficients on the left side of the = sign and the constant on the right side of the equal sign on paper first with all variables in the same order for all equations. Then Put the left hand side coefficient in a 3x3 matrix (just call it M1 for simplicity) and the right hand side values into a vector (say M2) and then simply do M1^-1 * M2 and then you have (x y z) in the resulting vector. You can do this directly in home view using [] function.

Example:
Lets say you have the following 3 equations:
(1+i)x + (3+i)y + (4-2i)z = 2i
(1+2i)x + (2+2i)y + (3+i)z = 3+i
1x+ iy +4iz = 1
A matrix for the left hand side and a vector for the right hand side on the form AX=B, where A is 3x3 matrix of al the coefficients and X is the (x,y,z) vector and B is the right hand side constant vector.
Multiply with the inverse of A on both side and you get X= A^(-1) * B.
See the screen capture below. The result is the (x,y,z) vector, i.e.
x= (-12-55i)/13, y = (7+69i)/13, z = (25-47i)/26
if you press blue shift Enter then you get the approximate value of x,y,z.
You can do this for larger or smaller systems as well, e.g. for a 4 variable and 4 equation system A is a 4x4 matrix and B is a 4x1 vector of the right hand constants.

Attached File(s) Thumbnail(s)

04-22-2016, 05:29 PM
Post: #5
 itsamecameron Junior Member Posts: 2 Joined: Apr 2016
RE: help with solving equations with complex values and or phasors
(04-22-2016 08:59 AM)Nigel (UK) Wrote:  I have a couple of suggestions to make:
• I don't think you can use "j" for the square root of -1.
• I assume you are using blue-shifted "x" for the angle sign, not "<".
• Capital "I" is a Home variable and this isn't recognised by the CAS.
I entered, in CAS mode,
Code:
 csolve(a*(50+40+i*492.418+330)-7=0,a)
where "i" is blue-shifted "2", and received a complex number in rectangular form as the answer.

CAS mode doesn't seem to have a way to display complex numbers in polar form directly (strange! I hadn't noticed this before). However, in the catalogue there is a function "polar_coordinates" which takes a complex number as argument and returns a vector containing modulus and argument. doing this with the number given by csolve correctly reproduces the solution that you give.

Nigel (UK)

Nigel this is exactly what I am looking for, the j and < where just for what I was typing here on my calc I used the shift 2 for i and the shift "multiply" for <. The csolve is giving good answers though. I have one other question, can you show me how to do it for more than one equation? would it be csolve(eqn1, eqn2, eqn3, a,b,c)? or some other way?
04-22-2016, 07:47 PM
Post: #6
 Nigel (UK) Senior Member Posts: 360 Joined: Dec 2013
RE: help with solving equations with complex values and or phasors
(04-22-2016 05:29 PM)itsamecameron Wrote:  I have one other question, can you show me how to do it for more than one equation? would it be csolve(eqn1, eqn2, eqn3, a,b,c)? or some other way?

csolve({eqn1, eqn2, eqn3},{a,b,c}) seems to work fine. This returns a list with one element - a vector with the solutions in x+iy format. If this list is in ANS, then the following command displays the solutions as a matrix in polar format, moduli in the first column and arguments in the second column:
Code:
 map(Ans[1],x->polar_coordinates(x))

There doesn't seem to be a nice way to display complex results in polar format in CAS mode - am I missing something here?

Nigel (UK)
04-22-2016, 08:31 PM
Post: #7
 Tim Wessman Senior Member Posts: 2,226 Joined: Dec 2013
RE: help with solving equations with complex values and or phasors
(04-22-2016 07:47 PM)Nigel (UK) Wrote:  There doesn't seem to be a nice way to display complex results in polar format in CAS mode - am I missing something here?

No. The CAS does not support complex results in any other forms.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
04-26-2016, 01:28 AM
Post: #8
 BERNARD MICHAUD Member Posts: 116 Joined: Aug 2015
RE: help with solving equations with complex values and or phasors
Try Linear Solver+ from the Software Library HP Prime. Don't know if that's what your looking for. It uses Matrix with RREF and is similar to the Linear Solver App and lets you input Linear Equations beyond 3x3. And works with Real and Complex numbers.
 « Next Oldest | Next Newest »

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