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. |
|||
04-11-2015, 07:56 PM
Post: #2
|
|||
|
|||
RE: Need help debugging program on HP 35s
You might find this program helpful:
A Matrix Multi-Tool for the HP 35s Programmable Calculator Kind regards Thomas |
|||
04-12-2015, 12:18 PM
(This post was last modified: 04-12-2015 12:23 PM by Jeff_Kearns.)
Post: #3
|
|||
|
|||
RE: Need help debugging program on HP 35s
(04-11-2015 03:12 PM)mbrethen Wrote: I'm learning to program on the HP 35s; Based on this article, you have some experience with this calculator and Stephan's program. Jeff |
|||
04-12-2015, 08:19 PM
(This post was last modified: 04-13-2015 02:14 AM by mbrethen.)
Post: #4
|
|||
|
|||
RE: Need help debugging program on HP 35s
That was my first try at programming the 35s. I made some minor modifications to an existing program written by Mr. Hanson and used it along with the other program from Stefan, already mentioned, for some engineering classes I was taking at the time.
So, yeah, I'm still learning. After spending a week debugging this program I traced the errors to lines L091-L114. Code: L001 LBL "L" I decided to replace those menu-driven programs with a library of matrix programs that use a control-number format similar to the 41 Advantage module. So far, I have added the following to my library: 1. Storing a Matrix (which can be found here). 2. Addition & Subtraction 3. Multiplication 4. Norm of a Matrix 5. Trace of a Square Matrix 6. Transpose a) General case b) Square Matrix 7. Copying a Matrix They are translations of Jean-Marc Baillard's programs for the 41. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)