HP Forums
wp34s mini-challenge - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: wp34s mini-challenge (/thread-15620.html)



wp34s mini-challenge - Gerson W. Barbosa - 09-23-2020 12:59 AM

√(5 + (ϕ^2 + 1) - (5×10^5)/((ϕ^2 + 1) + 10^5))

Evaluate the above expression on the wp34s striving to use the least number of steps. You might need to rewrite it in order to do it in less than 12 steps. Notice ϕ is a built-in constant.

Have fun!


RE: wp34s mini-challenge - Namir - 09-23-2020 09:14 PM

My 11 step solution is 41ish.

Let a = phi^2 + 1
let b = 10^5

The expression is sqrt(5 + a - 5b/(a + b)) ... upon simplification we get:

sqrt(5a/(a+b) + a)

The pseudo-code is based on the last equation.


Code:
Phi    
X^2    
INC X    
STO Y    
EEX 5    
+        
/                
5                
*                
+                
SQRT



RE: wp34s mini-challenge - Gerson W. Barbosa - 09-23-2020 11:41 PM

(09-23-2020 09:14 PM)Namir Wrote:  My 11 step solution is 41ish.

Namir, thank you very much for your interest! Unfortunately, however, EEX 5 requires two steps on the wp34s. Also, your solution doesn’t return the expected result unless I’m mistaken.

Tip: ϕ^2 + 1 = ϕ + 2


RE: wp34s mini-challenge - Namir - 09-24-2020 03:05 AM

(09-23-2020 11:41 PM)Gerson W. Barbosa Wrote:  
(09-23-2020 09:14 PM)Namir Wrote:  My 11 step solution is 41ish.

Namir, thank you very much for your interest! Unfortunately, however, EEX 5 requires two steps on the wp34s. Also, your solution doesn’t return the expected result unless I’m mistaken.

Tip: ϕ^2 + 1 = ϕ + 2

:-(


RE: wp34s mini-challenge - Gerson W. Barbosa - 09-24-2020 10:31 AM

Here is a 12-step solution using your simplification:

001:# Φ
002:x² 
003:INC X
004:RCL X
005:# 005
006:× 
007:RCL L
008:10ᵡ  
009:RCL+ Z
010:/
011:+
012:√



RE: wp34s mini-challenge - Namir - 09-24-2020 07:49 PM

Here is the corrected version based on your comments and hint:

Code:
Phi    
INC X   
INC X    
STO Y    
EEX 
5    
+        
/                
5                
*                
+                
SQRT



RE: wp34s mini-challenge - Didier Lachieze - 09-24-2020 08:00 PM

(09-24-2020 10:31 AM)Gerson W. Barbosa Wrote:  Here is a 12-step solution using your simplification:

Can be done in 11 steps :

001:#Φ
002:x² 
003:INC X
004:RCL X
005:# 005
006:STO× Y
007:10ᵡ  
008:RCL+ Z
009:/
010:+
011:√



RE: wp34s mini-challenge - Namir - 09-24-2020 08:18 PM

Here is the corrected version based on your comments and hint:

Code:
Phi    
INC X   
INC X    
STO Y    
EEX 
5    
+        
/                
5                
*                
+                
SQRT



RE: wp34s mini-challenge - Gerson W. Barbosa - 09-24-2020 09:17 PM

(09-24-2020 08:00 PM)Didier Lachieze Wrote:  
(09-24-2020 10:31 AM)Gerson W. Barbosa Wrote:  Here is a 12-step solution using your simplification:

Can be done in 11 steps :

001:#Φ
002:x² 
003:INC X
004:RCL X
005:# 005
006:STO× Y
007:10ᵡ  
008:RCL+ Z
009:/
010:+
011:√

And using ordinary wp34s instructions only. Formidable !

I had to rewrite the original expression and to resort to a somewhat obscure instruction:

√(7 + ϕ - 5/(1 + (ϕ + 2)/10^5))

001:# 007
002:# ϕ
003:+
004:# 005
005:# 002
006:RCL+ L
007:Pa→bar
008:INC X
009:/
010:-
011:√


→ 1.9021605831

That’s an approximation to a mathematical constant which is know to only nine significant digits, according to OEIS. Anyway, it agrees to Pascal Sebah’s result to 12 significant digits.


RE: wp34s mini-challenge - Gerson W. Barbosa - 09-24-2020 09:29 PM

(09-24-2020 08:18 PM)Namir Wrote:  Here is the corrected version based on your comments and hint:

Code:
Phi    
INC X   
INC X    
STO Y    
EEX 
5    
+        
/                
5                
*                
+                
SQRT

It looks like my hint was somewhat misleading, as your simplification does allow for an 11-step solution (see Didier’s solution above). Sorry!

Your fourth step should be replaced with FILL (fill up the stack with a constant) as you need an extra copy of Phi on the stack.


RE: wp34s mini-challenge - Gerson W. Barbosa - 09-27-2020 07:07 PM

It can be done in 10 steps. Any takers?


RE: wp34s mini-challenge - Gerson W. Barbosa - 10-02-2020 02:47 PM

(09-27-2020 07:07 PM)Gerson W. Barbosa Wrote:  It can be done in 10 steps. Any takers?

Ok, then I'll take it! (See solution #2, solution #1 and some variations thereof is what I already had).

1)

√{5||[5(ϕ + 2)/10^5] + ϕ + 2}

[ a||b = ab/(a + b) ]

001:# ϕ
002:# 002
003:+ 
004:# 005
005:SDR 005
006:RCL× Y
007:# 005
008:||
009:+
010:√



→ 1.902160583101354

2)

√{ϕ + 2 + [0.2 + 20000/(ϕ + 2)]⁻¹}

001:# 002
002:SDR 001
003:# ϕ
004:RCL+ L
005:# 200
006:%T
007:RCL+ Z
008:1/x
009:+
010:√