Exercise 4.7.6

Answers

For the 2 by 4 mesh of 8 nodes, I make nodes x1 x4 on the left half, with x1,x4 on diagonal. Similarly, x5 x8 are on the right side, with x5,x8 on diagonal. With weight C = I, we have the matrix ATCA = [ 2 11 0 0 0 0 0 1 3 0 1 1 0 0 0 1 0 2 1 0 0 0 0 0 1 1 3 0 0 1 0 0 1 0 0 3 11 0 0 0 0 0 1 2 0 1 0 0 0 11 0 3 1 0 0 0 0 0 1 1 2 ]

From the calculation below, we see that λ2 = 0.2712864461218309, the corresponding z has the top half with negative values and the bottom half with positive values, this cuts the nodes in the middle, where x1 x4 belong to one cluster and x5 x8 belong to another.

#### Problem IV.7.6 
import numpy as np 
import scipy as sp 
a = np.array([[2, -1, -1, 0, 0, 0, 0, 0], [-1, 3, 0, -1, -1, 0, 0, 0], 
             [-1, 0, 2, -1, 0, 0, 0, 0], [0, -1, -1, 3, 0, 0, -1, 0], 
             [0, -1, 0, 0, 3, -1, -1, 0], [0, 0, 0, 0, -1, 2, 0, -1], 
             [0, 0, 0, -1, -1, 0, 3, -1], [0, 0, 0, 0, 0, -1, -1, 2]]) 
D = np.diag(np.diag(a)) 
v, L = sp.linalg.eig(a, D) 
#np.argmin(v), np.iscomplex(v) 
vi = np.argsort(v) 
print(lambda2:, v[vi[1]]) 
z = L[:, vi[1]] 
print(secondeigenvector:, z) 
np.matmul(np.ones(8).reshape(1,8), np.matmul(D, z))
lambda 2:  (0.2712864461218309+0j)
second eigenvector:  [-0.45468835 -0.20798678 -0.45468835 -0.20798678
0.20798678  0.45468835
  0.20798678  0.45468835]
array([1.33226763e-15])

User profile picture
2020-03-20 00:00
Comments