Post Reply 
Cadillac Quadratic Solver behaving like an Edsel - Problem solved!!
09-16-2014, 03:14 PM
Post: #21
RE: Cadillac Quadratic Solver behaving like an Edsel - Problem solved!!
(09-16-2014 12:33 PM)Dieter Wrote:  
(09-16-2014 01:20 AM)Gerson W. Barbosa Wrote:  You can try
RCLx F
RCL F
ABS
/

Instead of

RCLF
SGN
x

starting at step B0014, assuming F is never zero.

If I understand correctly, the sequence

RCL F
SGN
x

shall be replaced by something that does not require a sign function and that also does not use more than one stack level. Your suggestion will do so, but the combination of a multiplication and a subsequent division may degrade accuracy, and, more important, it will not work for F = 0.

So how about this one?

RCL F
ABS
X≠0?
RCL/ F
x

Dieter

In order to address the case F=0, which seems to be a consequence of B=0, I had suggested later in the thread the insertion of x=0? x! between ABS and /. Your suggestion is one step shorter and more efficient, so I would go for it. That's what I was able to come up with while watching an interview on TV. When memory is not an issue (sometimes it is on the 32S-II), I'll definitely use the SGN subroutine replacement, since no stack analysis is necessary.

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
09-17-2014, 01:23 AM
Post: #22
RE: Cadillac Quadratic Solver behaving like an Edsel - Problem solved!!
You don't really need the SIGN function. You can exchange the SQRT with register F and use register arithmetic (lines B12 - B17). But then you don't push F onto the stack. That's why we need to recall F later in line E07.

Code:
B01 LBL B
B02 FIX 9
B03 RCL H
B04 x^2
B05 STO(i)
B06 RCL D
B07 RCL I
B08 SUM -
B09 SUM xy
B10 x<0?
B11 GTO E
B12 SQRT
B13 x<> F
B14 x<0?
B15 RCL- F
B16 x>=0?
B17 RCL+ F
B18 STO J
B19 x<>y
B20 /
B21 RCL J
B22 x#0?
B23 GTO F
B24 CLx
B25 STOP
F01 LBL F
F02 RCL G
F03 x<>y
F04 /
F05 STOP
E01 LBL E
E02 SF 0
E03 +/-
E04 SQRT
E05 RCL D
E06 /
E07 RCL F
E08 R UP
E09 /
E10 STOP

Currently I have troubles with my HP-32II and therefore can't test these changes. But as an inspiration you can have a look at the original code for the HP-15C (lines 057-061 of program B).

HTH
Thomas

PS: Sorry for being late to the party.
Find all posts by this user
Quote this message in a reply
09-23-2014, 12:15 AM (This post was last modified: 02-17-2015 08:28 PM by Thomas Klemm.)
Post: #23
RE: Cadillac Quadratic Solver behaving like an Edsel - Problem solved!!
The suggestions in my previous post are flawed. Meanwhile I could fix it. This program works fine with my HP-32SII:
Code:
H01 LBL H
H02 INPUT A
H03 STO D
H04 INPUT B
H05 -2
H06 ÷
H07 STO F
H08 STO H
H09 INPUT C
H10 STO G
H11 STO I
H12 CF 0
H13 SCI 2
A01 LBL A
A02 CLΣ
A03 28
A04 STO i
A05 4
A06 STO(i)
A07 33
A08 STO i
A09 RCL H
A10 STO(i)
A11 RCL÷ D
A12 RND
A13 RCL D
A14 Σ-
A15 RCL I
A16 Σxy
A17 x<>y
A18 STO(i)
A19 R↓
A20 x<>y
A21 RCL H
A22 Σ-
A23 R↓
A24 Σ-
A25 Σxy
A26 ABS
A27 RCL I
A28 ABS
A29 x≤y?
A30 GTO B
A31 ENTER
A32 R↑
A33 STO H
A34 Σxy
A35 STO I
A36 ABS
A37 1E24
A38 ×
A39 RCL G
A40 ABS
A41 x≤y?
A42 GTO A
B01 LBL B
B02 FIX 9
B03 RCL H
B04 x²
B05 STO(i)
B06 RCL D
B07 RCL I
B08 Σ-
B09 Σxy
B10 x<0?
B11 GTO E
B12 SQRT
B13 x<> F
B14 x<0?
B15 RCL- F
B16 x≥0?
B17 RCL+ F
B18 x<> G
B19 x≠0?
B20 RCL÷ G
B21 RCL G
B22 RCL÷ D
B23 STOP
E01 LBL E
E02 SF 0
E03 +/-
E04 SQRT
E05 RCL÷ D
E06 x<>y
E07 RCL F
E08 x<>y
E09 ÷
E10 STOP

This post made me try to understand the algorithm that is used. I posted my findings in an article.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
02-17-2015, 07:36 PM
Post: #24
Cadillac Quadratic Solver for HP 35s
Dear Members, I have a question about Palmer Hanson program for Hp 35s. I don´t know how to insert steps Q038, 040 and 065= SUM - , from the program listing of Cadillac Quadratic Solver.

Can you please assit me about the order of the keys for that instruction
Thank you in advance, Pedro
Find all posts by this user
Quote this message in a reply
02-17-2015, 08:26 PM (This post was last modified: 02-17-2015 08:30 PM by Dieter.)
Post: #25
RE: Cadillac Quadratic Solver behaving like an Edsel - Problem solved!!
(02-17-2015 07:36 PM)PedroLeiva Wrote:  Can you please assit me about the order of the keys for that instruction

I see this is your first post here, so welcome to the forum. ;-)

In the listing, "Sum" refers to the greek Sigma, so "Sum–" means Σ– (yellow-shifted function of the Σ+ key in the bottom key row). Equally, "Sum xy" means Σxy which is accessed via the SUMS menu (blue-shifted Minus-key).

Dieter
Find all posts by this user
Quote this message in a reply
02-17-2015, 08:34 PM
Post: #26
RE: Cadillac Quadratic Solver behaving like an Edsel - Problem solved!!
(02-17-2015 08:26 PM)Dieter Wrote:  
(02-17-2015 07:36 PM)PedroLeiva Wrote:  Can you please assit me about the order of the keys for that instruction

I see this is your first post here, so welcome to the forum. ;-)

In the listing, "Sum" refers to the greek Sigma, so "Sum–" means Σ– (yellow-shifted function of the Σ+ key in the bottom key row). Equally, "Sum xy" means Σxy which is accessed via the SUMS menu (blue-shifted Minus-key).

Dieter

How I did not realize it! Thank you very much for your assistance. Pedro
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)