relate x[0] back to x

26 views
Skip to first unread message

Nico

unread,
Aug 19, 2015, 8:07:36 AM8/19/15
to sympy
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?"

Aaron Meurer

unread,
Aug 19, 2015, 3:58:03 PM8/19/15
to sy...@googlegroups.com
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

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/906550a7-f11d-4ccd-a097-0f47f1fff0a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason Moore

unread,
Aug 19, 2015, 4:20:43 PM8/19/15
to sy...@googlegroups.com
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.

Nico Schlömer

unread,
Aug 19, 2015, 4:43:14 PM8/19/15
to sy...@googlegroups.com
> 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



You received this message because you are subscribed to a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/sOaXFcs7AXw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+un...@googlegroups.com.

To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

Jason Moore

unread,
Aug 19, 2015, 5:00:08 PM8/19/15
to sy...@googlegroups.com
We don't distinguish between vectors and column matrices. You can check the matrix's shape.
Reply all
Reply to author
Forward
0 new messages