Le mardi 18 mai 2010 à 07:02 -0700, Vinzent Steinberg a écrit :
> On 18 Mai, 07:31, Ronan Lamy <ronan.l...@gmail.com> wrote:
> > After my work on Predicates, I've made another attempt at replacing the
> > old assumption system with the new one and the results are encouraging.
> > After a few more relatively simple changes to the assumptions system -
> > that make it significantly more powerful - it appears that it's possible
> > to completely the old assumptions with the new ones with only reasonably
> > many failures, and very few seeming intractable. The biggest problem is
> > that the switch causes a very painful slowdown. It also seems that a lot
> > of tedious work is required to port all the capabilities of the old
> > system and thus fix the test failures.

It turns out that the ability to solve equalities and inequalities is
required to emulate some of the functionality of the old system. The
real problem, though, is the interaction with caching: in the old
system, assumptions are part of a symbol's state, so that the cache
knows that abs(Symbol('x', positive=True)) and abs(Symbol('x',
negative=True)) are called with different arguments (even though
Symbol('x', positive=True) == Symbol('x', negative=True), which is a
wart IMO). In the new system, the two expressions are identical and the
only difference is the state of global_assumptions when abs is called.
The only way to make it work without redesigning the cache system is to
avoid any calls to the assumption system during function instantiation.

> >
> > The (unpolished) code is in the branch "use-new-assump2" in my github
> > repo [http://github.com/rlamy/sympy/commits/use-new-assump2]. I've
> > gathered prerequisites to the switch passing all tests into
> > "new-assump" [http://github.com/rlamy/sympy/commits/new-assump].
> 
> The old system did only trivial assumptions, I think these are slower
> with the new system. Probably we should use caching?

Yes, but it's not clear what to cache, nor how.

> 
> See also issue 1884 [1].

Assumptions need to have a longer lifetime than the objects they apply
to. I think your local assumptions can cause it to be shorter. The best
way to deal with this would probably be to use weakrefs.


-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@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.

Reply via email to