SharedTA Sandbox / Hao's Sandbox / Lab06_slides / Lab06_slides2.sagewsOpen in CoCalc
Author: HAO LEE

## Inverse of Matrix


A = matrix(RDF,[[1,2],[3,4]])
B = vector([4,2])
X = A.inverse()*B
X
A*X
A.inverse()

(-5.999999999999998, 4.999999999999999) (4.0, 2.0000000000000036) [-1.9999999999999996 0.9999999999999998] [ 1.4999999999999998 -0.4999999999999999]
@interact
def FindX(target = vector([4,2]),x1=(-7,7,1),x2=(-7,7,1)):
B = vector([4,2])
v1 = vector([1,3])
v2 = vector([2,4])
vres = v1*x1+v2*x2;
fig = plot(v1*x1,color='red',linestyle='--')+plot(v2*x2,color='blue',linestyle='--')+plot(vres,color='green')+point(B,size=30,color='black')
show(fig)



## Change of Basis




## Can we find $A^6$?

$T^{-1}ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}AT$

## Can we find $A^6$?

$T^{-1}ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}AT$ = $T^{-1}A^6T$


T = matrix(RDF,[[1,1],[2,0.5]])
v1 = vector([2,3])
T.inverse()*v1
v2 = vector([-5,1.2])
v3 = vector([-4,-8])
T.inverse()*v2
T.inverse()*v3

(1.3333333333333335, 0.6666666666666665) (2.4666666666666663, -7.466666666666666) (-4.0, 0.0)
@interact
def findR()