>> Or I don't understand your problem [about the problem with calling for
>> arg in the new assumptions handler]
>>
> The problem is that arg is written using old assumptions, so unless you
> rewrite arg to use the new assumptions and pass assumptions along to it,
Yes. In particular, if we add a compatibility layer (is_foo predicates
call the new assumptions). Nothing new here, of course.
> x has no direct assumption so False will be returned from foo and thus 2
> will result from the ask. So unless we either 1) assign assumptions to
> symbols (but that will not be sufficient to handle things like Q.positive(x
> + 2)
Or add new global assumptions in the Symbol constructor (see my last PR). Of
course, this is sufficient to handle Q.positive(x + 2):
In [1]: p = Symbol('p', positive=True)
In [2]: ask(Q.positive(p + 2))
Out[2]: True
In [3]: ask(Q.positive(p - 2))
In [4]:
> or 2) start passing assumptions to all functions which have a
> dependence on assumptions (so something like def foo(e) -> def foo(e,
> assumptions={})) I don't know how we are going to get the
> old-assumptions-API-based functions to start working with the new
> assumptions. What am I missing? How will foo above need to be modified so
> it works?
To alter the global_assumptions context we have context managers.
An example from my branch:
In [10]: r = Symbol('r')
In [11]: ask(Q.real(r))
In [12]: with assuming(Q.real(r)):
...: print(ask(Q.real(r)))
...:
True
In [13]: ask(Q.real(r))
In [14]:
But, optionally, we can provide also assumptions kwarg to override
the current assumptions context.
--
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 [email protected].
To post to this group, send email to [email protected].
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/20140827102157.GA3938%40debian.
For more options, visit https://groups.google.com/d/optout.