Ratio Equation Program
09-08-2017, 11:04 AM (This post was last modified: 09-08-2017 11:44 AM by Gamo.)
Post: #1
 Gamo Senior Member Posts: 518 Joined: Dec 2016
Ratio Equation Program

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
09-08-2017, 11:40 AM
Post: #2
 Didier Lachieze Senior Member Posts: 1,143 Joined: Dec 2013
RE: Ratio Equation Program
(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).
09-08-2017, 11:54 AM
Post: #3
 Gamo Senior Member Posts: 518 Joined: Dec 2016
RE: Ratio Equation Program
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
09-08-2017, 04:09 PM
Post: #4
 Didier Lachieze Senior Member Posts: 1,143 Joined: Dec 2013
RE: Ratio Equation Program
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
09-08-2017, 11:32 PM (This post was last modified: 09-08-2017 11:32 PM by Joe Horn.)
Post: #5
 Joe Horn Senior Member Posts: 1,478 Joined: Dec 2013
RE: Ratio Equation Program
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.

<0|ɸ|0>
-Joe-
 « Next Oldest | Next Newest »

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