jacobsd@prism.cs.orst.edu (Dana Jacobsen) (11/12/90)
EIGVAL is a program I wrote that calculates eigenvalues. It takes a matrix,
and returns the eigenvalues (n eigenvalues for a n by n matrix). It is not
the most efficient algorithm, but it works. I took the algorithm from the
book "HP28 Step-by-Step Solutions: Vectors and Matrices." Eventually I'll
do an eigenvector program.
Sorry, but I don't have a cable for my 48, so I just typed this in. Maybe
next time.
<<
DUP DUP SIZE 1 GET
-> t g n
<<
{ }
1 n START
0 1 n FOR i
t i DUP
2 ->LIST GET
+
NEXT
1 ->LIST
+ 't' g STO*
NEXT
-> b
<<
{ 1 }
1 n FOR i
-> s
<<
0 1 i FOR j
b j GET
s i j - 1 + GET
* -
NEXT
i /
1 ->LIST s SWAP +
>>
NEXT
>>
>>
PROOT
>>
PROOT is a program that takes a polynomial in a list ( "2*x^2 + 3^x - 2" would
be {2 3 -2}) and returns it's roots. The version I have calls BAIRS repeatedly
until it can factor quadratics. This should be available elsewhere.
--
Dana Jacobsen Oregon State University
jacobsd@cs.orst.edu Computer Science Department
Dana Jacobsen Oregon State University
jacobsd@cs.orst.edu Computer Science
.!hplabs!hp-pcd!orstcs!jacobsd
Dana_Jacobsen@RPITSMTS.BITNET `Once a daemon, always a daemon'akcs.briank@hpcvbbs.UUCP (Brian Korver) (12/06/90)
Here is a simple PROOT program and a program that uses QUAD to factor
_second_ order and lower polynomials that result from PROOT. Of course,
only being able to factor second order polynomials isn't all that
exciting. Oh well.
%%HP: T(3)A(D)F(.);
\<<
DUP SIZE 0 \-> L SZ
EQN
\<< SZ 1
FOR i L i GET
SZ i - '\Gl' SWAP ^ *
EQN + 'EQN' STO -1
STEP EQN
\>>
\>>
---Oopps, that above is PROOT
--This is the solver routine
\<<
'\Gl' QUAD DUP 1 \->
s1
\<< EVAL SWAP -1
's1' STO EVAL
\>>
\>>