[sympy] Re: C code from IndexedBase

2016-04-14 Thread Francesco Bonazzi
Have you tried to use *Idx* instead of *Symbol* for the index? k = Idx("k", *4*) 4 is the range. In this case, *k *ranges from 0 to 4-1 = 3. On Thursday, 14 April 2016 09:31:38 UTC+2, Nico Schlömer wrote: > > Once again, atoms to the rescue. > ``` > y.atoms(IndexedBase) > ``` > will give you al

[sympy] Re: C code from IndexedBase

2016-04-14 Thread Nico Schlömer
Once again, atoms to the rescue. ``` y.atoms(IndexedBase) ``` will give you all IndexedBase object from an expression. On Thursday, April 14, 2016 at 9:25:09 AM UTC+2, Nico Schlömer wrote: > > It seems that, unfortunately, the information of whether or not a variable > is an IndexedBase object i

[sympy] Re: C code from IndexedBase

2016-04-14 Thread Nico Schlömer
It seems that, unfortunately, the information of whether or not a variable is an IndexedBase object is discarded when using it in an expression. Check ``` from sympy import * u = IndexedBase('u') k = Symbol('k') y = u[k] print(isinstance(u, IndexedBase)) for s in y.free_symbols: print(s, is