Get only real results

Issue #153 closed
Former user created an issue

Hi,

I run the next code:

IExpr exp = util.evaluate("Solve(x^2+y^2==5,x)");

and gets the next results: {{x->-ISqrt(-5+y^2)},{x->ISqrt(-5+y^2)}}

I want to be able to get only the "real" solutions, and also get them in non complex format: x->Sqrt(y^2-5)

How can I do it?

Comments (4)

  1. Axel Kramer repo owner

    This requires ConditionalExpression's whihch are not implemented yet.

    One solution is for example:

    ConditionalExpression(Sqrt(5 - y^2), -Sqrt(5) < y && y < Sqrt(5))
    
  2. Yehonatan Yochpaz

    Is there a way to get the "real" results in "real" format:

    f.e, in the example above: {{x->-ISqrt(-5+y^2)},{x->Sqrt(y^2-5)}}

    and not: {{x->-ISqrt(-5+y^2)},{x->ISqrt(-5+y^2)}}

  3. Log in to comment