HP Prime Solving Nonlinear System of Equations for Complex Results « Next Oldest | Next Newest »

 ▼ Helge Gabert Unregistered Posts: 113 Threads: 20 Joined: Sep 2013 09-29-2013, 12:51 PM 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). ▼ Clayton Workman Unregistered Posts: 15 Threads: 1 Joined: Sep 2013 09-29-2013, 01:26 PM 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 ▼ Helge Gabert Unregistered Posts: 113 Threads: 20 Joined: Sep 2013 09-29-2013, 01:51 PM 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 . . . ▼ Clayton Workman Unregistered Posts: 15 Threads: 1 Joined: Sep 2013 09-29-2013, 01:53 PM Oops... I misread the title of your post as "linear" instead of "nonlinear". My apologies. -Clayton ▼ Clayton Workman Unregistered Posts: 15 Threads: 1 Joined: Sep 2013 09-29-2013, 02:04 PM 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 ▼ Helge Gabert Unregistered Posts: 113 Threads: 20 Joined: Sep 2013 09-29-2013, 02:35 PM 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" ▼ From Hong Kong Unregistered Posts: 125 Threads: 5 Joined: Jun 2008 09-29-2013, 02:49 PM In HOME mode, use FNROOT instead of fsolve: FNROOT(COS(X)=X,X) ▼ Helge Gabert Unregistered Posts: 113 Threads: 20 Joined: Sep 2013 09-29-2013, 03:01 PM 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! From Hong Kong Unregistered Posts: 125 Threads: 5 Joined: Jun 2008 09-29-2013, 02:31 PM 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. ▼ Helge Gabert Unregistered Posts: 113 Threads: 20 Joined: Sep 2013 09-29-2013, 02:40 PM YES! Thanks so much! ▼ Helge Gabert Unregistered Posts: 113 Threads: 20 Joined: Sep 2013 09-29-2013, 03:42 PM . . . 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. ▼ From Hong Kong Unregistered Posts: 125 Threads: 5 Joined: Jun 2008 09-30-2013, 03:44 AM 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,904 12-06-2013, 02:36 PM Last Post: parisse [HP Prime] Plots containing complex numbers bug? Chris Pem10 7 3,635 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,889 11-21-2013, 08:25 PM Last Post: Chris Pem10 Complex Number Entry on Prime Jeff O. 19 5,143 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,727 11-06-2013, 12:22 AM Last Post: Michael de Estrada HP-PRIME CAS SOLVING fabrice48 8 2,787 10-19-2013, 01:21 PM Last Post: Han hp prime - sending program results to the stack giancarlo 6 2,088 10-15-2013, 02:00 AM Last Post: Giancarlo HP Prime complex results Javier Goizueta 0 982 10-06-2013, 12:59 PM Last Post: Javier Goizueta [HP-Prime xcas] operations with complex numbers + BUGs + Request CompSystems 9 3,461 09-08-2013, 10:40 PM Last Post: CompSystems New article on a new type of neo linear equations Namir 0 1,287 08-11-2013, 10:27 AM Last Post: Namir

Forum Jump: