Newton's identities in Sage
I'm combining netwon's identities with le verrier's algorithm
I need some help coding the following on python.
ck=−1k(sk+c1sk−1+c2sk−2+⋯+ck−1s1)
where sk=Tr(Ak), for some square matrix A, ∀k=1,2,3,…,n
So, i'd like to type in c(k) and python spits out the value for ck as defined above.
can somebody help me with this?
EDIT: I need further help (SEE BELOW)
what i want to do is add some more code (to tobias welch's answer) that will for example calculate c(4,A), but i dont want sage to do the calculations for A4 again - i want it to do A3⋅A i.e. use the fact that it already calculated A3 for c(3,A) to help reduce the calculation time. So, i guess i want what im after is a recurrence relation.