susbtitution with a condition

8 views
Skip to first unread message

Philippe Piot

unread,
Mar 23, 2020, 11:35:18 AM3/23/20
to sy...@googlegroups.com
Dear All, 
  I cannot figure out how to impose a condition. I have a function that is defined as a piecewise function. When it returns its results with several Min(x,y). I would like to substitute Min(x,X) with "x" since x<X. I have tried something like (here simplified as my function output as several terms). 
with assuming (x<X):
    print (Min(x,X))
but it does not work [i.e. it does not simplify Min(x,X) with x]. Thanks for any suggestions. 
  Best,  -- Philippe. 

Aaron Meurer

unread,
Mar 23, 2020, 1:56:20 PM3/23/20
to sympy
assuming() does not work with inequalities yet. The easiest way to
simplify the expression at present is to use expr.subs(Min(x, X), x).

Aaron Meurer
> --
> 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+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CA%2B1witFKcJuwyFHW0F%3Dy0CmsFuJGaZ_Lac3oydXahOsm2GSrdg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages