--
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 post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/80f87d8d-1504-40f6-b6d4-efb08cdcc824%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6L3OorvtGQaXp7RUg2RGtVweSgUk2XNQ_tDs%2BqYB5-iMg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAM6e1JdxBKnfSxEMPxJnUqkd7XwOdkU4fddaqPRQmqGAaMZO-A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2Bn0vvxOd3H%2B-4rRdQOh4Std7uCfjzFudvbs9gQzOM5yQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAGBZUCY_dQUZ095a2Gw8bXZZ3y%3D4co2vMvijApVCivw5yNNiAw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAM6e1JfXy2vdW5Hgq_ZFwjAsML29K1UerEqt_xjsevDcBhRRjQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6KUCB7Lg3x2TnXXRj__0O2FtYZ9K3BxLp6esoWJhRHpmA%40mail.gmail.com.
Hi guys,Thanks for your help so far. I am revisiting this after ignoring this issue for a while.I'm still trying to come up with a good way to use this. I've noticed the following:Say:a = Symbol('a')b = Symbol('b')assumptions = Q.positive(a - b)expr = 1/Abs(a - b)If I try:refine(expr, assumptions)it returns:1/(a - b)as desired. But, if I try:expr = Abs(b - a)/Abs(a - b)it returns:│-b + a│────────a - bI can add an assumption that:assumptions = assumptions & Q.negative(b - a)And then refining returns 1. But then I can do something like:expr = Abs(0.5*b - 0.5*a)/Abs(a - b)And it fails again. Is the pattern matcher this weak? Is there any way to get what I want that doesn't require refine, or is there a better way to use refine to get what I want? My assumptions are simple - they will all be linear equations of variables.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAM6e1JdWEo0qOJwXWcimfOJw-dm3MN7S%2Bsen90Ac6hSf1%2Bo6YQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6J7o%2BTeZ-XmbYt_PUbSK57hD629pQn2vSAupObHr6P%3DEw%40mail.gmail.com.
Sorry for the double post. It seems replace is very weak as well, not being able to detect multiples :-/In [60]: expr.replace(math.Abs(guardlength - 0.5*length), guardlength - 0.5*length)Out[60]: width*(-2*guardlength + length + Abs(2*guardlength - length))/Abs(2*guardlength - length)In [61]: expr.replace(math.Abs(2*guardlength - length), 2*guardlength - length)Out[61]: 0
On Fri, Jan 2, 2015 at 11:47 PM, Andrew Spielberg <aespi...@gmail.com> wrote:This may be a dumb question, but can you please explain what is going on here...? exp was made using simpify, expr was created from scratch. Replace operates on them differently.In [48]: expOut[48]: width*(-2*guardlength + length + Abs(2*guardlength - length))/Abs(2*guardlength - length)In [49]: exprOut[49]: width*(-2*guardlength + length + Abs(2*guardlength - length))/Abs(2*guardlength - length)In [50]: exp.replace(math.Abs(2*guardlength - length), 2*guardlength - length)Out[50]: width*(-2*guardlength + length + Abs(2*guardlength - length))/Abs(2*guardlength - length)In [51]: expr.replace(math.Abs(2*guardlength - length), 2*guardlength - length)Out[51]: 0In [52]: exp == exprOut[52]: False
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAM6e1JdGbsiLXxPbq00X9oH8Pqn1fBV_PRttL5BugrcXxbzXig%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BP%2BmEe87Ox1P66btJmh7hR2-D8cjVv117554ZAi6OthA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAM6e1Jd5mgLTG%2BpHovexWA7PEvuLpimwY7OiAa-uV1R0JR68zQ%40mail.gmail.com.