Check my python code below whether “TODO 1,2,3” canwork correctly.If not,change it for me.
#Linear Algbra 2018 Assignment 2
from hw2_105000120_myfun import mydet, mysolve_cramer,mysolve_adj
import numpy as np
from datetime import datetime
A = np.array([[1,-1,-1,0,0,0,0,0,0,0],
[0,0,1,-1,-1,0,0,0,0,0],
[0,0,0,0,1,-1,-1,0,0,0],
[0,0,0,0,0,0,1,-1,-1,0],
[2,6,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,-1],
[0,-2,2,2,0,0,0,0,0,0],
[0,0,0,-2,2,2,0,0,0,0],
[0,0,0,0,0,-2,2,2,0,0],
[0,0,0,0,0,0,0,-2,2,2]])
b = np.array([[0],[0],[0],[0],[10],[0],[0],[0],[0],[0]])
n = A.shape[0]
# compute the determinant of A using numpy
print(np.linalg.det(A))
# compute the determinant of A using mydet
### your code write in hw2_StudentID_myfun.py (“mydet” function)###
print(mydet(A))
# solve the linear system and measure the execution time
tStart = datetime.now()
x = np.linalg.solve(A, b)
tEnd = datetime.now()
print(“Time to solve Ax=b is “, tEnd-tStart, ” seconds.”)
# check the correctness
res = np.subtract(np.dot(A, x), b)
print(res)
# TODO 1. solve Ax=b using adjoint matrix (using mydet)
### your code write in hw2_StudentID_myfun.py
PayPal Gateway not configured
PayPal Gateway not configured