The Museum of HP Calculators

HP Forum Archive 14

 Simul. Solve w/ HP 33sMessage #1 Posted by f15e on 2 Aug 2004, 12:52 p.m. I bought the HP 33S a few days ago. I am interested in a way to do simultaneous solving. I see a program in the manual, but it looks like it is for 3 equations. I have a TI-89 and TI-92+ which allows you to just enter any number of equations in order to solve for the unknown variables. Any ideas on a program that allows you to specify the number of equations(variables) you want to solve for? If there is a site somewhere out there that is helpful with HP 33s programs, I would really appreciate the name of the site or link!! I bought this calculator b/c of the 3 calculators I have, none are allowed for the FE/EIT exam. I am so used to my TI's and getting used to using this HP 33S is not going very well. Edited: 2 Aug 2004, 1:06 p.m.

 Re: Simul. Solve w/ HP 33sMessage #2 Posted by martin cohen on 2 Aug 2004, 2:02 p.m.,in response to message #1 by f15e A while back, I posted 33s code for solving a 3x3 system of linear equations. It used standard code for the determinant of a 3x3 matrix, combined with a routine for exchanging the right column with any of the first 3 columns and used Cramer's rule for getting the solutions without destroying the original information (this is important on a machine with as little data storage as the 33s). A 4x4 could be done similarly. The hard part would be getting the determinant of a 4x4 matrix. This could be done by the complete expansion (24 terms, each with the product of 4 elements) or using the existing 3x3 determinant routine and expanding by minors. I have found that mixing rpn and equations works very nicely in coding something like this. An equation does not use the stack, but it cannot be edited. My current main gripes about the 33s (all easily correctable by HP in a 33s+): 1) Need more labels and variables; 2) Need more storage (As Prof. Seuss said, "On Beyond Zebra!"); 3) Make the decimal point more visible. Martin Cohen

 Re: Simul. Solve w/ HP 33sMessage #3 Posted by bill platt on 2 Aug 2004, 2:05 p.m.,in response to message #2 by martin cohen Quote: My current main gripes about the 33s (all easily correctable by HP in a 33s+): And more importantly---fix the bugs without making new ones!

 Re: Simul. Solve w/ HP 33sMessage #4 Posted by f15e on 2 Aug 2004, 2:42 p.m.,in response to message #2 by martin cohen So the only Labels available to be used are A thru Z, therefore only 26 labels? Is there any way to double-up on letters like AA or AC? I just got this HP 33s and I am in the feeling out process, so forgive me if I ask any stupid questions. Edited: 2 Aug 2004, 2:46 p.m.

 Re: Simul. Solve w/ HP 33sMessage #5 Posted by Fubar Vikinghelmet on 2 Aug 2004, 2:59 p.m.,in response to message #4 by f15e Nope, no doubling-up of labels. It would be nice... Once the PE exam is over, I'm throwing out (well, I might sell 'em...) my HP33S's and going back to my HP-28S.

 Re: Simul. Solve w/ HP 33sMessage #6 Posted by Brent on 2 Aug 2004, 6:47 p.m.,in response to message #4 by f15e The tests are designed such that you won't need to solveany more than a 3x3 system. You probably won't even have to solve a 3x3. Edited: 2 Aug 2004, 6:48 p.m.

 Re: Simul. Solve w/ HP 33sMessage #7 Posted by Norris on 2 Aug 2004, 8:40 p.m.,in response to message #4 by f15e If you are taking the EIT or PE exam, then the most important thing about your calculator is that you should feel comfortable with it. Advanced features are of secondary importance -- people routinely pass these exams using ordinary \$15 scientific calcs from the drug store. Any problem on the EIT exam can be solved using a basic calculator and the info in the NCEES Reference Handbook (which you should also be very comfortable with). For most EIT problems, the actual equations are not very complicated; you just have to know how to apply them. For some problems, however, you do have to work with a relatively complex equation, and in such cases you may have an advantage if the equation has been pre-programmed into your calculator. The 33S is good for this because it can store a whole lot of equations. For example, you will probably find that the time-value of money equation is very helpful with engineering economics problems (see the 33S manual). Store equations, rather than programs, wherever possible because the 33S runs out of labels real fast. Systems of 2 or 3 linear equations could possibly come up on the EIT exam. But nothing beyond that. If the 33S doesn't work for you, you might try the Casio FX-115 MS Plus. It's NCEES-approved and widely available for about \$15. Not programmable, but it does solve systems of 2 or 3 linear equations.

 Re: Simul. Solve w/ HP 33sMessage #8 Posted by martin cohen on 2 Aug 2004, 9:19 p.m.,in response to message #7 by Norris Here is my transcription (from my 33s) of my routines for solving 2x2 and 3x3 linear systems. =========================================================== These are my routines for solving 2x2 and 3x3 linear equations. They use Cramer's rule (ratio of determinants) to solve the equations. The coefficients are not changed when the equations are solved. This is useful on the 33s, where so few values can be stored. The routines are: ```S: Solve 3x3 linear system (A,B,C;E,F,G;I,J,K).(X,Y,Z)=(D,H,L) det in W Result in W (det), X, Y, Z; Display is detin X, then X, Y, Z Rv if display != 0 to see X, Y, Z T: Solve 2x2 linear system A*X+B*Y=D, E*X+F*Y=H Det in W; displayed when computed Result in X and Y and regs Note these are a subset of the 3x3 systems, instead of the expected A*X+B*Y=C, D*X+E*Y=F U: Get det(A,B,C;E,F,G;I,J,K) V: Swap column (D;H;L) with col (X-reg) I: Input A..L (uses label J) Inputs if X>0; clears if X=0; sets to random if X<0. Note: "Rv" means "rotate down", "!=" means "not equal to", "det" means "determinant". Comments indicated by "//". S: Solve 3x3 linear system (A,B,C;E,F,G;I,J,K).(X,Y,Z)=(D,H,L) det in W Result in W (det), X, Y, Z; Display is det in X-reg, then X, Y, Z Rv if display != 0 to see X, Y, Z Or, in matrix form, (A B C) (X) (D) (E F G). (Y) = (H) (I J K) (Z) (L) LBL S XEQ U STO W // GET DET 1 XEQ V XEQ U STO X // GET DET SWAPPING COL 1 WITH (D,H,L) 1 XEQ V // RESTORE MATRIX 2 XEQ V XEQ U STO Y // SAME FOR COL 2 2 XEQ V 3 XEQ V XEQ U STO Z // SAME FOR COL 3 3 XEQ V RCL W x!=0? STO/ X // IF DET NOT ZERO, SET X x!=0? STO/ Y // SAME FOR Y x!=0? STO/ Z // SAME FOR Z RCL Z RCL Y RCL X RCL W // GET RESULTS RTN // DONE T: Solve 2x2 linear system A*X+B*Y=D, E*X+F*Y=H Det in W; displayed when computed Result in X and Y and regs Note these are a subset of the 3x3 systems, instead of the expected A*X+B*Y=C, D*X+E*Y=F LBL T A*F-B*E STO W // SAVE THE DET VIEW W // SHOW IT D*F-B*H // DET FOR X STO X // STORE IT A*H-D*E // DET FOR Y STO Y // STORE IT RCL W // GET DET x!=0? STO/ X // IF NON-ZERO, GET TRUE X x!=0? STO/ Y // IF NON-ZERO, GET TRUE Y RCL Y RCL X RCL W // GET RESULTS RTN // DONE U: Get det(A,B,C;E,F,G;I,J,K) The matrix is: | A B C | | E F G | | I J K | LBL U RCL F RCL* K // F*K RCL G RCL* J // G*J - RCL* A // A*(F*K-G*J) RCL B RCL* K // B*K RCL C RCL*J // C*J - RCL* E - // THAT - E*(B*K-C*J) RCL B RCL* G // B*G RCL C RCL* F // C*F - RCL* I + // THAT + I*(B*G-C*F) RTN // THAT'S THE DET V: Swap column (D;H;L) with col (X-reg) LBL V STO i // STORE COLUMN INDEX (1=(A,E,I), 2=(B,F,G), 3=C,G,E)) RCL D x<>(i) STO D // SWAP D WITH FIRST ROW 4 STO+ i // POINT TO NEXT ROW RCL H x<>(i) STO H // SWAP H WITH SECOND ROW 4 STO+ i // POINT TO NEXT ROW RCL L x<>(i) STO L // SWAP L WITH THIRD ROW RTN // THAT'S IT I: Input A..L (uses label J) Inputs if X>0; clears if X=0; sets to random if X<0. LBL I STO X // SAVE INPUT 1.012 STO i // SET LOOP CONTROL LBL J RCL X // GET CONTROLLER x>0? INPUT (i) // IF > 0, ASK FOR VALUE x<0? RANDOM // IF < 0, GET A RANDOM VALUE STO (i) // STORE WHAT YOU GOT ISG i GTO J // LOOP RTN // DONE AFTER 12 K: Check one equation – i=0 for first LBL K 1 STO+ i // POINT TO ROW ELEMENT RCL X RCL* (i) // X*THAT 1 STO+ i Rv // POINT TO NEXT IN ROW RCL Y RCL* (i) + // ADD Y*THAT 1 STO+ i Rv // POINT TO NEXT IN ROW RCL Z RCL* (i) + // ADD Z*THAT 1 STO+ i Rv // POINT TO NEXT IN ROW RCL- (i) // SUBTRACT RIGHT SIDE RTN // THAT'S THE DIFFERENCE Martin Cohen ```

 Simul. SolveMessage #9 Posted by f15e on 3 Aug 2004, 11:42 a.m.,in response to message #8 by martin cohen Hey Martin, 1.) On the code you have above in your post, you have Rv as rotate down. Is this the same thing as Roll Down with the key that has an R with an arrow pointing down? 2.) In the line of code, "RCL W x!=0? STO/ X // IF DET NOT ZERO, SET X" did you mean to put the / after the STO or is it just STO X? If it is correct, I am guessing the / is a division sign. 3.) Also, after I have put the code in, how is it run? I am not sure how the program is supposed to be run or what, if any, other equations or other things need to be put in for the program to work. Forgive me for all the questions, but I am in the learning process. Thanks for your help!! Edited: 4 Aug 2004, 10:47 a.m.

 Re: Simul. Solve w/ HP 33sMessage #10 Posted by martin cohen on 4 Aug 2004, 3:21 p.m.,in response to message #8 by martin cohen With his permission, I am posting here my response to Kipp Dore's questions: ========================================================= ```Kipp, I have interlaced my replies after your questions, below. --- Kipp Dore' wrote: > Hey Martin, > > I hope I am not bothering you but I have a few questions > about the code you > posted in the HP forum under the thread "Simul. Solve w/ > HP 33s" a few days > ago. > > 1.) In the code you have posted before in the "Simul. > Solve w/ HP 33S" > thread below, you have Rv as rotate down. Is this the > same thing as Roll > Down with the key that has an R with an arrow pointing > down? Yes - this is because the ascii keyboard has no "down-arrow" key. > 2.) In the line of code, > "RCL W x!=0? STO/ X // IF DET NOT ZERO, SET X" > did you mean to put the / after the STO or is it just STO > X? If it is > correct, I am guessing the / is a division sign. Correct again - "/" means "divides". > I also > see, as in the line > of code above, that you have the code all in one line but > actually the code > would be on separate lines like this: > RCL W > x!=0? > STO/ X > correct? Yep - it's my way of taking fewer lines. > These may seem like stupid questions, > but I just want to > make sure I am doing everything correctly. If you are just learning the 33s, these seem quite reasonable. > 3.) Also, after I have put the code in, how is it run? I > am not sure how the > program is supposed to be run or what, if any, other > equations or other > things need to be put in for the program to work. Use the "XEQ" key to run 33s programs. For example, to run the "solve 3x3 system" code (after the coefficients have been entered into A through L), press "XEQ". The 33s will prompt for a label; you press the key with "S" and the code starting at label S will run. This is explained in the manual. > Forgive me for all the questions, but I am in the > learning process. If there > is a site that explains how to run the code, I would > appreciate it. I don't have a web site. But, remember "the manual is your friend." > Thanks for your help!! > > You are welcome. If you have further questions, you should post them to hpmuseum or the newsgroup comp.sys.hp48. People there are willing (and often eager) to help neophytes ```

 Re: Simul. Solve w/ HP 33sMessage #11 Posted by Veli-Pekka Nousiainen on 8 Aug 2004, 7:27 a.m.,in response to message #4 by f15e ```So the only Labels available to be used are A thru Z, therefore only 26 labels? Is there any way to double-up on letters like AA or AC? ============================================== That would break old code. I suggest using numeric labels nn for subroutines Then the GTO(i),XEQ(i) would still jump correctly to main programs. i=1...26 => A...Z No LBL 00 (and not GTO 00 or XEQ 00 inside a main program), since the main program name corresponds to LBL 00. Example GTO(i), where i=2, would jump to LBL B program Example XEQ(i), where i=2.10, would call subprogram LBL B and there the subroutine LBL 10 (and will return after RTN instruction) Opinions? 'VPN' ```

 Re: Simul. Solve w/ HP 33sMessage #12 Posted by Norris on 9 Aug 2004, 2:54 p.m.,in response to message #11 by Veli-Pekka Nousiainen << I suggest using numeric labels nn for subroutines >> You can't use numeric labels on the 33S, only the letters A to Z. As stated in the 33S manual (p. 12-3): "The label is a single letter from A through Z...you cannot assign the same label more than once (this causes the message DUPLICAT.LBL)" << Example XEQ(i), where i=2.10, would call subprogram LBL B and there the subroutine LBL 10 >> You can't assign a LBL 10, as noted above. And even if you could, the example would only call the program at LBL B. As stated in the manual (p. 13-22): "Only the absolute value of the integer portion of the number in i is used for addressing." For addressing labels, i can only be an integer from 1 to 26 (for labels A-Z). For addressing variables, i can be an integer from 1 to 33 (1-26 = variables A-Z, 27 = i-register, 28-33 = statistics registers). So any fractional values in i are simply ignored. And any integers other than those listed above return the INVALID(i) message. Am I missing something here ?

 Re: Simul. Solve w/ HP 33s+Message #13 Posted by Veli-Pekka Nousiainen on 10 Aug 2004, 11:57 p.m.,in response to message #12 by Norris Suggestions for HP 33s+ [VPN]

 Re: Simul. Solve w/ HP 33s+Message #14 Posted by Norris on 11 Aug 2004, 7:27 p.m.,in response to message #13 by Veli-Pekka Nousiainen OK. Now I get it.

 Re: Simul. Solve w/ HP 33sMessage #15 Posted by f15e on 3 Aug 2004, 12:47 a.m.,in response to message #1 by f15e Thanks for the information. Norris, I am just looking to save some time during the test. I know how to simultaneously solve a given number of equations, but three or more equations to solve can take some time; not a lot of time, but more time than using a program on the HP 33s. Believe me, I am not one who relies on a calculator to do all my work, but when your pressed for time on a test like the FE/EIT, time is precious. I will not be taking the exam until April of 2005, but I want to be very prepared. I know I won't be having much time to spend on reviewing for the FE during the Fall semester, so I am getting in as much as I can right now and learn how to use the HP 33s. Edited: 3 Aug 2004, 12:49 a.m.

 Re: Simul. Solve w/ HP 33sMessage #16 Posted by Norris on 3 Aug 2004, 11:34 a.m.,in response to message #15 by f15e I agree that the 33S could save you some time if a system of 2 or 3 equations came up (you won't get a system larger than that). If I were taking the EIT exam now, I would probably use a 33S and would likely load it with martin cohen's program listed above. As it happens, I took the EIT exam before NCEES banned graphing calculators, so I was able to use the much more powerful 48GX. Your initial post indicated that "getting used to using this HP 33S is not going very well." My main point is that you need to be totally familiar and comfortable with your calculator by exam time. You have plenty of time to get used to the 33S, but if it never seems to "feel" right to you, then you should not hesitate to switch to some other NCEES-approved model, even if it's just a basic non-programmable scientific. On NCEES exams, your comfort level is more important than any fancy calculator feature.

 Re: Simul. Solve w/ HP 33sMessage #17 Posted by f15e on 3 Aug 2004, 11:51 a.m.,in response to message #16 by Norris I am slowly learning the HP 33s Norris. I am sure by the time April comes around I will know it forwards and backwards. I am so used to my TI-89 and TI-92+. It would have been nice to be able to use either one of these calculators and not having had to buy a new calculator, but I guess that's they way it goes.

 Re: Simul. Solve w/ HP 33sMessage #18 Posted by Ron Ross on 3 Aug 2004, 12:31 p.m.,in response to message #17 by f15e Have you considered the Hp9G. It is probably most similiar to a Ti-80. But it is a graphics algebraic that is specifically allowed by the NCEES. And it is cheap, about \$30 via mail order or if you can find it retail. Something for you to consider if you don't/can't learn to like your Hp33s.

 Re: Simul. Solve w/ HP 33sMessage #19 Posted by Norris on 3 Aug 2004, 12:38 p.m.,in response to message #17 by f15e The NCEES ban on advanced calculators, which was only announced last year, came as a great shock and disappointment to many people. Some folks had been relying on their HP48 for ~10 years, or their HP42S for ~15 years, or even their HP41 for ~20 years. Edited: 3 Aug 2004, 12:40 p.m.

 Re: Simul. Solve w/ HP 33sMessage #20 Posted by f15e on 3 Aug 2004, 7:31 p.m.,in response to message #1 by f15e If anyone has used Martin Cohen's code to do Simultaneous Solving, how is the code used? How do I run and get an answer using the program. His code is located under this thread and his response is the following: Re: Simul. Solve w/ HP 33s, martin cohen - 2 Aug 2004, 9:19 p.m. I would appreciate any help with this code. It seems to use less labels than the one in the manual.

 Re: Simul. Solve w/ HP 33sMessage #21 Posted by martin cohen on 7 Aug 2004, 4:59 p.m.,in response to message #20 by f15e Well, all the programs are run using the XEQ command (press the XEQ key, the the starting label of the routine). To input a 3x3 matrix, enter 0 to clear it, or -1 (anything negative) to generate a random matrix or 1 (anything positive) to explicitly enter all 12 values. Then do "XEQ I". If you have entered a positive values, you will be asked to enter values for A through L. If you have entered zero, all of A through L will be set to zero, If you entered a negative value, random values will be stored in A through L. To solve a 3x3 system of linear equations, do "XEQ S". To solve a 2x2 system of linear equations, do "XEQ T". Note that the 2x2 system is Ax+By = D, Ex+Fy=H. My code does NOT change the coefficients. The results are in the registers and X, Y, and Z.

 Re: Simul. Solve w/ HP 33sMessage #22 Posted by f15e on 8 Aug 2004, 11:55 p.m.,in response to message #21 by martin cohen Martin, I can't get your code to work by the prompting method. I don't really know where you want me to enter 0 to clear, -1 for RANDOM generation of numbers, or 1 to enter my own numbers. I enter 0 to clear at the home screen and then 1 enter. After I do XEQ I to get prompts for the coefficients, but after entering the numbers and do XEQ S, I get incorrect answers for X, Y, and Z. The code works b/c I entered each number into their correct coefficient letter with the STO A, STO B, etc... and this works. I just can't get it to work with the prompting method. I guess if I were clear about this part of your recent reply, I might get it to work: "To input a 3x3 matrix, enter 0 to clear it, or -1 (anything negative) to generate a random matrix or 1 (anything positive) to explicitly enter all 12 values. Then do "XEQ I". If you have entered a positive values, you will be asked to enter values for A through L. If you have entered zero, all of A through L will be set to zero, If you entered a negative value, random values will be stored in A through L." Where exactly do I enter zero, a negative value, or a positive value? Thanks!!! Edited: 8 Aug 2004, 11:56 p.m.

 Re: Simul. Solve w/ HP 33sMessage #23 Posted by martin cohen on 10 Aug 2004, 1:17 p.m.,in response to message #22 by f15e Enter 1, then do "XEQ I". You will be asked for the values in A through L. To solve the system of equations ```Ax+By+Cz = D Ex+Fy+Gx = H Ix+Jy+Kz = L enter"XEQ S". ``` The determinant will be in the x-register and W, x in the y-register and X, y in the z-register and Y, and Z in the t-register and Z. Enter "Rv" (rotate down) to get x, y, and z in their respective registers.

 Re: Simul. Solve w/ HP 33sMessage #24 Posted by f15e on 10 Aug 2004, 5:07 p.m.,in response to message #23 by martin cohen Ahh, yes. I ended up just writing my own program. I guess I needed to learn how to one day, so I wrote a program for equations with 2 variables and one with 3. It works very well. Thanks Martin.

 Re: Simul. Solve w/ HP 33sMessage #25 Posted by martin cohen on 11 Aug 2004, 9:48 p.m.,in response to message #24 by f15e Yes, I often do the same thing - it really helps my learning. That's why I wrote my equation solvers and sort routine. I would find it interesting to see your code - could you post it?

Go back to the main exhibit hall