[sympy] relate x[0] back to x

2015-08-19 Thread Nico
After defining a vector `x` and one of its components, say `x0`, ``` import sympy x = sympy.DeferredVector('x') x0 = x[0] ``` is there any way to relate `x0` back to `x`? I.e., I'm looking for a Boolean function that returns `True` for the question "Is x0 a component of x?" -- You received this

[sympy] Bug in "sympy.physics.quantum.cg"

2015-08-19 Thread shinya . kat
I found a wrong expression to indicate a variable in "Wigner6j.doit()". Original in Sympy version 0.7.6: def doit(self, **hints): if self.is_symbolic: raise ValueError("Coefficients must be numerical") return wigner_6j(self.j1, self.j2, self.j12, self.j3, self.j, s

Re: [sympy] Bug in "sympy.physics.quantum.cg"

2015-08-19 Thread Sean Vig
Hi, Yes, that is a typo, if you'd like to submit a PR on github we'd be happy to merge it. Thanks for finding it. Sean On Wed, Aug 19, 2015 at 10:09 AM, wrote: > I found a wrong expression to indicate a variable in "Wigner6j.doit()". > > Original in Sympy version 0.7.6: > def doit(self, **

Re: [sympy] parse_expr

2015-08-19 Thread Aaron Meurer
This is why var() is not recommended except for interactive use. Aside from doing an un-Pythonic thing (creating Python variables without using an assignment), it can only inject variables into the global scope, due to the way variables work in Python. This means that if you use var() inside of a f

Re: [sympy] relate x[0] back to x

2015-08-19 Thread Aaron Meurer
It doesn't look like there is. DeferredVector just works by creating Symbol('x[0]'). I think for the use-case it was designed for, this is fine. You probably want to be using Indexed and IndexedBase instead. Aaron Meurer On Wed, Aug 19, 2015 at 6:07 AM, Nico wrote: > After defining a vector `x`

Re: [sympy] relate x[0] back to x

2015-08-19 Thread Jason Moore
There is also the MatrixSymbol class that may be better here. The DeferredVector was created with a very narrow need for the lambdify functions, I wouldn't recommend using it for anything other. Jason moorepants.info +01 530-601-9791 On Wed, Aug 19, 2015 at 12:57 PM, Aaron Meurer wrote: > It d

Re: [sympy] relate x[0] back to x

2015-08-19 Thread Nico Schlömer
> There is also the MatrixSymbol class that may be better here. Quite interesting! Is there such a thing as a VectorSymbol as well? (I saw the `is_Vector` property here but never saw it True, neither for MatrixSymbols nor for DeferredVectors.) --Nico On Wed, Aug 19, 2015 at 10:20 PM Jason Moor

Re: [sympy] relate x[0] back to x

2015-08-19 Thread Jason Moore
We don't distinguish between vectors and column matrices. You can check the matrix's shape. Jason moorepants.info +01 530-601-9791 On Wed, Aug 19, 2015 at 1:42 PM, Nico Schlömer wrote: > > There is also the MatrixSymbol class that may be better here. > > Quite interesting! > Is there such a th

[sympy] Smarter cache

2015-08-19 Thread Denis Akhiyarov
Once I had some issues with cache in sympy and recently noticed this nice idea cachey. Seems to be a perfect fit for sympy? In short the idea is to cache based on size and computation effort using a simple formula. http://matthewrocklin.com/blog/work/2015/08/03/Caching/ The goal is to keep the