Re: [sympy] Recommendations for creating symbols

2015-04-02 Thread Joachim Durchholz
Am 30.03.2015 um 21:33 schrieb Aaron Meurer: I would definitely test the different alternatives for sympy.abc to see what's faster. I just ran bin/test with `a = Symbol('a')` etc. Runtime went from 56:29 to 56:37, i.e. below the noise threshold. That was with Python 2.7. I guess the Pyton

Re: [sympy] Recommendations for creating symbols

2015-04-02 Thread James Crist
Symbols are cached by name and assumptions, and like everything else in SymPy, are immutable. Thus: In [1]: a = symbols('a') In [2]: a2 = symbols('a', positive=True) In [3]: a is a2 Out[3]: False In [4]: hash(a) == hash(a2) Out[4]: False So no, you should have no problems with assumptions.

Re: [sympy] Recommendations for creating symbols

2015-04-02 Thread James Crist
Performance: Using symbols() in all contexts might have performance ramifications, creating new Symbol() objects means more memory pressure than reusing precreated symbols from sympy.abc (which happen 521 times in SymPy itself, hopefully just in test code). We cache symbol creation,

Re: [sympy] Recommendations for creating symbols

2015-04-02 Thread Joachim Durchholz
Am 02.04.2015 um 18:46 schrieb James Crist: Performance: Using symbols() in all contexts might have performance ramifications, creating new Symbol() objects means more memory pressure than reusing precreated symbols from sympy.abc (which happen 521 times in SymPy itself, hopefully just in

[sympy] Recommendations for creating symbols

2015-03-30 Thread Joachim Durchholz
Hi all, I'm wondering about the section on creating symbols in https://github.com/sympy/sympy/wiki/Idioms-and-Antipatterns#strings-as-input . It is mildly discouraging importing from sympy.abc because an accidental from sympy.abc import * would clobber I and Q (and possibly others), and

Re: [sympy] Recommendations for creating symbols

2015-03-30 Thread Aaron Meurer
On Mon, Mar 30, 2015 at 4:26 AM, Joachim Durchholz j...@durchholz.org wrote: Hi all, I'm wondering about the section on creating symbols in https://github.com/sympy/sympy/wiki/Idioms-and-Antipatterns#strings-as-input . It is mildly discouraging importing from sympy.abc because an accidental

Re: [sympy] Recommendations for creating symbols

2015-03-30 Thread Aaron Meurer
I would definitely test the different alternatives for sympy.abc to see what's faster. Also, I wonder what the effect of sympy.abc on the cache is. We have an LRU cache, and assumedly importing it messes with that, at least for a little bit. Aaron Meurer On Mon, Mar 30, 2015 at 1:52 PM, Joachim

Re: [sympy] Recommendations for creating symbols

2015-03-30 Thread Joachim Durchholz
Am 30.03.2015 um 19:58 schrieb Aaron Meurer: symbols() supports commas, so an easy thing to do here is to use the form symbols(' t, w, x, y, z, n, k, m, p, i'), so that the left-hand side of the assignment exactly matches the right-hand side. Ah, I knew it could do commas but I didn't know

Re: [sympy] Recommendations for creating symbols

2015-03-30 Thread Joachim Durchholz
Am 30.03.2015 um 21:33 schrieb Aaron Meurer: I would definitely test the different alternatives for sympy.abc to see what's faster. Also, I wonder what the effect of sympy.abc on the cache is. We have an LRU cache, and assumedly importing it messes with that, at least for a little bit.