Post Reply 
wp34s mini-challenge
09-23-2020, 12:59 AM
Post: #1
wp34s mini-challenge
√(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!
Find all posts by this user
Quote this message in a reply
09-23-2020, 09:14 PM (This post was last modified: 09-23-2020 09:26 PM by Namir.)
Post: #2
RE: wp34s mini-challenge
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
Find all posts by this user
Quote this message in a reply
09-23-2020, 11:41 PM (This post was last modified: 09-23-2020 11:51 PM by Gerson W. Barbosa.)
Post: #3
RE: wp34s mini-challenge
(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
Find all posts by this user
Quote this message in a reply
09-24-2020, 03:05 AM
Post: #4
RE: wp34s mini-challenge
(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

:-(
Find all posts by this user
Quote this message in a reply
09-24-2020, 10:31 AM
Post: #5
RE: wp34s mini-challenge
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:√
Find all posts by this user
Quote this message in a reply
09-24-2020, 07:49 PM
Post: #6
RE: wp34s mini-challenge
Here is the corrected version based on your comments and hint:

Code:
Phi    
INC X   
INC X    
STO Y    
EEX 
5    
+        
/                
5                
*                
+                
SQRT
Find all posts by this user
Quote this message in a reply
09-24-2020, 08:00 PM
Post: #7
RE: wp34s mini-challenge
(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:√
Find all posts by this user
Quote this message in a reply
09-24-2020, 08:18 PM
Post: #8
RE: wp34s mini-challenge
Here is the corrected version based on your comments and hint:

Code:
Phi    
INC X   
INC X    
STO Y    
EEX 
5    
+        
/                
5                
*                
+                
SQRT
Find all posts by this user
Quote this message in a reply
09-24-2020, 09:17 PM (This post was last modified: 09-24-2020 09:18 PM by Gerson W. Barbosa.)
Post: #9
RE: wp34s mini-challenge
(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.
Find all posts by this user
Quote this message in a reply
09-24-2020, 09:29 PM
Post: #10
RE: wp34s mini-challenge
(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.
Find all posts by this user
Quote this message in a reply
09-27-2020, 07:07 PM
Post: #11
RE: wp34s mini-challenge
It can be done in 10 steps. Any takers?
Find all posts by this user
Quote this message in a reply
10-02-2020, 02:47 PM
Post: #12
RE: wp34s mini-challenge
(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:√
Find all posts by this user
Quote this message in a reply
Post Reply 




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