Extra arguments (FLAGS) to c/solve and other CAS commands - 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: Extra arguments (FLAGS) to c/solve and other CAS commands (/thread-3495.html) |
Extra arguments (FLAGS) to c/solve and other CAS commands - compsystems - 03-27-2015 08:15 PM Sorry for bad English The hpprime is designed for educational environment no engineering. consequently simple improvements on CAS, increase the didactic power. [HP PRIME CAS (2013)] solve(x^2+x*y+y^2=0,y) => RETURNS {} :~[ cSolve(x^2+x*y+y^2=0,x) => RETURNS { (i*y*√(3)-y)/2, (−i*y*√(3)-y)/2 } OK But the format is not eligible cSolve(x^2+x*y+y^2=0,y) => RETURNS { (i*x*√(3)-x)/2, (−i*x*√(3)-x)/2 } That tells us the above equation, there is no solution in the real plane, only in the complex plane [TI68K(1996) or TI NSPIRE CAS(2006)] cSolve(x^2+x*y+y^2=0,x) => RETURNS x = (- 1/2 + (√(3)/2)*i ) * y x = (- 1/2 - √(3)/2)*i ) * y cSolve(x^2+x*y+y^2=0,y) => RETURNS y = (- 1/2 + (√(3)/2)*i) * x y = (- 1/2 - √(3)/2)*i ) * x shows also the solution as equation, with of the unknown variable, organizes the complex number a + b * i real part first and then imaginary part if the output is best organized, the student detect that is an equation a straight line y=m*x+b, good is a degenerate conic matlab can add optional flags to commands My idea is to be incorporated into xcas and HPPime CAS sample [HP PRIME CAS+ (2015)] solve(x^2+x*y+y^2=0,y, real) => RETURNS {} solve(x^2+x*y+y^2=0,y, real, prettyPRT) => RETURNS "NO REAL SOLUTIONS" solve(x^2+x*y+y^2=0,y, complex ) => RETURNS { (i*x*√(3)-x)/2, (−i*x*√(3)-x)/2 } solve(x^2+x*y+y^2=0,y, complex, prettyPRT ) => RETURNS { y = (- 1/2 + (√(3)/2)*i ) * x y = (- 1/2 - √(3)/2)*i) * x } GOOD IDEA? see the imaginary unit right into a complex expression +1 or -1 RE: Extra arguments (FLAGS) to c/solve and other CAS commands - Bill_G - 03-27-2015 10:04 PM In an HP Prime program, after manipulating complex numbers the Print (or Return) gives the answer in the desired common forms of: a+b*i or in polar form. Yes, it will be nice for other commands (like the one in your example) that result in a complex number to show the answer in the above common forms. RE: Extra arguments (FLAGS) to c/solve and other CAS commands - compsystems - 03-27-2015 11:17 PM Entering an expression or complex number, are written normal as a+i*b, the standard is i right, should be a flag to choose if you want to see on the left or right http://en.wikipedia.org/wiki/Complex_number (a+b*i) => (a+i*b) =( (a+b*i) +(c+d*i) => (a+i*b)+(c+i*d) =( I think should evaluate directly, and EVALC command should be called EVALCPLX evalC( (a+b*i) +(c+d*i) )=> (a+c) + i*(b+d) =( evalC( (a+b*i) +(c+d*i) )= (a+c) + (b+d)*i =) evalC(e^i*x) => cos(x)+i*sin(x) =( evalC(e^i*x) => cos(x)+sin(x) *i =) RE: Extra arguments (FLAGS) to c/solve and other CAS commands - compsystems - 03-27-2015 11:50 PM 4√(-16) => (-16)^(1/4) =>(4 NTHROOT -16 ) =>(1+i)* √(2) OK eval(ans) => √(2)+i*√(2) in this case if put i the end (right) =) approx(ans) => 1.41421356237+1.41421356237*i 4√(-16.) => 1.41421356237+1.41421356237*i (-8)^(1/3) => i*√(3) +1 (-8.)^(1/3) => 1.+1.73205080757*i In EXACT mode places the imaginary unit on the left part =( and in APPROXIMATE mode on the RIGHT. =) in both modes should place it to the right RE: Extra arguments (FLAGS) to c/solve and other CAS commands - parisse - 03-28-2015 07:02 AM If you want to see a complex number in rectangular form, you can use evalc inside Xcas. It's most of the time better not to infer what the user want for the answer and keep automatic simplification to the minimum. For conics, the command reduced_conic will show you all the information about the conic (here it will show that it's a degenerated ellipsis in R^2, it's a pair of lines in C^2 but that's generally not a pertinent information and you could get it with cfactor(,sqrt(3))). I don't see why I should add something to csolve. RE: Extra arguments (FLAGS) to c/solve and other CAS commands - compsystems - 03-28-2015 01:45 PM (03-28-2015 07:02 AM)parisse Wrote: If you want to see a complex number in rectangular form, you can use evalc inside Xcas. just what I want is to see the imaginary unit right into a complex expression in EXACT MODE, may be also the user to choose by a flag, right or left (03-28-2015 07:02 AM)parisse Wrote: I don't see why I should add something to csolve. Optional parameters to handle just one command SOLVE. SOLVE ( eq[s], [var], real/complex[flag], vareq[flag] ) The third argument (flag) indicates if you want to get real or (complex and real) answers, this argument is now available using SOLVE or cSolve, but why not make one SOLVE the fourth argument indicates whether to include the variable, to view it as an equation y = sol, x =sol etc, This option is not available HPPRIME, I would like to see it as an optional flag. In the ti68k is defined by default =( PD: also required, a similar command QPI (-8)^(1/3) => 1+√(3)*i (-8.)^(1/3) => 1.+1.73205080757*i exact(1.+1.73205080757*i) => 1+( 978122/564719 )*i =( => 1+√(3) *i. (-8)^(1/3) => 1+√(3)*i +1 OK ( 1+√(3)*i )^3= -8 by pressing one second enter search other roots (-8)^(1/3) [ENTER] 1+√(3)*i [ENTER] -2 RE: Extra arguments (FLAGS) to c/solve and other CAS commands - parisse - 03-28-2015 06:19 PM Inside Xcas, you can select TI-like answers for solve/csolve by selecting the TI compatibility mode. I don't see much interest in having the answer like TI returns it, because it is more difficult to reuse later, that's why it is not the default. Having options for that is an idea, but it's not high on my list... RE: Extra arguments (FLAGS) to c/solve and other CAS commands - compsystems - 03-28-2015 06:42 PM but the user decides by a flag if you want to see the answers in this way y=..., default off and visualize the imaginary unit. on the right? as is the vast majority of math books, and the command QPIroot need this function for beautiful math prints |