[sympy] Re: Solving multivariate nonlinear system of equations

2016-04-14 Thread Denis Akhiyarov
with differential global optimization one of the roots is found: In [10]: differential_evolution(f,((-2,2), (-2,2), (-2,2), (-2,2), (-2,2), (-2,2 : ), (-2,2), (-2,2), (-2,2), (-2,2), (-2,2), (-2,2), (-2,2), (-2,2), (-2, : 2), (-2,2),(-2,2), (-2,2),(-2,2), (-2,2), (-2,2))) Out[10]:

[sympy] Re: Solving multivariate nonlinear system of equations

2016-04-14 Thread Denis Akhiyarov
something like this: ~ $ ptipython Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Dec 7 2015, 11:16:01) Type "copyright", "credits" or "license" for more information. IPython 4.1.2 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Q

[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: GSOC 2016: Classical Mechanics: Efficient Equation of Motion Generation with C++

2016-04-14 Thread Aravind
Sorry for being passive these days. I was busy with some course projects and am done. I have gone through the two classes again to recall everything. I have a small doubt, a conceptual one. Can you please explain me the the difference between argument qs in LagrangesMethod and q_ind & q_dep in

[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

[sympy] C code from IndexedBase

2016-04-14 Thread Nico Schlömer
>From an object like `sin(u[k]) + u0[k]` I would like to get the corresponding C code as a string. Since `k` is a variable, I cannot use `MatrixSymbol`, but there's always `IndexedBase` of course. With ``` u = IndexedBase('u') u0 = IndexedBase('u0') k = Symbol('k') y = sin(u[k]) + u0[k] ``` thing