Where is it clearly stated what the difference is in the two systems? One 
thing I have noted is what a fog it is writing the routines since it is not 
clear what the routine must do and what will mathemagically be handled by 
the inference system -- and that, especially, I do not understand the 
difference in the two. I know they keep evaluating propositions until a 
clear answer is found but I don't know if there is a significant difference 
in the two in that regard. I know that the new system can handle "is_true" 
expressions and can handle assumptions involving Or (while the old 
assumptions only allow And-based assumptions: var('x', integer=True, 
positive=True).

One thing I noted today was that the old system can make a calculation 
based on arg(expression) which depends on the old assumptions. I don't know 
how that could be done in the new system. Specifically, I needed to 
compute, for a power, arg(base)*exponent/pi and see whether that was an 
integer or half integer. But arg() needs assumptions to return a value and 
that's where the problem arises. arg uses the old assumptions so if you try 
to do the calculation in the new assumption system (where the symbolic 
assumptions are not available with the symbols) it fails.

As far as passing symbol-based assumptions along to the old system from the 
new, wouldn't something like this be a start?

>>> def assumption(a):
...     if a.func is Not:
...         b = False
...         a = a.args[0]
...     else:
...         b = True
...     if isinstance(a, AppliedPredicate):
...         return a.func.name, a.args[0], b
...
>>> def update(k, v, d):
...     if v is not None:
...         if k in d:
...             assert v == d[k]
...         else:
...             d[k] = v
...
>>> def know(a):
...     s = {}
...     d = {}
...     if a.func is And:
...         p = a.args
...     elif isinstance(a, AppliedPredicate):
...         p = [a]
...     else:
...         raise NotImplementedError(a)
...     for i in p:
...         k, x, v = assumption(i)
...         if x not in s:
...             s[x] = {}
...         update(k, v, s[x])
...     return s
...
>>> know(Q.positive(x)&Q.negative(y))
{x: {'positive': True}, y: {'negative': True}}

-- 
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/63b54e60-6538-4c7e-8f1f-155990dd6ac1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to