Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You are trying to use the symbolic sum notation (intended for variable limits), but your sum is an ordinary one.

Also, indices start from 0 in Python and SageMath.

So instead of e.g.

sum(area[i] * sin(2*alpha[i])^2, i, 1, 5)

it should be e.g.

sum(area[i] * sin(2*alpha[i])^2 for i in range(5))

Note also that you can do things like

n = 5
alpha = vector([var('alpha_%d' % (k+1)) for k in range(n)])

to save yourself some typing.

You As part of the symbolic summation you are trying to use the symbolic sum notation (intended for access e.g. alpha[i] where i is an indeterminate variable limits), but your sum is an ; that doesn't work. Instead you should use the ordinary one.

summation. Also, indices start from 0 in Python and SageMath.

So instead of e.g.

sum(area[i] * sin(2*alpha[i])^2, i, 1, 5)

it should be e.g.

sum(area[i] * sin(2*alpha[i])^2 for i in range(5))

Note also that you can do things like

n = 5
alpha = vector([var('alpha_%d' % (k+1)) for k in range(n)])

to save yourself some typing.