HP Forums
Solve a System of complex equatoins - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Solve a System of complex equatoins (/thread-9214.html)



Solve a System of complex equatoins - kitsunekatari - 10-03-2017 07:16 AM

Hey everyone, new here obviously. Just purchased an HP Prime, coming from a TI89. Still trying to get used to the new syntax and commands.

How do I solve a system of complex equations?

such as;

-12+(-i4+i5)*A-i3*B
(12+i6)*B-i3*A

In the ti8 it was csolve( {-12+(-i4+i5)*A-i3*B,(12+i6)*B-i3*A},{A,B} )

But this is not the case with the HP Prime. Thoughts?

Thank you!


RE: Solve a System of complex equatoins - toshk - 10-03-2017 06:59 PM

In CAS: try
fsolve({-12+(-4*+5*)*A-3**B,(12+6*)*B-3**A},{'A','B'})
[/code]


RE: Solve a System of complex equatoins - Tim Wessman - 10-03-2017 07:53 PM

What is the significance of i4, i5, etc? Is it something specific or just "a variable"?


RE: Solve a System of complex equatoins - parisse - 10-03-2017 07:55 PM

csolve should work. Beware that fsolve is approx.


RE: Solve a System of complex equatoins - primer - 10-04-2017 08:24 PM

Hello
(10-03-2017 07:16 AM)kitsunekatari Wrote:  How do I solve a system of complex equations?

such as;

-12+(-i4+i5)*A-i3*B
(12+i6)*B-i3*A

Please first note those are not equations,
also important : on cas, you must use lowercase variable,
I added "=0" to have equations, and tried it :

csolve({-12+(4i+5i)*a-3i*b=0, (12+6i)*b-3i*a=0}, {a,b})

I got
{ (-16-8i)/(5-12i) , -4i/(5-12*i) }


RE: Solve a System of complex equatoins - Carsen - 10-04-2017 10:23 PM

Not necessary. I used capital letter "A" & "B" with csolve in CAS mode on the HP Prime and got the same answer as Primer.


RE: Solve a System of complex equatoins - AlexFekken - 10-05-2017 02:19 AM

Perhaps not necessary but perhaps it should. Expressions aren't equations, evaluating is not solving, etc.

I wouldn't mind if functions like the various *solve functions would generate an exception when being given an expression rather than an equation... It might actually prevent a lot of user errors at the "expense" of a trivial amount of overhead.


RE: Solve a System of complex equatoins - kitsunekatari - 10-05-2017 02:57 AM

(10-03-2017 07:53 PM)Tim Wessman Wrote:  What is the significance of i4, i5, etc? Is it something specific or just "a variable"?

They are imaginary. Standard syntax in EE is to use j followed by the quantity of said unit, in this case, Ohms.

Thank you everyone for your input. I am just trying to get used to the different syntax. In the 89, variables were variables, you put in x, it returns x, unless a value is stored in said variable. In the Prime, you put in A, or X, it returns 0 because nothing is stored in it. So sometimes it's hard to check to see if an equation simplifies correctly.


RE: Solve a System of complex equatoins - Joe Horn - 10-05-2017 03:12 AM

Most HP solvers, including cSolve, assume "=0" if the input expression is not an equation. You don't have to include it yourself. Prime's help screen for cSolve even says so explicitly:

HP Wrote:Syntax:
cSolve(Expr,[Var])

Returns the solutions, including complex solutions, of Expr, for Var.

If Expr is an expression, solves the equation Expr=0.

(10-05-2017 02:19 AM)AlexFekken Wrote:  Perhaps not necessary but perhaps it should. Expressions aren't equations, evaluating is not solving, etc.

There's actually a reason for it working this way. The solvers treat "=" as "-" and solve the resulting expression (which is not an equation) for equality to zero. That being the case, it's more efficient for both the user and the calculator to omit "=0" from the input.


RE: Solve a System of complex equatoins - AlexFekken - 10-05-2017 04:48 AM

(10-05-2017 03:12 AM)Joe Horn Wrote:  There's actually a reason for it working this way. The solvers treat "=" as "-" and solve the resulting expression (which is not an equation) for equality to zero. That being the case, it's more efficient for both the user and the calculator to omit "=0" from the input.
I get the convenience of it, but I guess I am too much of a mathematician to appreciate the sloppiness. And a C programmer would probably argue that "!= 0" must have been omitted :-)


RE: Solve a System of complex equatoins - toml_12953 - 10-05-2017 05:55 PM

(10-05-2017 04:48 AM)AlexFekken Wrote:  
(10-05-2017 03:12 AM)Joe Horn Wrote:  There's actually a reason for it working this way. The solvers treat "=" as "-" and solve the resulting expression (which is not an equation) for equality to zero. That being the case, it's more efficient for both the user and the calculator to omit "=0" from the input.
I get the convenience of it, but I guess I am too much of a mathematician to appreciate the sloppiness. And a C programmer would probably argue that "!= 0" must have been omitted :-)

in most computer languages you can do this:

if x then...

and the language assumes you mean

if x<>0 then...


RE: Solve a System of complex equatoins - AlexFekken - 10-06-2017 07:44 AM

(10-05-2017 05:55 PM)toml_12953 Wrote:  in most computer languages you can do this:

if x then...

and the language assumes you mean

if x<>0 then...

Exactly my point: it does *not* mean "if x = 0 then ..."


RE: Solve a System of complex equatoins - primer - 10-06-2017 02:56 PM

(10-05-2017 02:57 AM)kitsunekatari Wrote:  In the Prime, you put in A, or X, it returns 0 because nothing is stored in it. So sometimes it's hard to check to see if an equation simplifies correctly.

in the prime, that's easy too : go to CAS mode, and use lowercase
Then you will see x will be x, not 0.


RE: Solve a System of complex equatoins - toml_12953 - 10-07-2017 04:35 AM

(10-06-2017 07:44 AM)AlexFekken Wrote:  
(10-05-2017 05:55 PM)toml_12953 Wrote:  in most computer languages you can do this:

if x then...

and the language assumes you mean

if x<>0 then...

Exactly my point: it does *not* mean "if x = 0 then ..."

You're right. It's not very consistent, is it?