18.1 |
Experiment with and display the functions roots=: 3 : script
and 13 : script (which are equivalent).
|
18.2 |
See the discussion of control structures in the dictionary,
and use them in defining further verbs.
|
18.3 |
Experiment with expressions such as ! d b=: i.7 ,
after defining the adverb d :
d=: 1 : 0
+:@x.
)
|
18.4 |
Using the program pol from Exercise 14.2,
perform the following experiments and comment on their results:
g=: 11 7 5 3 2 & pol
e=: 11 0 5 0 2 & pol
o=: 0 7 0 3 0 & pol
(g = e + o) b=: i.6
(e = e@-) b
(o = -@o@-) b
Answer: The function g is the sum of the functions e
and o . Moreover, e is an even function
(whose graph is reflected in the vertical axis), and o
is an odd function (reflected in the origin).
|
18.5 |
Review Section H of Part II and
use scripts to make further explicit definitions.
|
18.6 |
Enter the following explicit definition
of the adverb even and perform the
suggested experiments with it, using the functions defined
in the preceding exercise:
even=: 2 : 0
-:@(x.f. + x.f.@-)
)
ge=: g even
(e = ge) b
(e = e even) b
|
18.7 |
Define an adverb odd and use it in the
following experiments:
exp=: ^
sinh=: 5&o.
cosh=: 6&o.
(sinh = exp odd) b
(sinh = exp .: -) b The primitive odd adverb .: -
(cosh = exp even) b
(exp = exp even + exp odd) b
|
18.8 |
The following experiments involve complex numbers,
and should perhaps be ignored by anyone unfamiliar with them:
sin=: 1&o.
cos=: 2&o.
(cos = ^@j. even) b
(j.@sin = ^@j. odd) b
|