(cos=: 2&o.) ^: (i.6) b=: 1 1 0.540302 0.857553 0.65429 0.79348 0.701369 ]y=: cos^:_ b 0.739085 y=cos y 1範例 cos^:_ 顯示,只有應用程序收斂,無窮反覆才有意義。
f=: %: - 4: 範例函數
root=: 3 : 0
m=. +/ % #
while. ~:/y.
do.
if. ~:/ * f ({.,m) y.
do. y.=. ({.,m) y.
else. y.=. ({:,m) y.
end.
end. m y.
)
b=: 1 32
root b
16
f b,root b
_3 1.65685 1.77636e_15
練習
| 23.1 | Use 函數 root to find roots of
各類函數, such as f=: 6&-@! |
| 23.2 | Experiment with 函數 fn=: +/\ (which produces figurate numbers when applied repeatedly to i.n),and expla在behaviour of 函數 fn^:(?@3:) |