Hello, I have been using sympy a lot recently (economical modelling) and (while it's a great software) I found a strange behavior when doing substitution : it is not respecting operators priority. I think it's because it works sequentially with all its arguments, but it leads to somewhat surprising results.
In the following session, I was expecting to get the square root of 4, i.e. 2, but instead the program is taking to fractional exponents of a negative number which has a non unique definition. In [1]: from sympy import * In [2]: var('a b') Out[2]: (a, b) In [3]: eq = (a/b)**0.5 In [4]: eq.subs({a:-2,b:-0.5}) Out[4]: -2.00000000000000 As a workaround, I found myself lambdifying expressions, but I know it's a bad workaround working only when substituion is made with respect to all arguments. What do you suggest ? Best, Pablo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---