Skip to main content
added 2 characters in body
Source Link

RandomVariate[NormalDistribution[], {r, r}] does not give you normalized eigenvectors. To obtain an orthonormal basis, you can first generate a random matrix, and then apply OrthogonalizeOrthogonalize to it. Following is the correct code.

r=4;(*matrix dimension*) dom={1,10};(*domain of random numbers*) eig=DiagonalMatrix[-RandomInteger[dom,r]] (*eigenvalues in diagonal matrix*) v=Orthogonalize@RandomVariate[NormalDistribution[], {r, r}](*orthonormal eigenvectors*) A=Transpose[v].eig.v Eigenvalues[A] 

RandomVariate[NormalDistribution[], {r, r}] does not give you normalized eigenvectors. To obtain an orthonormal basis, you can first generate a random matrix, and then apply Orthogonalize to it. Following is the correct code.

r=4;(*matrix dimension*) dom={1,10};(*domain of random numbers*) eig=DiagonalMatrix[-RandomInteger[dom,r]] (*eigenvalues in diagonal matrix*) v=Orthogonalize@RandomVariate[NormalDistribution[], {r, r}](*orthonormal eigenvectors*) A=Transpose[v].eig.v Eigenvalues[A] 

RandomVariate[NormalDistribution[], {r, r}] does not give you normalized eigenvectors. To obtain an orthonormal basis, you can first generate a random matrix, and then apply Orthogonalize to it. Following is the correct code.

r=4;(*matrix dimension*) dom={1,10};(*domain of random numbers*) eig=DiagonalMatrix[-RandomInteger[dom,r]] (*eigenvalues in diagonal matrix*) v=Orthogonalize@RandomVariate[NormalDistribution[], {r, r}](*orthonormal eigenvectors*) A=Transpose[v].eig.v Eigenvalues[A] 
added 19 characters in body
Source Link
Everett You
  • 2.3k
  • 1
  • 17
  • 19

RandomVariate[NormalDistribution[], {r, r}] does not give you normalized eigenvectors. To obtain an orthonormal basis, you can first generate a random matrix, and then apply Orthogonalize to it. Following is the correct code.

r=4;(*matrix dimension*) dom={1,10};(*domain of random numbers*) eig=DiagonalMatrix[-RandomInteger[dom,r]] (*eigenvalues in diagonal matrix*) v=Orthogonalize@RandomReal[{-1,1}v=Orthogonalize@RandomVariate[NormalDistribution[], {r, r}](*orthonormal eigenvectors*) A=Transpose[v].eig.v Eigenvalues[A] 

RandomVariate[NormalDistribution[], {r, r}] does not give you normalized eigenvectors. To obtain an orthonormal basis, you can first generate a random matrix, and then apply Orthogonalize to it. Following is the correct code.

r=4;(*matrix dimension*) dom={1,10};(*domain of random numbers*) eig=DiagonalMatrix[-RandomInteger[dom,r]] (*eigenvalues in diagonal matrix*) v=Orthogonalize@RandomReal[{-1,1},{r,r}](*orthonormal eigenvectors*) A=Transpose[v].eig.v Eigenvalues[A] 

RandomVariate[NormalDistribution[], {r, r}] does not give you normalized eigenvectors. To obtain an orthonormal basis, you can first generate a random matrix, and then apply Orthogonalize to it. Following is the correct code.

r=4;(*matrix dimension*) dom={1,10};(*domain of random numbers*) eig=DiagonalMatrix[-RandomInteger[dom,r]] (*eigenvalues in diagonal matrix*) v=Orthogonalize@RandomVariate[NormalDistribution[], {r, r}](*orthonormal eigenvectors*) A=Transpose[v].eig.v Eigenvalues[A] 
Source Link
Everett You
  • 2.3k
  • 1
  • 17
  • 19

RandomVariate[NormalDistribution[], {r, r}] does not give you normalized eigenvectors. To obtain an orthonormal basis, you can first generate a random matrix, and then apply Orthogonalize to it. Following is the correct code.

r=4;(*matrix dimension*) dom={1,10};(*domain of random numbers*) eig=DiagonalMatrix[-RandomInteger[dom,r]] (*eigenvalues in diagonal matrix*) v=Orthogonalize@RandomReal[{-1,1},{r,r}](*orthonormal eigenvectors*) A=Transpose[v].eig.v Eigenvalues[A]