To be sure, I think we should consider keeping the old assumptions syntax (.is_positive, Symbol(positive=True), etc.), but make them call the new assumptions. This way, we will break very little compatibility, and we will still have these useful shortcuts for the simple cases.
Aaron Meurer 2011/12/7 Ondřej Čertík <[email protected]>: > On Wed, Dec 7, 2011 at 12:11 PM, [email protected] > <[email protected]> wrote: >> >> >> 2011/12/7 Ondřej Čertík <[email protected]> >>> >>> On Wed, Dec 7, 2011 at 11:58 AM, Ronan Lamy <[email protected]> wrote: >>> > Le mercredi 07 décembre 2011 à 20:36 +0100, [email protected] a >>> > écrit : >>> >> How should assumptions be used? More precisely why the following code >>> >> does what it does >>> >> >>> >> In [18]: global_assumptions.clear() >>> >> >>> >> In [19]: x = Symbol('x', positive=True) >>> >>> >>> ^^^ This is old assumptions, that will be eventually removed >>> >>> >> >>> >> In [20]: ask(Q.positive(x)) # Why does it return None? >>> >>> New assumptions. >>> >>> >> >>> >> In [21]: x > 0 >>> >> Out[21]: True >>> >>> Old assumptions. >>> >>> And so on. We need to write documentation how to use the new >>> assumptions. I hit the same problems. Here is an example: >>> >>> + >>> from sympy import var, solve, S, refine, Q >>> + >>> var("a z") >>> + (a, z) >>> + >>> f = z / (a**2+z**2)**(S(5)/2) >>> + >>> solve(f.diff(z), z) >>> + [-a/2, a/2] >>> + >>> f.subs(z, a/2) >>> + 16*sqrt(5)*a/(125*(a**2)**(5/2)) >>> + >>> refine(f.subs(z, a/2), Q.positive(a)) >>> + 16*sqrt(5)/(125*a**4) >>> >>> and we just need to document it well, then improve refine and other >>> things, and then eventually remove the old assumptions. >> >> Does this mean that every instance of is_something must be changed to ask()? > > Eventually yes, but from my talks with Mateusz at the Google Mentor Summit, > unfortunately it is not easy to do it step by step, because for various > technical reasons one will have to remove the old assumptions in one step > (and fix some solvers that depend on it). > >> Is it plausible in the meantime to have (is_something or ask(..))? Of course >> in some cases 'or' wont be the correct operator. > > I think it is currently completely independent, and we should simply start > using > the new assumptions. > > Ondrej > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
