u .. v « (u + u&v) % 2:
u .: v « (u - u&v) % 2:
|
在most commonly used case, v is arithmetic negation,
and f=: u .. v is refore f=: (u + u&-) % 2: ;
亦即,one-half sum of u y and u -y .
resulting 函數 is refore even 在sense
that f y « f -y for any y;
its graph is reflected 在vertical axis. Similarly, u .: -
is odd(f y « -f-y),and its
graph is reflected 在origin. Less commonly, v is
矩陣transpose(|:),and may
be any 單邊函數.
y=: _2 _1 0 1 2
1 2 3 4 5 & p. y 多項式 with odd與even terms
57 3 1 15 129
1 2 3 4 5 & p. .. - y Even part of 多項式
93 9 1 9 93
1 0 3 0 5 & p. y 多項式 with even terms only
93 9 1 9 93
E=: .. - Even 副詞
O=: .: - Odd 副詞
d=: 5j2&":@,.&.> Display as columns with two digits
d (5&o. ; ^O ; 6&o. ; ^E ; ^ ; (^E + ^O) ; 2&o. ; ^@j.E) y
+-----+-----+-----+-----+-----+-----+-----+-----+
|_3.63|_3.63| 3.76| 3.76| 0.14| 0.14|_0.42|_0.42|
|_1.18|_1.18| 1.54| 1.54| 0.37| 0.37| 0.54| 0.54|
| 0.00| 0.00| 1.00| 1.00| 1.00| 1.00| 1.00| 1.00|
| 1.18| 1.18| 1.54| 1.54| 2.72| 2.72| 0.54| 0.54|
| 3.63| 3.63| 3.76| 3.76| 7.39| 7.39|_0.42|_0.42|
+-----+-----+-----+-----+-----+-----+-----+-----+
m=: ?. 4 4 $ 9
(] ; (] .. |:) ; (] .: |:)) m
+-------+---------------+------------------+
|1 6 4 4| 1 3.5 6 2| 0 2.5 _2 2|
|1 0 6 6|3.5 0 4.5 3|_2.5 0 1.5 3|
|8 3 4 7| 6 4.5 4 5.5| 2 _1.5 0 1.5|
|0 0 4 6| 2 3 5.5 6| _2 _3 _1.5 0|
+-------+---------------+------------------+
下個 前個
字彙
索引
主選單