Web Notes > Math

Computing Eigenvalues Using Software Packages

Here are a few examples showing how eigenvalues are computed in various software packages. Most packages will also return the eigenvectors, if requested.

Using Ox:

#include 

main()
{
	decl a,eigs;
	a = <1, 2; 3, 4>;

	// Compute the eigenvalues and store them in eigs.  The & is
	// needed so that Ox can use eigs to return the eigenvalues.

	eigen( a, &eigs );
	print( eigs );
}

Using Gauss:

let x[2,2] = {1 2,3 4}; 
eig(x);

Using Maple:

#  This line activates the linear algebra package.  It produces two
#  messages about norm and trace being redefined, which is OK.

with(linalg):

#
#  Create a matrix
#

a:=matrix( [ [1,2],[3,4] ] );

#
#  Calculate its eigenvalues
#

b:=eigenvals(a);

#
#  Exit from maple
#

quit;

Site Index | Zoom | Admin
URL: https://wilcoxen.maxwell.insightworks.com/pages/817.html
Peter J Wilcoxen, The Maxwell School, Syracuse University
Revised 06/04/2004