04-16-2017, 03:38 PM
Hi, I have a concern when the next system is resolved for the second case (x=11/4 and y=1/4), fails, why?
cplx1:=(x^2+2*y^2)+(x*i+y*i);
cplx2:=(x*y+7)+3*i;
expr1:=(cplx1 = cplx2);
answer1 := csolve(expr1,x); →
{(1/2)*(y+√(-7*y^2+(-6*i)*y+27+12*i)-i), (1/2)*(y-√(-7*y^2+(-6*i)*y+27+12*i)-i)}
wolfram
// By property of equality of complex numbers on expr1 (a+b*i = c+d*i) <=> a=c & b=d
{(x^2+2*y^2) = (x*y+7), (x+y) = 3}
answer2 := solve({ re(expr1), im(expr1)}, {x,y}); →
{[1,2],[11/4,1/4]} // (x=1 and y=2) or (x=11/4 and y=1/4)
test for (x=1 and y=2)
subst(expr1,{x = 1,y = 2}) →
(9+3*i) = (9+3*i)
evalb(Ans) → true // Xcas cmd
but
subst(answer1(1),y=2); → 1 // x=1 // ok
test for (x=11/4 and y=1/4)
subst(expr1,{x = 11/4,y = 1/4}) →
((1/8)+(121/16)+3*i) = (123+48*i)/16
evalb(Ans) → true
but
subst(answer1(2),y=1/4.); → -2.5-i // x=-2.5-i ?? -> x = 11/4
cplx1:=(x^2+2*y^2)+(x*i+y*i);
cplx2:=(x*y+7)+3*i;
expr1:=(cplx1 = cplx2);
answer1 := csolve(expr1,x); →
{(1/2)*(y+√(-7*y^2+(-6*i)*y+27+12*i)-i), (1/2)*(y-√(-7*y^2+(-6*i)*y+27+12*i)-i)}
wolfram
// By property of equality of complex numbers on expr1 (a+b*i = c+d*i) <=> a=c & b=d
{(x^2+2*y^2) = (x*y+7), (x+y) = 3}
answer2 := solve({ re(expr1), im(expr1)}, {x,y}); →
{[1,2],[11/4,1/4]} // (x=1 and y=2) or (x=11/4 and y=1/4)
test for (x=1 and y=2)
subst(expr1,{x = 1,y = 2}) →
(9+3*i) = (9+3*i)
evalb(Ans) → true // Xcas cmd
but
subst(answer1(1),y=2); → 1 // x=1 // ok
test for (x=11/4 and y=1/4)
subst(expr1,{x = 11/4,y = 1/4}) →
((1/8)+(121/16)+3*i) = (123+48*i)/16
evalb(Ans) → true
but
subst(answer1(2),y=1/4.); → -2.5-i // x=-2.5-i ?? -> x = 11/4
PHP Code:
//evalBool
#cas
evalb( exprIn ):=
begin
return( ifte( subst(exprIn, '=','==' ), "true", "false") );
end;
#end