# Revision history [back]

### 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.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $k$ as defined above.

can somebody help me with this?

### 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.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $k$ $c_k$ as defined above.

can somebody help me with this?

### 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.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $c_k$ as defined above.

can somebody help me with this?

### 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.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $c_k$ 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 $A^4$ again - i want it to do $A^3\cdot A$ i.e. use the fact that it already calculated $A^3$ for $c(3,A)$ to help reduce the calculation time. So, i guess i want a recurrence relation.

### 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.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $c_k$ 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 $A^4$ again - i want it to do $A^3\cdot A$ i.e. use the fact that it already calculated $A^3$ for $c(3,A)$ to help reduce the calculation time. So, i guess i want what im after is a recurrence relation.

### 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.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $c_k$ 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 $A^4$ again - i want it to do $A^3\cdot A$ i.e. use the fact that it already calculated $A^3$ for $c(3,A)$ to help reduce the calculation time. So, i guess what im after is a recurrence relation.relation. is this possible?

### 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.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $c_k$ 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 $A^4$ - i want it to do $A^3\cdot A$ i.e. use the fact that it already calculated $A^3$ for $c(3,A)$ to help reduce the calculation time. So, i guess what im after is a recurrence relation. is this possible?

### 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.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $c_k$ as defined above.

can EDIT I actually need: $s_k=[c_1s_{k-1}+...+c_{k-1}s_1-kc_k]$ ? could somebody help me with this?to change tobias welch's answer so that it computes $s_k$ instead of $c_k$?

### Newton's identities in Sage

EDIT
I actually need: $s_k=[c_1s_{k-1}+...+c_{k-1}s_1-kc_k]$ ? could somebody help me to change tobias welch's answer so that it computes $s_k$ instead of $c_k$?
END EDIT

I'm combining netwon's identities with le verrier's algorithm

I need some help coding the following on python.

$c_k=\frac{-1}{k}(s_k+c_1s_{k-1}+c_2s_{k-2}+\dots+c_{k-1}s_1)$
where $s_k=Tr(A^k)$, for some square matrix A, $\forall k=1,2,3,\dots,n$

So, i'd like to type in $c(k)$ and python spits out the value for $c_k$ as defined above.

EDIT I actually need: $s_k=[c_1s_{k-1}+...+c_{k-1}s_1-kc_k]$ ? could somebody help me to change tobias welch's answer so that it computes $s_k$ instead of $c_k$?