Actually, you _are_ trying to evaluate numerically, simply not what
you thought you were. :^)
The problem with
sum(lore4[k,k],k,0,3)
isn't the sum; it's the lore4[k,k]:
----
sage: lore4[k,k]
[...]
TypeError: cannot evaluate symbolic expression numerically
---
It's trying to convert the k to an integer index to access the matrix
elements. By the way, whenever Sage (or Python) gives me a TypeError
I break everything down into its pieces like this and try to find
which one is causing the problems. It doesn't always work, but I'd
say 75% of the time it's an input formatting error on my part that I
can find.
Anyway, I'm not sure if Sage matrices can be indexed by symbolic
variables like this. [Whenever I say you can't do something in Sage
someone proves me wrong, but I'm not familiar with the trick if there
is one.]
In this case, rather than using the symbolic sum 4-term calling style
(expression, var, v0, v1), I'd write it with a generator expression
instead:
---
sage: sum(lore4[k,k] for k in [0..3])
2*sinh(x) + 2
---
or something like that.
Doug
You're right. Matrices can only be indexed by things that can be
converted to integers (or slices thereof), IIRC.
Jason