| u D: n mu mu | Secant Slope |
|
x u D: 1 y is the secant slope of the
function u through the points y and y+x .
The secant slope is generalized to the case x u D. n y
in the manner of the derivative D. .
The argument x may be a list, giving several slopes. In the general case, each item of x has the shape {. $$"r y, where r is the rank of u, therefore specifying the increment in each possible direction. An argument x of lower rank is extended in the usual manner. For example, x=: 1e_8 provides the same increment in each direction and, because of the small magnitude, yields an approximation to the derivative. |
log=: ^.
y=: 2 3 4
1 log D:1 y
0.405465 0.287682 0.223144
incr=: 1 0.1 0.01 1e_8
incr log D:1/y
0.405465 0.287682 0.223144
0.487902 0.327898 0.246926
0.498754 0.332779 0.249688
0.5 0.333333 0.25
log D.1 y
0.5 0.333333 0.25
%y
0.5 0.333333 0.25
f=: +/@:*:"1
g=: +/@:*:\"1
(f y) ; (1 f D:1 y) ; (1 0.1 1e_8 f D:1 y)
+--+-----+--------------+
|29|5 7 9| 5 0.61 8e_8|
| | | 50 6.1 8e_7|
| | |5e8 6.1e7 8|
+--+-----+--------------+
(g y) ; (1 g D:1 y)
+-------+-----+
|4 13 29|5 0 0|
| |5 7 0|
| |5 7 9|
+-------+-----+