Is there symbolic sum in Sage?

145 views
Skip to first unread message

Dmitry Shkirmanov

unread,
Jan 11, 2011, 1:30:38 PM1/11/11
to sage-s...@googlegroups.com
Hello, i need to sum elements of matriО©╫es  and vectors, for example here is code (in notebook):
#
var('a,b,c,d,e,f,j')
v=vector([a,b,c])
m=matrix([[a,b,c],[d,e,f]])
sum(m[0,j]*v[j],(j,0,2))
#
I expect that it should result in a^2+b^2+c^2, but it gives
 "TypeError: cannot evaluate symbolic expression numerically"
Is there any possibility to sum such expressions?

Harald Schilly

unread,
Jan 11, 2011, 1:47:26 PM1/11/11
to sage-s...@googlegroups.com
sage: sum(( m[0,j] * v[j] for j in range(3) ))
a^2 + b^2 + c^2

H

Dmitry Shkirmanov

unread,
Jan 11, 2011, 2:05:38 PM1/11/11
to sage-s...@googlegroups.com
>sage: sum(( m[0,j] * v[j] for j in range(3) ))
>a^2 + b^2 + c^2

Thank you very much.
Reply all
Reply to author
Forward
0 new messages