🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.math.num-analysis
Article #1219

Re: Very simple eigenvector/eigenvalue calculation

#1219
From: Alan Miller
Date: Wed, 07 Nov 2001 11:06
39 lines
2948 bytes
jonmach wrote in message ...
>Hi All,
>
>I've trawled the net and have found some very comprehensive libraries
>and source for calculating the eigenvalues/eigenvectors of an nxn
>matrix.  However, this is very much overkill for what I need.
>
>I have a single 2X2 matrix holding real values and simply need to
>calculate the 2 eigenvalues and corresponding eigenvectors.  Is there
>a very simple algorithm for this that already exists in
>C/Fortran/Java/C++?
>
>Many many thanks in advance for any assistance on this.
>
>Jon

The matrix:-
( a  b )
( c  d )
has eigenvalues obtained by solving (a-x)(d-x) - bc = 0 for x.
This is simply a quadratic equation, and the solutions are:
2x = -(a+d) +/- sqrt[ (a-d)^2 + 4bc ]
The roots can of course be complex, if b & c have opposite signs
and are moderately large compared with the diagonal elements a & d.
The eigenvectors can then be written as (b, x-a) or (x-d, c).

Complex operations and variables are intrinsic in Fortran, so that
may be the easiest language to use.

Now I have done your homework for you, you may like to look up
the numerical solution of quadratic equations to minimize cancellation
errors.   If (a-d)^2 is approximately equal to -4bc, the cancellation errors
could be very large, if you use the simple formula above.

--
Alan Miller (Honorary Research Fellow, CSIRO Mathematical
& Information Sciences)
http://www.ozemail.com.au/~milleraj
http://users.bigpond.net.au/amiller/
Technical Details
Message-ID: <iB8G7.310759$bY5.1235789@news-server.bigpond.net.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-xfer.siscom.net!intgwlon.nntp.telstra.net!news-server.bigpond.net.au!not-for-mail
References: <c31cdc29.0111070230.16042ed1@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11516a,e88e7b69d54b66a5
X-Google-Attributes: gid11516a,public
X-Google-Thread: 109d8a,e88e7b69d54b66a5
X-Google-Attributes: gid109d8a,public
X-Google-Thread: 1014db,e88e7b69d54b66a5
X-Google-Attributes: gid1014db,public
X-Google-Thread: 107079,e88e7b69d54b66a5
X-Google-Attributes: gid107079,public
X-Google-Thread: 10d67e,e88e7b69d54b66a5
X-Google-Attributes: gid10d67e,public
X-Google-ArrivalTime: 2001-11-07 03:06:59 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-xfer.siscom.net!intgwlon.nntp.telstra.net!news-server.bigpond.net.au!not-for-mail
From: "Alan Miller" <amiller@bigpond.net.au>
Newsgroups: sci.math.num-analysis,sci.math,comp.lang.c,aus.mathematics,alt.math.undergrad
References: <c31cdc29.0111070230.16042ed1@posting.google.com>
Subject: Re: Very simple eigenvector/eigenvalue calculation
Lines: 42
X-Newsreader: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Message-ID: <iB8G7.310759$bY5.1235789@news-server.bigpond.net.au>
Date: Wed, 07 Nov 2001 11:06:54 GMT
NNTP-Posting-Host: 203.45.22.93
X-Complaints-To: news@bigpond.net.au
X-Trace: news-server.bigpond.net.au 1005131214 203.45.22.93 (Wed, 07 Nov 2001 22:06:54 EST)
NNTP-Posting-Date: Wed, 07 Nov 2001 22:06:54 EST
Organization: BigPond Internet Services (http://www.bigpond.net.au)