What is this HP-41 program doing? « Next Oldest | Next Newest »

 ▼ HrastProgrammer Senior Member Posts: 381 Threads: 32 Joined: Mar 2006 07-26-2002, 02:50 AM LBL A RCL Z ST+ T * 4 * RCL Y CHS STO Z X^2 X<>Y - SQRT STO T X<>Y + LASTX R^ - RCL Z ST/ Z / END Just a little exercise for the hot summer days ... ▼ Ex-PPC member Member Posts: 142 Threads: 24 Joined: Jan 1970 07-26-2002, 04:12 AM It is computing the real roots of a quadratic equation, where the coefficients have been entered into the X,Y,Z stack registers initially. ▼ HrastProgrammer Senior Member Posts: 381 Threads: 32 Joined: Mar 2006 07-26-2002, 06:33 AM Bravo! I used it in the school, some 17 years ago. In fact, I have used the following program which can handle complex solutions as well: LBL A CF 00 RCL Z ST+ T * 4 * RCL Y CHS STO Z X^2 X<>Y - X<0? SF 00 FS? 00 CHS SQRT FS? 00 GTO 01 STO T X<>Y + LASTX R^ - LBL 01 RCL Z ST/ Z / END Real solutions: flag 0 cleared, X=x1, Y=x2 Complex solutions: flag 0 set, X=Im, Y=Re The size of this program is 41 bytes (not counting LBL A and END). I am aware this is not optimal and would like to make a proposal: Who can write a shorter program? Only stack registers and flag 00 can be used. Alpha register and data registers cannot be used. Synthetic instructions are welcome but alpha register should not be disturbed. ▼ HrastProgrammer Senior Member Posts: 381 Threads: 32 Joined: Mar 2006 07-26-2002, 06:48 AM This is a slightly modified version: LBL A CF 00 RCL Z ST+ T * 4 * RCL Y CHS STO Z X^2 X<>Y - X<0? SF 00 ABS SQRT FS? 00 GTO 01 STO T X<>Y + LASTX R^ - LBL 01 RCL Z ST/ Z / END 39 bytes. ▼ Mike (Stgt) Posting Freak Posts: 858 Threads: 80 Joined: Feb 2009 07-26-2002, 08:57 AM Reminds me the integration with Simpson rule I've once done only on the stack. Was useful when you had a table of points with uniform steps in X. Ciao.....Mike Vieira, Luiz C. (Brazil) Posting Freak Posts: 4,027 Threads: 172 Joined: Aug 2005 07-26-2002, 02:39 PM Hi, HrastProgrammer; Hey, have a look here. If you cannot open it, tell me and I'll send the text. Cheers. ▼ HrastProgrammer Senior Member Posts: 381 Threads: 32 Joined: Mar 2006 07-28-2002, 03:00 AM Thanks Luiz ...

 Possibly Related Threads... Thread Author Replies Views Last Post HP-41(CL): The easiest way to transfer FOCAL programs from a Linux PC to the HP-41 Geir Isene 13 2,551 12-05-2013, 02:40 AM Last Post: Hans Brueggemann HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 1,163 11-11-2013, 08:28 PM Last Post: Davi Ribeiro de Oliveira Updated PPC DVD Version 2.10: HP-41 Searchable Program Files and Scannable Barcode Jake Schwartz 3 872 09-27-2013, 09:51 PM Last Post: Olivier (Wa) Looking for PLTMX80 program for HP- 41 Ángel Martin 1 435 10-19-2012, 05:21 AM Last Post: Ángel Martin New 41 model to use rom of "big" program Olivier De Smet 4 782 10-03-2012, 07:35 PM Last Post: Brian Walsh Editable PDF Docs for HP-41 Program Documentation? Namir 8 1,162 03-08-2012, 11:13 PM Last Post: John Robinson HP-41 Ohms Law Program Jeff Davis 45 4,502 12-28-2010, 09:23 PM Last Post: Ren HP-41: Sail boat parameter program Geir Isene 0 354 11-24-2010, 01:37 PM Last Post: Geir Isene HP-41 Program conversion to Text files Jeff Davis 9 1,211 01-28-2008, 02:54 AM Last Post: Christoph Klug HP-41 MCODE: Making an MCODE program call another MCODE program Geir Isene 10 1,388 01-13-2008, 05:58 AM Last Post: Raymond Del Tondo

Forum Jump: