Need help debugging program on HP 35s
|
04-11-2015, 03:12 PM
Post: #1
|
|||
|
|||
Need help debugging program on HP 35s
I'm learning to program on the HP 35s; most of my experience programming an HP calculator is with the 41 series. I wrote a program to Solve Linear Systems. Its objective is to reduce the matrix on the upper right to a diagonal form with only ones in the diagonal. The determinant of this matrix is also computed and stored in named variable D.
Given a system of equations, for example: 2x + 3y + 5z + 4t = 39 -4x + 2y + z + 3t = 15 3x - y + 2z + 3t = 19 5x + 7y - 3z + 2t = 18 is re-written 39 = 2x + 3y + 5z + 4t 15 = -4x + 2y + z + 3t 19 = 3x - y + 2z + 3t 18 = 5x + 7y - 3z + 2t storing these 20 numbers column-wise in R01 thru R20. -If flag F00 is clear the pivots smaller than E-7 ( line 60 ) is regarded as zero -If flag F00 is set, only zero is regarded as zero -CF 01 = partial pivoting , SF 01 = no pivoting There are 4 rows and 5 columns, CF 00 CF 01 4 ENTER 5 XEQ "L" ENTER Det A = 840 = Named Variable D Registers R05 thru R16 now contain the unit matrix and registers R01 thru R04 contain the solution x = 1 , y = 2 , z = 3 , t = 4 When the program stops, D = det A. Code: L001 LBL "L" Program Notes: Lines 28-38 Find the largest element of a column above the diagonal Lines 49-55 Swap rows Lines 59-78 Divides all the row by the pivot so this diagonal element becomes 1 Then this row is used to replace by 0 all the other elements of this column using linear combinations of rows. Lines 81-89 Scans all the column to which belongs a given pivot ( = 1 now ) If the element of this column is the diagonal element ( line 88 X=Y? ) the process below is skipped ( GTO L098 ). Lines 90-97 A linear combination of the rows is performed to replace the element of this column by 0. The program isn't working quite right yet and I haven't been able to trace the error. Any help would be appreciated. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Need help debugging program on HP 35s - mbrethen - 04-11-2015 03:12 PM
RE: Need help debugging program on HP 35s - Thomas Klemm - 04-11-2015, 07:56 PM
RE: Need help debugging program on HP 35s - Jeff_Kearns - 04-12-2015, 12:18 PM
RE: Need help debugging program on HP 35s - mbrethen - 04-12-2015, 08:19 PM
|
User(s) browsing this thread: 4 Guest(s)