Palindromic Expression for Phi: Difference between revisions

Jump to navigation Jump to search
m
Text replacement - "<source" to "<syntaxhighlight"
m (Text replacement - "</source>" to "</syntaxhighlight>")
m (Text replacement - "<source" to "<syntaxhighlight")
 
Line 1: Line 1:
Some find that APL expressions can have a poetic beauty. Phil Last submitted the following variable-free recursive [[dfn]] to compute the limit of a converging function, equivalent to the derived monadic operator <source lang=apl inline>⍣≡</syntaxhighlight>:<ref>Dyalog. [https://dfns.dyalog.com/n_limit.htm Function power limit (fixpoint)]. [[Dfns workspace]]. 2019-02-07.</ref>
Some find that APL expressions can have a poetic beauty. Phil Last submitted the following variable-free recursive [[dfn]] to compute the limit of a converging function, equivalent to the derived monadic operator <syntaxhighlight lang=apl inline>⍣≡</syntaxhighlight>:<ref>Dyalog. [https://dfns.dyalog.com/n_limit.htm Function power limit (fixpoint)]. [[Dfns workspace]]. 2019-02-07.</ref>
<source lang=apl>
<syntaxhighlight lang=apl>
limit←{            ⍝ Function power limit (fixpoint).
limit←{            ⍝ Function power limit (fixpoint).
     ⍵ ⍺⍺{          ⍝ 'old' value:
     ⍵ ⍺⍺{          ⍝ 'old' value:
Line 9: Line 9:
</syntaxhighlight>
</syntaxhighlight>
[[John Scholes]] noted that it was close to being a [[wikipedia:palindrome|palindrome]], so he inlined it and he amended it with dummy code to make its invocation for finding the [[wikipedia:golden ratio|golden ratio]] even closer to palindromic:
[[John Scholes]] noted that it was close to being a [[wikipedia:palindrome|palindrome]], so he inlined it and he amended it with dummy code to make its invocation for finding the [[wikipedia:golden ratio|golden ratio]] even closer to palindromic:
<source lang=apl>
<syntaxhighlight lang=apl>
       1{1+÷⍵}{⍵ ⍺⍺{⍺≡⍵:⍵ ⋄ ⍵ ⍺⍺ ∇∇ ⍺⍺ ⍵ ⋄ ⍵:⍵≡⍺}⍺⍺ ⍵}{⍵÷+1}1
       1{1+÷⍵}{⍵ ⍺⍺{⍺≡⍵:⍵ ⋄ ⍵ ⍺⍺ ∇∇ ⍺⍺ ⍵ ⋄ ⍵:⍵≡⍺}⍺⍺ ⍵}{⍵÷+1}1
1.618033989
1.618033989

Navigation menu