After currently using Mathematica for similar things, I would just like to
encourage you to provide some nice method to simplify constraints of
piecewise functions using your simplifier, including additional constraints
on the range of variables (as SymPy doesn't have a way to put ranges on
variables). That doesn't really exist in Mathematica (Assuming[...,
Simplify[piecewise]) doesn't always seems to simplify as far as possible).

Something like
simplify_piecewise_range(piecewisefunction, common_constraints)
That adds the common_constraints to each region constraint and applies your
method. (Possibly, optionally, removing the common_constraints from the
final regions if feasible.)

This would be really useful in some situations and a place where
Mathematica (at least with my level of knowledge) can be improved, so with
this SymPy would in fact be more powerful than Mathematica.

Btw, the corresponding Mathematica-function is called Reduce
https://reference.wolfram.com/language/ref/Reduce.html

There is an old PR which may be useful to revive in relation to this:
https://github.com/sympy/sympy/pull/17443 although sort of independent.

It will also be useful to have a function that can replace Min/Max
expressions with linear inequalities (and possibly back again). Right now
there is some logic to convert from linear inequalites to Min/Max, but not
back. As far as I recall. (There may be a PR doing the Min/Max to linear as
well, but not really sure.)

BR Oscar


‪Den tors 18 feb. 2021 kl 11:57 skrev ‫אוריאל מליחי‬‎ <
orielmali...@gmail.com>:‬

> I understand.
>
> So I would use the LP solver implemented by Lee which should work with
> symbolic coefficients.
>
> On Thu, 18 Feb 2021 at 00:46, Oscar Benjamin <oscar.j.benja...@gmail.com>
> wrote:
>
>> ‪On Tue, 16 Feb 2021 at 17:01, ‫אוריאל מליחי‬‎ <orielmali...@gmail.com>
>> wrote:‬
>> >
>> > For your first question, I intend to create a new function that when
>> given a set of linear inequalities and a target inequality it would output
>> True if the target is implied by this set, False if it is not, and Unknown
>> otherwise. I wrote doctests to make it all more clear.
>> >
>> > You can see it here –
>> >
>> > https://github.com/orielmalihi/Final-Project/blob/main/iset%20tests.py
>>
>> That would be useful in sympy.
>>
>> > For your second question, I intended to use Scipy LP solver, but as far
>> as I can tell it only works with floats. I could convert every coefficient
>> to float using the 'evalf()' function but then we would get 99.9% accurate
>> results and not 100%.
>>
>> We can't use scipy as part of sympy because sympy does not "depend" on
>> scipy. In sympy we want to handle the symbolic case. The *minimum* we
>> would want for an implementation in sympy is something that handles
>> systems with rational coefficients without *any* rounding error. The
>> more interesting cases would be irrational coefficients like sqrt(2)
>> or the symbolic case where the coefficients are something like a
>> symbol x. If the implementation just uses scipy then there's no reason
>> to include it in sympy because users could just use it directly from
>> scipy.
>>
>>
>> Oscar
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sympy" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sympy/udUZ_U-mAh4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> sympy+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sympy/CAHVvXxQb4TEb7tPov6df5Vv2P-d4XYSKpi3xqUHY5w%2BuTCx2pQ%40mail.gmail.com
>> .
>>
> --
> 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 sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAMEnX6gOMEDJ1qf8ga1sQG8ggTBpG6spP1jRfywsDtWZRcvWKA%40mail.gmail.com
> <https://groups.google.com/d/msgid/sympy/CAMEnX6gOMEDJ1qf8ga1sQG8ggTBpG6spP1jRfywsDtWZRcvWKA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAFjzj-JstpU9nSDqR06FvcuO3a36pPsCvMRuVUai%3DzCJuFArtg%40mail.gmail.com.

Reply via email to