Real and Complex

How can i avoid this error?

that happens 'cause I have 3 different solution for Vv:

> Vv3:=Re(solve(eq1,Vv)[3]);

 

In this way I can avoid it but solutions is not real...is complex!Ideas?

 

> Vv1:=Re(solve(eq1,Vv)[1]);

> Vv2:=Re(solve(eq1,Vv)[2]);

 

> solutions:=Re(solve({eq1},{Vv}));

Error, invalid input: Re expects 1 argument, but received 3

How can i avoid this error?

How can i avoid this error?

> solutions:=Re(solve({eq1},{Vv}));

Error, invalid input: Re expects 1 argument, but received 3

that happens 'cause I have 3 different solution for Vv:

> Vv3:=Re(solve(eq1,Vv)[3]);

> Vv1:=Re(solve(eq1,Vv)[1]);

> Vv2:=Re(solve(eq1,Vv)[2]);

 

In this way I can avoid it but solutions is not real...is complex!Ideas?

 Ps:sorry for double post but i have a lot of problems to do the first one!

Axel Vogt's picture

use the command 'map'

  x^3+x^2+1;         # the equation
  S:=[solve(%,x)]:   # the solutions
  nops(S);           # there are 3 solutions
  map(Re,S):         # does what you want 
  simplify(%, size); # simplify it

Ty...

Ty...

acer's picture

real solutions

I suspect (but am not 100% sure) that the submitter wants to select the purely real solutions from solve's output, and not just to extract the real part of the returned solutions. Apologies, if I've interpreted that incorrectly.

Zro85, the Re() command will extract the real component. But the real component of any of the complex solutions may not also be a solution. It's not clear that you realize this, about Maple's Re() command. Is it clear?

If you search this site for the pair "RealDomain" and "solve" you will find other posts that discuss the question of getting only purely real solutions to an equation or system of equations.

acer

I understood what you

I understood what you mean...I will see those articles!

Axel Vogt's picture

point taken

Ok. But looking at x^2 + const (or similar) shows that this is a bit senseless as question, as it is too general - or needs care for the special case(s).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}