{%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %} # Find the characteristic polynomial ## Problem Run the SageMath code below or simply click [here](https://sagecell.sagemath.org/?q=zziwzi). ```python= load("https://raw.githubusercontent.com/jephianlin/LA-notebook/main/lingeo.py") ### code set_random_seed(None) n = 3 A = matrix(n, random_int_list(### code set_random_seed(None) n = 3 A = matrix(n, random_int_list(n**2, 2)) for k in range(n + 1): print("k =", k) if k == 0: print("s0 = 1") else: sk = 0 print("alpha det(A[alpha])") for alpha in Combinations(list(range(n)), k): detAalpha = A[alpha,alpha].determinant() sk += detAalpha print(alpha, detAalpha) print("s%s ="%k, sk) print("characteristic polynomial:", (-1)**n * A.charpoly())n**2, 2)) print("A =") print(A) print() for k in range(n + 1): print("k =", k) if k == 0: print("s0 = 1") print() else: sk = 0 print("alpha det(A[alpha])") for alpha in Combinations(list(range(n)), k): detAalpha = A[alpha,alpha].determinant() sk += detAalpha print(alpha, detAalpha) print("s%s ="%k, sk) print() print("characteristic polynomial:", (-1)**n * A.charpoly()) ``` Replace `None` with your favorite number and run the code again. The outcome is a matrix $A$. Find the characteristic polynomial of $A$ and check your answer with the output. *This note can be found at Course website > Learning resources.*