# 3x3 matrix and corresponding 3D view
A = matrix(QQ,[[1, 6, 0], [3, 4, 0], [1, 1, 1]])
D, V = A.eigenmatrix_right()
lam = [D[0][0],D[1][1],D[2][2]]
V = V.transpose()
show(V)
@interact
def _(theta = slider(0,360,1,30,label='$\\theta$ (rotation)'),phi = slider(0,180,1,30,label="$\\phi$ (elevation from N)"),n = [0,1,2]):
pretty_print(html('In this interactive cell, for each of the two eigenvalues determine the corresponding eigenvector'))
pretty_print(html('by finding the direction angle for which the resulting vector x satisfies $Ax = \lambda x$'))
pretty_print(html('The <font color="green">green</font> vector below corresponds to $\lambda x$ and the <font color="red">red</font> vector corresponds to $Ax$'))
print("Eigenvalue = "+str(lam[n]))
print("Eigenvector ="+str(V[n]))
show(A)
theta = theta*pi/180
phi = phi*pi/180
vec = [cos(theta)*sin(phi),sin(theta)*sin(phi),cos(phi)] # spherical coordinates
veclam = [lam[n]*cos(theta)*sin(phi),lam[n]*sin(theta)*sin(phi),lam[n]*cos(phi)]
G = arrow((0,0,0),veclam,color='green',zorder=3,width=3)
Ax = A*(vector(RR,[vec[0],vec[1],vec[2]]).column())
Ax = (Ax[0][0],Ax[1][0],Ax[2][0])
G+= arrow((0,0,0),Ax,color='red',zorder=2,width=3)
G.show(aspect_ratio=True,figsize=(4,6))
V*D == A*V
|
$\theta$ (rotation) |
|
$\phi$ (elevation from N) |
|
n | |
|
|
| |
|
|
False
Click to the left again to hide and once more to show the dynamic interactive window
|