Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!julius.cs.uiuc.edu!news.cs.indiana.edu!msi.umn.edu!noc.MR.NET!gacvx2.gac.edu!hhdist From: postmaster.DUNG_BEETLE@gateway.qm.apple.com (postmaster) Newsgroups: comp.sys.handhelds Subject: Steve Winters :Unknown QM u Message-ID: <9101040905.AA19854@internal.apple.com> Date: 4 Jan 91 09:09:24 GMT Lines: 187 To: handhelds@gac.edu Return-path: To: handhelds@gac.edu Mail*Link#170# Steve Winters :Unknown QM u Received: by gateway.qm.apple.com; 4 Jan 91 01:09:21 Received: from apple.com by goofy.apple.com with SMTP (5.61/25-eef) id AA19787; Fri, 4 Jan 91 01:04:38 -0800 for Steve_Winters.PERIPH_PROJ@gateway.qm.apple.com Received: from gacvx2.gac.edu by apple.com with SMTP (5.61/25-eef) id AA02826; Fri, 21 Dec 90 18:06:15 -0800 for Steve_Winters.PERIPH_PROJ@gateway.qm.apple.com Date: Fri, 21 Dec 1990 20:01 CST From: handhelds@gac.edu Subject: Re: Eigenvalues Sender: NEWSMGR@gacvx2.gac.edu To: HANDHELDS@gacvx2.gac.edu Errors-To: postmaster@gac.edu Reply-To: handhelds@gac.edu Message-Id: <87042285C000103D@gacvx2.gac.edu> X-Vms-To: IN%"HANDHELDS@GACVX2.GAC.EDU" Comments: Forwarded from COMP.SYS.HANDHELDS by GACVX2.GAC.EDU Relay-Version: VMS News - V6.0-1 14/11/90 VAX/VMS V5.4; site gacvx2.gac.edu Path: gacvx2.gac.edu!noc.MR.NET!msi.umn.edu!src.honeywell.com!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!orstcs!usenet!jacobsd Newsgroups: comp.sys.handhelds Subject: Re: Eigenvalues Message-ID: <1990Dec22.002458.26290@usenet@scion.CS.ORST.EDU> From: jacobsd@usenet@scion.CS.ORST.EDU (Dana Jacobsen) Date: 22 Dec 90 00:24:58 GMT References: <9012201714.AA26392@CS.ORST.EDU> Organization: Oregon State University, Computer Science Dept Lines: 155 In <9012201714.AA26392@CS.ORST.EDU> john%solvint@orstcs.UUCP writes: >> Someone posted a message containing the program >> \<> (where I = Identity matrix) >> for finding the characteristic polynomial of a matrrix A. >> I can't make it work because the 48 doesn't seem to permit >> symbolic entries in arrayse, as was also the case with the 28s >> Can someone give me the reference to this message? >> Thanks...jim_wendel@ub.cc.umich.edu or jwendel@isdmnl.wr.usgs.gov >> >> >Symbollic entries in arrays is not the point. >One uses this program by making it the current SOLVER equation, putting a square >array in 'A', the square identity in 'I' and solving for 'L', the eigenvalue. >This program looks like it was taken from the "Easy Course in Using the HP-28S" since the 28 >doesn't have the lambda character, L was used instead. The HP-28 solution book "Matrices & Vectors" has a more elegant solution that is probably faster and works better in that you don't have to call the solver. I wrote a plug-and-chug program around this. Enter the matrix, press the key, and you get back the eigenvalues. It works by finding the characteristic polynomial, then solving for that. I posted this a while ago, but some peopl seem to have missed it, and I also left out the root-finding programs. This program needs some way of solving an arbitrary degree polynomial. The program "BAIRS" which came by the net a while back seems to do the job well. I don't remember who wrote this though (Wayne Scott?). All the programs are available via anonymous FTP from scion.cs.orst.edu (128.193.32.25):~ftp/pub/jacobsd/{hp.eig,hp.proot}. %%HP: T(3)A(R)F(.); EIGVAL \<< 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 \>> This is my eigenvalue program. PROOT is a program that will solve f(x)=0 for a polynomial. It takes a list of numbers which are coefficients for the polynomial (i.e. "4 * x^2 + 3 * x - 3" would be { 4 3 -2 } ). Programs for this are available on the net, or I could send mine to you. (Or you can anonymous ftp it from scion.cs.orst.edu:pub/jacobsd/proot & math) The files aren't in great shape (^M's at the end of each line) but it's there. Start: An n x n matrix in level 1 Stop: n real or complex values on the stack. These are the eigenvalues. %%HP: T(3)A(R)F(.); PROOT \<< DUP SIZE \-> n \<< IF n 3 > THEN DUP { HOME MATH POLY BAIRS } RCL EVAL SWAP OVER { HOME MATH POLY PDIV } RCL EVAL DROP2 \-> a b \<< a PROOT b PROOT \>> ELSE IF n 2 > THEN { HOME MATH POLY QUD } RCL EVAL ELSE LIST\-> DROP NEG SWAP / END END \>> \>> BAIRS \<< LIST\-> 1 1 \-> n R S \<< DO 0 n 1 + PICK 0 0 0 4 PICK 5 n + 7 FOR J J PICK R 7 PICK * + S 8 PICK * + 7 ROLL DROP DUP 6 ROLLD R 3 PICK * + S 4 PICK * + 5 ROLL DROP -1 STEP 3 PICK SQ 3 PICK 6 PICK * - IF DUP 0 == THEN DROP 1 1 ELSE 6 PICK 6 PICK * 5 PICK 9 PICK * - OVER / 4 PICK 9 PICK * 8 PICK 7 PICK * - ROT / END DUP 'S' STO+ SWAP DUP 'R' STO+ UNTIL R\->C ABS .000000001 < 7 ROLLD 6 DROPN END n DROPN 1 R NEG S NEG 3 \->LIST \>> \>> QUD \<< LIST\-> \->ARRY DUP 1 GET / ARRY\-> DROP ROT DROP SWAP 2 / NEG DUP SQ ROT - \v/ DUP2 + 3 ROLLD - \>> That's it. Hope everything works fine -- I don't have a cable to transfer the stuff, so got a friend to do the transfer.. -- 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'