Post Reply 
Extra arguments (FLAGS) to c/solve and other CAS commands
03-27-2015, 08:15 PM (This post was last modified: 03-28-2015 02:14 PM by compsystems.)
Post: #1
Extra arguments (FLAGS) to c/solve and other CAS commands
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
Find all posts by this user
Quote this message in a reply
03-27-2015, 10:04 PM
Post: #2
RE: Extra arguments (FLAGS) to c/solve and other CAS commands
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.
Find all posts by this user
Quote this message in a reply
03-27-2015, 11:17 PM (This post was last modified: 03-27-2015 11:22 PM by compsystems.)
Post: #3
RE: Extra arguments (FLAGS) to c/solve and other CAS commands
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

[Image: complex_definition1.gif]

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 =)
Find all posts by this user
Quote this message in a reply
03-27-2015, 11:50 PM (This post was last modified: 03-28-2015 01:57 PM by compsystems.)
Post: #4
RE: Extra arguments (FLAGS) to c/solve and other CAS commands
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
Find all posts by this user
Quote this message in a reply
03-28-2015, 07:02 AM
Post: #5
RE: Extra arguments (FLAGS) to c/solve and other CAS commands
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.
Find all posts by this user
Quote this message in a reply
03-28-2015, 01:45 PM (This post was last modified: 03-28-2015 02:23 PM by compsystems.)
Post: #6
RE: Extra arguments (FLAGS) to c/solve and other CAS commands
(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
Find all posts by this user
Quote this message in a reply
03-28-2015, 06:19 PM
Post: #7
RE: Extra arguments (FLAGS) to c/solve and other CAS commands
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...
Find all posts by this user
Quote this message in a reply
03-28-2015, 06:42 PM (This post was last modified: 03-28-2015 06:47 PM by compsystems.)
Post: #8
RE: Extra arguments (FLAGS) to c/solve and other CAS commands
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
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)