It looks like MatrixElement doesn't evaluate itself on actual matrices. At
the very least MatrixElement.doit() should be implemented to make this work.

Aaron Meurer


On Wed, Jan 15, 2014 at 12:25 AM, Dee Mee <[email protected]> wrote:

> The problem (bug?) can be reproduced on SymPy 0.7.4.1 and on SymPy Live
> Shell on http://docs.sympy.org/
>
> How can I help to fix it?
>
>
> <https://lh6.googleusercontent.com/-zvVWTXnJWBc/UtYEOODfBiI/AAAAAAAAAjY/j4NjIHrqkHM/s1600/sympy_bug.png>
>
>
> <https://lh6.googleusercontent.com/-zvVWTXnJWBc/UtYEOODfBiI/AAAAAAAAAjY/j4NjIHrqkHM/s1600/sympy_bug.png>
>
>
> On Tuesday, January 14, 2014 11:43:28 PM UTC+7, Matthew wrote:
>
>> This is probably a bug.  The code you provided should work as expected.
>>  In general the connection between MatrixExprs and scalar Exprs is rough.
>>
>>
>> On Mon, Jan 13, 2014 at 2:42 AM, Dee Mee <[email protected]> wrote:
>>
>>> from sympy import MatrixSymbol, ImmutableMatrix
>>>
>>> u = MatrixSymbol('u', 2,1)
>>>
>>> print "\n\ntest1:"
>>> print  u.subs(u, ImmutableMatrix([3,5]))[0,0]
>>>
>>> print "\n\ntest2:"
>>> print  u[0,0].subs(u, ImmutableMatrix([3,5]))
>>>
>>> print "\n\ntest3:"
>>> print  u[0,0].subs(u, ImmutableMatrix([3,5])).evalf()
>>>
>>>
>>> Here is whet this code prints:
>>> test1:
>>> 3
>>>
>>>
>>> test2:
>>> Matrix([
>>> [3],
>>> [5]])[0, 0]
>>>
>>>
>>> test3:
>>> Matrix([
>>> [3],
>>> [5]])[0, 0]
>>>
>>>
>>>
>>> I expected the same output in all tests. At least in the 3rd test the
>>> result should be 3.
>>> Why this expresion is not evaluated? How to evaluate it?
>>>
>>>  --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>>
>>> Visit this group at http://groups.google.com/group/sympy.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to