xpqz / learnapl

Introduction to Dyalog APL: https://xpqz.github.io/learnapl
Other
126 stars 11 forks source link

Issue on page /iteration.html (power/fixed point) #33

Open jonocarroll opened 10 months ago

jonocarroll commented 10 months ago

The example of finding a function's fixed point using ⍣= confused me

2÷⍨⍣=10 ⍝ Divide by 2 until we reach a fixed point

I understand that ⍣= will keep evaluating until the result no longer changes, but 10 (or any number) repeatedly divided by 2 only asymptotes to 0

      2÷⍨⍣1⊢10
5
      2÷⍨⍣2⊢10
2.5
      2÷⍨⍣10⊢10
0.009765625
      2÷⍨⍣100⊢10
7.888609052E¯30

so (I think) it only returns 0 because it loses precision.

I tried to find another more useful example. Application of the Collatz Conjecture always reaches 1, so that's perhaps not so interesting.

I suspect the canonical example of the Golden Ratio is more illuminating

      +∘÷⍣1⍨1
2
      +∘÷⍣2⍨1
1.5
      +∘÷⍣3⍨1
1.666666667
      +∘÷⍣=⍨1
1.618033989
xpqz commented 10 months ago

Fair. Once 19.0 is out, I hope to do a wash up review. Thanks for taking the time.