HP Forums
A Third Order Complex Linear Equation Solver for the hp 33s - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: A Third Order Complex Linear Equation Solver for the hp 33s (/thread-117023.html)



A Third Order Complex Linear Equation Solver for the hp 33s - Palmer O. Hanson, Jr. - 06-20-2007

In response to publication of my "Sixth Order Linear Equation Solver for the hp 33s" (Article No. 676) correspondent Gerson W. Barbosa wrote "... Now, a fourth or even a third order Complex Linear Equation Solver would be great, but that would be asking too much, I recognize."

I have written a third order complex linear equation solver for the hp 33s. It is much too long to be in the Forum so it has been posted as Article 722.

So far, I have only tested the program with three problems:

1. The test problem in Article 722.

2. The test problem in Article 722 modified to cause a determinant of zero which will trigger the "DIVIDE BY ZERO" abort.

2. The Simultaneous Equation problem from page 15-18 of the hp 33s User's Guide to demonstrate the capability to solve third order linear equations with real coefficients.


Re: A Third Order Complex Linear Equation Solver for the hp 33s - Gerson W. Barbosa - 06-21-2007

Quote:
In response to publication of my "Sixth Order Linear Equation Solver for the hp 33s" (Article No. 676) correspondent Gerson W. Barbosa wrote "... Now, a fourth or even a third order Complex Linear Equation Solver would be great, but that would be asking too much, I recognize."

Hey, thank you very much Sir!

Of course, when I said "asking too much" I didn't mean this was not feasible. I meant it was a difficult task to ask to someone who'd already given us a sixth order linear equation solver (and later even an eighth order one!). I am glad you have written this, even if it might not be so useful to you as it may be to some of us here. When I needed to solve complex linear systems at college, I relied on an HP-28S, but then I did write a program for the SHARP PC-1211 for a colleague, but the task was way easier in BASIC than it is in RPN keystroke programming.

Quote:
So far, I have only tested the program with three problems

I will try it later with a real problem I once had to solve at work.

Best regards,

Gerson.


Mea Culpa - Palmer O. Hanson, Jr. - 06-24-2007

I listed the command at step M0058 incorrectly as STO (I) which, of course, is not a valid command. The command should be STO (i) .


Re: A Third Order Complex Linear Equation Solver for the hp 33s - Gerson W. Barbosa - 07-04-2007

For a problem this long, perhaps it should be useful if you include a length and checksum table in your article, so that the user has an easy way to check if everything was keyed in correctly:

LABEL LENGTH CHECKSUM
------------------------
L 45 C89C
M 432 A45A
D 210 038E
V 150 9987
X 27 6AB0

A preference for roman numerals when choosing the labels or just a coincidence? I haven't checked your program with other problems, so the table should be checked against your own.

By the way, my n-order complex equation solver for the CASIO PB-700 finds the same answers to your test problem in 14.5 seconds.

Best regards,

Gerson.

-----------------------------------------------------------------------------------------------

10 CLS :CLEAR :INP T=R(L,J):R(L,J)=R(I, D=I(I,I):GOSUB 290
UT "Order: ",N:N=N-1 J):R(I,J)=T 210 R(I,N+1)=X:I(I,
:DIM R(N,N+1),I(N,N+ 100 T=I(L,J):I(L,J) N+1)=Y:NEXT I:BEEP :
1) =I(I,J):I(I,J)=T:NEX FOR I=0 TO N:CLS
20 FOR I=0 TO N:FO T J 220 PRINT "XR(";I+1
R J=0 TO N+1 110 FOR J=I+1 TO N ;"):";USING"#####.##
30 CLS :PRINT "R(" 120 A=R(J,I):B=I(J, ####";R(I,N+1);:LOCA
;I+1;",";J+1;"):";:L I):C=P:D=Q:GOSUB 290 TE 0,2
OCATE 0,2:PRINT "I(" :F=X:G=Y 230 PRINT "XI(";I+1
;I+1;",";J+1;"):"; 130 FOR K=I+1 TO N+ ;"):";USING"#####.##
40 LOCATE 12,0:INP 1:A=F:B=G:C=R(I,K):D ####";I(I,N+1);
UT "",R(I,J):LOCATE =I(I,K):GOSUB 280 240 X$=INKEY$:IF X$
12,2:INPUT "",I(I,J) 140 R(J,K)=R(J,K)-X ="" THEN 240 ELSE NE
:NEXT J:NEXT I :I(J,K)=I(J,K)-Y:NEX XT I
50 CLS :PRINT "Wai T K:NEXT J:NEXT I 250 IF X$=" " THEN
t...":FOR I=0 TO N-1 150 A=R(N,N):B=I(N, 10 ELSE CLS :END
:P=R(I,I):Q=I(I,I):L N):GOSUB 300:IF M<1E 260 CLS :BEEP :BEEP
=0 -10 THEN 260 :PRINT "No solution
60 FOR J=I+1 TO N: 160 FOR I=N TO 0 ST !"
A=R(J,I):B=I(J,I):GO EP -1:R=0:S=0:J=I 270 X$=INKEY$:IF X$
SUB 300:T=M:A=P:B=Q 170 IF J>N-1 THEN 2 ="" THEN 270 ELSE 25
70 GOSUB 300:IF T> 00 0
M THEN P=R(J,I):Q=I( 180 J=J+1:A=R(I,J): 280 X=A*C-B*D:Y=A*D
J,I):L=J B=I(I,J):C=R(J,N+1): +B*C:RETURN
80 NEXT J:A=P:B=Q: D=I(J,N+1) 290 M=C*C+D*D:X=(A*
GOSUB 300:IF M<1E-10 190 GOSUB 280:R=R+X C+B*D)/M:Y=(B*C-A*D)
THEN 260 ELSE IF L= :S=S+Y:GOTO 170 /M:RETURN
0 THEN 110 200 A=R(I,N+1)-R:B= 300 M=A*A+B*B:RETUR
90 FOR J=I TO N+1: I(I,N+1)-S:C=R(I,I): N

-----------------------------------------------------------------------------------------------

1 < N < 30 (with all three 4KB memory packs in place)


Edited to correct a typo in line 130.


Edited: 5 July 2007, 5:05 p.m.


Re: A Third Order Complex Linear Equation Solver for the hp 33s - Palmer O. Hanson, Jr. - 07-06-2007

Gerson:

You wrote:

Quote:
A preference for roman numerals when choosing the labels or just a coincidence? I haven't checked your program with other problems, so the table should be checked against your own.

I used the labels I did because those were the ones which were available with two other programs on the machine. That may mean that I have a distaste for roman numerals, but I don't think so.

I match your lengths for all five programs. Unfortunately, I had to move my 33s programs around and had to use Label P instead of Label D. That means that the checksums for M and P are different.

I devised the original test problems with pencil and paper so using integers was an easy way to do it. But, I am always a little nervous until I have also run a program such as this with non integers. I was using my HP-28s for another problem when I belatedly discovered that it can divide a complex vector by a complex matrix. I have subsequently run several problems with values other than integers and the HP-28s results and the HP-33s results agree.

Edited: 7 July 2007, 3:03 a.m.