HP Forums
Ratio Equation Program - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Ratio Equation Program (/thread-9012.html)



Ratio Equation Program - Gamo - 09-08-2017 11:04 AM

Found this program on HP Keys Note newsletter about Ratio Equation

A/B = C/D

With unknown quantity input as Zero and key in the values for A, B, C, and D

Program:
Quote:LBL A
X=0?
GTO1
Rv
X=0?
GTO2
Rv
X=0?
GTO1
Rv
LBL2
Rv
/
x
RTN
LBL1
Rv
x
X<>Y
/
RTN

Examples:
13/22 = X/44
13 ENTER 22 ENTER 0 ENTER 44 ---> LBL A = 26

X/22 = 26/44
0 ENTER 22 ENTER 26 ENTER 44 ---> LBL A = 13

Anyone have an idea on how to make this program shorter and
program to work for HP 12C since 12C don't have GTO for goto Label.

Thank You

Gamo


RE: Ratio Equation Program - Didier Lachieze - 09-08-2017 11:40 AM

(09-08-2017 11:04 AM)Gamo Wrote:  Anyone have an idea on how to make this program shorter and
program to work for HP 12C since 12C don't have GTO for goto Label.

Here is a working program on the 12C:
Code:
001 x=0?
002 GTO 14
003 Rv
004 X=0?
005 GTO 10
006 Rv
007 X=0?
008 GTO 14
009 Rv
010 Rv
011 /
012 x
013 GTO 00
014 Rv
015 x
016 X<>Y
017 /
018 GTO 00
Examples:
13/22 = X/44
13 ENTER 22 ENTER 0 ENTER 44 R/S ---> 26

X/22 = 26/44
0 ENTER 22 ENTER 26 ENTER 44 R/S ---> 13

Note: you should not have ENTER after the last number (D) as it would duplicate it in the Y register and you would loose the content of T (A).


RE: Ratio Equation Program - Gamo - 09-08-2017 11:54 AM

Thank You Didier Lachieze

I just edit the last [D] no need to ENTER

Your program work very good I try many difference ratio and it all work

Thanks

Gamo


RE: Ratio Equation Program - Didier Lachieze - 09-08-2017 04:09 PM

A shorter version (2 steps less):

Code:
001 x=0?
002 GTO 14
003 Rv
004 X=0?
005 GTO 10
006 Rv
007 X=0?
008 GTO 14
009 Rv
010 Rv
011 /
012 x
013 GTO 00
014 +
015 x<>y
016 GTO 06



RE: Ratio Equation Program - Joe Horn - 09-08-2017 11:32 PM

Here's an even shorter program that takes the 3 known values, entered on the stack in either clockwise or counterclockwise order, starting from the unknown but skipping it. For example, if this is the equation: \(\frac { 51 }{ 57 } =\frac { 68 }{ x } \), then you'd enter the values either of these two ways:

57 ENTER 51 ENTER 68 [clockwise]
68 ENTER 51 ENTER 57 [counterclockwise]

Then run this program:

Code:
001 ÷
002 ÷

Of course, cross-multiplying and then dividing also takes only two operations, but I like the circular input pattern of this RPN-friendly method.