cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Require real solutions from the symbolic solver

jstavitsky
7-Bedrock

Require real solutions from the symbolic solver

I'd like to get  purely real solution out of the symbolic solver (ie not a product of i) - is it possible to require this? For example solving  x^2 +y^2 = 1 for x should return sqrt(1-y^2).

Am I just failing to use assume keyword correctly?

Thanks

Joe

ACCEPTED SOLUTION

Accepted Solutions
lturek
12-Amethyst
(To:jstavitsky)

Joseph Stavitsky wrote:

I'd like to get  purely real solution out of the symbolic solver (ie not a product of i) - is it possible to require this?

Sometimes, yes.

For example solving  x^2 +y^2 = 1 for x should return sqrt(1-y^2).

Why do you think that sqrt(1-y^2) is "purely" real? Thats only the case if y is real and |y|<1.

Furthermore it would be wrong if MC simply would return that single root as the correct solution is +- the root

Am I just failing to use assume keyword correctly?

How could we tell if you don't show what you are doing??

Unfortunately "assume" is a pita - it may work as expected but very often it doesn't and it may even be completely ignored in some cases.

So forcing MCs symbolics to avoid the imaginary unit in its results can be quite tricky and is unreliable.

Sometimes the order of the keywords matters and sometimes results look differently if, eg, you use a keyword like "simplify" twice. So quite often its a trial an error type of game.

LT

View solution in original post

2 REPLIES 2
lturek
12-Amethyst
(To:jstavitsky)

Joseph Stavitsky wrote:

I'd like to get  purely real solution out of the symbolic solver (ie not a product of i) - is it possible to require this?

Sometimes, yes.

For example solving  x^2 +y^2 = 1 for x should return sqrt(1-y^2).

Why do you think that sqrt(1-y^2) is "purely" real? Thats only the case if y is real and |y|<1.

Furthermore it would be wrong if MC simply would return that single root as the correct solution is +- the root

Am I just failing to use assume keyword correctly?

How could we tell if you don't show what you are doing??

Unfortunately "assume" is a pita - it may work as expected but very often it doesn't and it may even be completely ignored in some cases.

So forcing MCs symbolics to avoid the imaginary unit in its results can be quite tricky and is unreliable.

Sometimes the order of the keywords matters and sometimes results look differently if, eg, you use a keyword like "simplify" twice. So quite often its a trial an error type of game.

LT

correct on all counts ty

Announcements

Top Tags