That is probably doable, but support for working with piecewise
expressions would need to be much better, or else the expressions will
get too unwieldy.  But given that, I think it's just an issue of
noting that sqrt(x**2) is x if x >= 0 and -x if x <= 0 (for real x).
I'm not saying it's trivial to implement, but I do think it's doable.
Simplifying Piecewise expressions is also probably quite doable.

Aaron Meurer

On Sat, Jun 1, 2013 at 2:21 PM, Lucas Wilkins
<[email protected]> wrote:
> Perhaps it should aim to always produce a structured result. Like:
>
> / -sqrt(y) y = 0
> |
> \ sqrt(y) y >= 0
>
> Then have a redundancy checker that converts it to one of a set of canonical
> forms, i.e. either
>
> / -sqrt(y) y = 0
> |
> \ sqrt(y) y > 0
>
> or just, sqrt(y), without worrying about which one it makes, just that they
> don't overlap. From there use a piecewise simplification algorithm.
>
> But solvers.py is mental and I have no idea how it works. Perhaps what I'm
> saying is just completely unrealistic.
>
>
> On Friday, 31 May 2013 20:46:15 UTC+1, Aaron Meurer wrote:
>>
>> I mean the number zero, as you described (sorry, I was using my proper
>> English and writing out the number instead of writing 0).
>>
>> You can open an issue for it if you want. I'm not convinced at this
>> point what exactly it should do, if anything. Definitely doing
>> something more advanced will require better deduction on the part of
>> the assumptions system.
>>
>> Aaron Meurer
>>
>> On Thu, May 30, 2013 at 4:48 PM, Lucas Wilkins
>> <[email protected]> wrote:
>> > Do you mean sympy.core.numbers.Zero? Or do mean the general problem that
>> > symbolically, zero is often the same as lack of objects?
>> >
>> > Should I flag it as an issue?
>> >
>> > On Thursday, 30 May 2013 21:46:53 UTC+1, Lucas Wilkins wrote:
>> >>
>> >> Hi, I've found some inappropriate behaviour of the solve function.
>> >>
>> >>     >>> x,y = symbols("x y", real=True, nonnegative=True)
>> >>     >>> solve(y-x**2,x)
>> >>     [-sqrt(y), sqrt(y)]
>> >>
>> >> The only non-negative case where both sqrt(y) and -sqrt(y) should be
>> >> solutions is where y=0, in which case they are equal and not different
>> >> after
>> >> all. It's quite annoying if there should be a single solution of zero!
>> >>
>> >> It should really work like positives:
>> >>
>> >>     >>> x,y = symbols("x y", real=True, positive=True)
>> >>     >>> solve(y-x**2,x)
>> >>     [sqrt(y)]
>> >>
>> >> I didn't submit an issue because I was not sure if it was deliberate
>> >> (perhaps for making floats work properly?).
>> >>
>> >> :L
>> >>
>> >>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "sympy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to [email protected].
>> > To post to this group, send email to [email protected].
>> > Visit this group at http://groups.google.com/group/sympy?hl=en-US.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to