HP Prime Solving Nonlinear System of Equations for Complex Results



#13

Apparently, the built-in App (Solve) doesn't allow complex starting values, and doesn't search for complex solutions - - or does it?

I tried to use csolve(), but that only allows a single equation to be entered, and also fsolve(), but the syntax is not clear to me. The help screen states, that a numerical solution of a system of equations can be returned, but the syntax given is fsolve(Expr, Var, [Guess or interval], [Method]). I'm not sure how to use this with more than one non-linear equation.

By the way, how many methods are there to choose from? Not clear from the user's guide).

I'm really looking for something like Sune Bredahl's excellent Solvesys for the HP49G+ and HP50G (couldn't something along those lines have been implemented for the Prime?), or even like the somewhat clunkier and slower MSLV (both return complex solutions).

For the built in solver (numeric view), some diagnostic output would be helpful as well (convergence, # iterations, etc.), along with an indication that the solver is running (so that he user isn't staring at a static screen, wondering if the Solve softkey has been tapped successfully).


#14

You can get complex results by using the reduced row echelon method of solving a linear system.

For example, suppose you have the following two equations:

(5+6i)x + (3+8i)y = 9

(2+4i)x + (-3+5i)y = 4.5+6i

You would create a matrix (i.e., M1) as follows:

5+6i 3+8i 9

2+4i -3+5i 4.5+6i

Now use the command RREF(M1) and you will get the following resulting matrix (I'm rounding the values for simplicity):

1 0 0.058+0.410i

0 1 0.196-1.322i

which means x=0.058+0.410i and y=0.196-1.322i.

Using this method, you can solve a linear system with pretty much any number of equations (well except for the limitations that the prime has on matrix sizes.)

Hope this helps.

-Clayton


#15

Yes this works for a linear, complex system - - thanks for the tip with RREF!

However, if the complex system is non-linear in the parameters . . .


#16

Oops... I misread the title of your post as "linear" instead of "nonlinear". My apologies.

-Clayton


#17

It looks like fsolve should do it, but even the example in the help section for fsolve causes an error in both home and CAS mode.

-Clayton


#18

The example given for fsolve, i.e., fsolve(COS(x)=x,x)

works for me in CAS mode, returns .739...

Not in home mode, though, fsolve(COS(X)=X,X) returns "undef"


#19

In HOME mode, use FNROOT instead of fsolve:

FNROOT(COS(X)=X,X)


#20

Yes, that works! - - but not for systems of equations.

Thanks - - so for this problem (one variable nonlinear equation) use FNROOT in Home, and csolve in CAS!

#21

Use the cZeros function in CAS mode. Suppose there is a system of non-linear equations as follows:

x^2+y^2=1

y=-x-3

The input form is cZeros({x^2+y^2=1,y=-x-3},{x,y}). You'll get the result you want.

Edited: 29 Sept 2013, 2:33 p.m.


#22

YES! Thanks so much!


#23

. . . with the caveat, that cZeros seems to be only working for polynomials, and not for general non-linear equations. try it and you will get an error, e.g., [x, x^y, sin (x*y)] is not rational w.r.t.


#24

It isn't supported for the moment.

Edited: 30 Sept 2013, 3:45 a.m.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime: complex numbers in CAS. Alberto Candel 1 1,925 12-06-2013, 02:36 PM
Last Post: parisse
  [HP Prime] Plots containing complex numbers bug? Chris Pem10 7 3,673 12-05-2013, 07:40 AM
Last Post: cyrille de Brébisson
  [HP Prime] Tips for Solving Differential Equations More Efficiently Chris Pem10 8 2,966 11-21-2013, 08:25 PM
Last Post: Chris Pem10
  Complex Number Entry on Prime Jeff O. 19 5,203 11-16-2013, 12:34 PM
Last Post: Jeff O.
  PRIME: re-format the flash drive to recover the operating system Harold A Climer 2 1,745 11-06-2013, 12:22 AM
Last Post: Michael de Estrada
  HP-PRIME CAS SOLVING fabrice48 8 2,886 10-19-2013, 01:21 PM
Last Post: Han
  hp prime - sending program results to the stack giancarlo 6 2,115 10-15-2013, 02:00 AM
Last Post: Giancarlo
  HP Prime complex results Javier Goizueta 0 1,001 10-06-2013, 12:59 PM
Last Post: Javier Goizueta
  [HP-Prime xcas] operations with complex numbers + BUGs + Request CompSystems 9 3,537 09-08-2013, 10:40 PM
Last Post: CompSystems
  New article on a new type of neo linear equations Namir 0 1,307 08-11-2013, 10:27 AM
Last Post: Namir

Forum Jump: