SharedTA Sandbox / Hao's Sandbox / Lab06_slides / Lab06_slides2.sagewsOpen in CoCalc

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)

Interact: please open in CoCalc

Change of Basis


Sometimes T1T^{-1} Does not exist

If T=[t1t1]T =[t_1 t_1] => multiple vectors in T's world maps to the same vector in world [10]\begin{bmatrix}1\\0\end{bmatrix} and [01]\begin{bmatrix}0\\1\end{bmatrix}

Cannot map back!!!

    T1\implies T^{-1} exists if and only if all t1,t2,t3......t_1, t_2, t_3...... cannot be form by any other basis except itself.

Impossible to find t1=at2+bt3t_1 = at_2 + bt_3 for any a and b. (3 dimensional case)

Diagonalization

Longterm Effect

Can we find A6A^6?

T1ATT1ATT1ATT1ATT1ATT1ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}AT














Can we find A6A^6?

T1ATT1ATT1ATT1ATT1ATT1ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}ATT^{-1}AT = T1A6TT^{-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()