On Apr 30, 7:36 pm, Haz <[email protected]> wrote:
> >I think the only problem could be that ask() is much slower for
> >trivial queries, needs to be verified. This should be not too hard to
> >fix though.
>
> I don't think this is the case. Trivial queries (those that already have
> obvious implications) are compiled into quick reference dictionaries. In
> particular:
> -https://github.com/sympy/sympy/blob/master/sympy/assumptions/ask.py#L114
Thanks for clarifying. I made a quick unrepresentative benchmark:
In [1]: x = Symbol('x', positive=True)
In [2]: global_assumptions.add(Assume(x, Q.positive))
In [3]: %timeit x.is_positive
1000000 loops, best of 3: 418 ns per loop
In [4]: %timeit ask(x, Q.positive)
10000 loops, best of 3: 97.3 us per loop
I think this is fast enough. (Even if it is about 200 times slower.)
Vinzent
--
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.