HP Prime Solving Nonlinear System of Equations for Complex Results - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: HP Prime Solving Nonlinear System of Equations for Complex Results (/thread-251701.html) HP Prime Solving Nonlinear System of Equations for Complex Results - Helge Gabert - 09-29-2013 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). Re: HP Prime Solving Nonlinear System of Equations for Complex Results - Clayton Workman - 09-29-2013 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 Re: HP Prime Solving Nonlinear System of Equations for Complex Results - Helge Gabert - 09-29-2013 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 . . . Re: HP Prime Solving Nonlinear System of Equations for Complex Results - Clayton Workman - 09-29-2013 Oops... I misread the title of your post as "linear" instead of "nonlinear". My apologies. -Clayton Re: HP Prime Solving Nonlinear System of Equations for Complex Results - Clayton Workman - 09-29-2013 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 Re: HP Prime Solving Nonlinear System of Equations for Complex Results - From Hong Kong - 09-29-2013 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. Re: HP Prime Solving Nonlinear System of Equations for Complex Results - Helge Gabert - 09-29-2013 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" Re: HP Prime Solving Nonlinear System of Equations for Complex Results - Helge Gabert - 09-29-2013 YES! Thanks so much! Re: HP Prime Solving Nonlinear System of Equations for Complex Results - From Hong Kong - 09-29-2013 In HOME mode, use FNROOT instead of fsolve: FNROOT(COS(X)=X,X) Re: HP Prime Solving Nonlinear System of Equations for Complex Results - Helge Gabert - 09-29-2013 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! Re: HP Prime Solving Nonlinear System of Equations for Complex Results - Helge Gabert - 09-29-2013 . . . 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. Re: HP Prime Solving Nonlinear System of Equations for Complex Results - From Hong Kong - 09-30-2013 It isn't supported for the moment. Edited: 30 Sept 2013, 3:45 a.m.