HP Forums
HP-41 RPN program solution sought - test problem - 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: HP-41 RPN program solution sought - test problem (/thread-17631.html)



HP-41 RPN program solution sought - test problem - Gene - 10-27-2021 08:03 PM

What's the best (shortest meant here) way you can devise to program a solution to this problem in HP-41 RPN?


Enter an angle in degrees mode and press A to return the answer.

So start with LBL A and evaluate:

Equation T = ...

What can you come up with ?

Gene


RE: HP-41 RPN program solution sought - test problem - Peet - 10-27-2021 09:05 PM

I hope this is not completely stupid, but I'll try (without testing):

lbl A
xeq deg
sto 01
sqrt
1
+
sto 02
sin
2,5
*
sto 03
pi
/
rcl 02
cos
rcl 01
sin
/
+
rcl 03
/


RE: HP-41 RPN program solution sought - test problem - Gerson W. Barbosa - 10-27-2021 09:19 PM

Assuming angle mode is DEG:

Code:

 01 LBL A
 02 SIN
 03 LASTX
 04 SQRT
 05 1
 06 +
 07 TAN
 08 *
 09 5
 10 *
 11 1/X
 12 ST+ X
 13 PI
 14 1/X
 15 +
 16 END



RE: HP-41 RPN program solution sought - test problem - Werner - 10-28-2021 06:33 AM

I can shave off one byte:

Code:
 01 LBL A
 02 SIN
 03 LASTX
 04 SQRT
 05 1
 06 +
 07 TAN
 08 *
 09 .4
 10 X<>Y
 11 /
 12 PI
 13 1/X
 14 +
 15 END

Cheers, Werner


RE: HP-41 RPN program solution sought - test problem - floppy - 10-28-2021 08:39 AM

(10-27-2021 08:03 PM)Gene Wrote:  What's the best (shortest meant here) way you can devise to program a solution to this problem in HP-41 RPN?


Enter an angle in degrees mode and press A to return the answer.

So start with LBL A and evaluate:

Equation T = ...

What can you come up with ?

Gene
First I draw it in my preferred graphical calculator https://www.desmos.com/calculator/pop31xijnj?lang=de
And in the time I was drawing (took 5min), smarter ones has give to you some solutions.
I was not quick enough ;-)


RE: HP-41 RPN program solution sought - test problem - Gene - 10-29-2021 05:27 PM

Great job Werner!

I was curious and comparing it to an algebraic (AOS) version. That was 39 steps/bytes.


RE: HP-41 RPN program solution sought - test problem - C.Ret - 10-31-2021 12:58 PM

(10-28-2021 08:39 AM)floppy Wrote:  First I draw it in my preferred graphical calculator https://www.desmos.com/calculator/pop31xijnj?lang=de

Nice plotter, except that it is missing the important fact that x have to be in degrees (not radians nor Bogenmaßen).

(10-29-2021 05:27 PM)Gene Wrote:  I was curious and comparing it to an algebraic (AOS) version. That was 39 steps/bytes.

Let's have a try.

Assuming that the complicated function can be simplify as W.Barbosa and Werner have done:

\( f(x)=\frac{\frac{2.5\times sin(\sqrt{x}+1)}{\pi}+\frac{cos(\sqrt{x}+1)}{sin(x)}}{2.5\times sin(\sqrt{x}+1)}=\frac{1}{\pi}+\frac{.4}{sin(x)\times tan(\sqrt{x}+1)} \)

And using a blue TI-57 LCD using certified AOS technology:

STO0 .4 ÷ ( RCL0 sin × ( 1 + RCL0 √x ) tan ) + ∏ 1/x = R/S RST

The last too steps are optional but useful in program; so this function can be recorded using 22 steps (or bytes) in LRN mode.


RE: HP-41 RPN program solution sought - test problem - Gerson W. Barbosa - 10-31-2021 05:43 PM

(10-31-2021 12:58 PM)C.Ret Wrote:  And using a blue TI-57 LCD using certified AOS technology:

STO0 .4 ÷ ( RCL0 sin × ( 1 + RCL0 √x ) tan ) + ∏ 1/x = R/S RST

The last too steps are optional but useful in program; so this function can be recorded using 22 steps (or bytes) in LRN mode.


Perhaps you can save one byte by eliminating the parentheses:

STO0 √x + 1 = tan × RCL0 sin × 2.5 = 1/x + ∏ 1/x = R/S RST


RE: HP-41 RPN program solution sought - test problem - C.Ret - 10-31-2021 08:54 PM

(10-31-2021 05:43 PM)Gerson W. Barbosa Wrote:  Perhaps you can save one byte by eliminating the parentheses:

Good suggestion :
STO0 √x + 1 = tan × RCL0 sin ÷ .4 = 1/x + ∏ 1/x = R/S RST (one Werner's step spare here)

STO0 √x + 1 = tan 1/x EXC0 sin STO÷0 .4 STO×0 ∏ 1/x STO+0 RCL0 R/S RST (two more steps spare , but, is this still AOS logic ?)


RE: HP-41 RPN program solution sought - test problem - Gene - 10-31-2021 09:17 PM

If it can be keyed on a TI-57 or TI-58C, then we will call it AOS. :-)

Gene