The phrase */x-roots[x=.5[roots=.3 7 4 8 is a polynomial in terms of its roots (with value 12). The factors, the factors with one removed, and the negation of their products (the derivative of the polynomial with respect to each of the roots) are given by: (x-roots);(1 <\.x - roots);(- 1 */\. x - roots) õıııııııııÃıııııııııııııııııııııııııııııııÃııııııııııÀ ş2 _2 1 _3şõıııııııÃııııııÃıııııııÃııııııÀş_6 6 _12 4ş ş şş_2 1 _3ş2 1 _3ş2 _2 _3ş2 _2 1şş ş ş şÁıııııııÂııııııÂıııııııÂııııııãş ş ÁıııııııııÂıııııııııııııııııııııııııııııııÂııııııııııã (BM=. (box=. <"2)@minors=. 1&(|:\.)"2^:2) i. 3 3 õıııÃıııÃıııÀ ş4 5ş3 5ş3 4ş ş7 8ş6 8ş6 7ş ÈıııÊıııÊııı³ ş1 2ş0 2ş0 1ş ş7 8ş6 8ş6 7ş ÈıııÊıııÊııı³ ş1 2ş0 2ş0 1ş ş4 5ş3 5ş3 4ş ÁıııÂıııÂıııã Grade Down \: _ _ _ Sort (Down) \: grades its argument, yielding a permutation vector; (\:y){y sorts y in descending order. For example: ]g=.\:y=.3 1 4 2 1 3 3 2 0 5 6 3 1 4 g{y4 3 3 3 2 1 1 x\:y is (\:y){x; i.e., x is sorted to an order specified by y. In particular, y\:yá(or \:~y) sorts y. For example: \:~"1 'dozen',:'disk'zonedskid Elements of \:y that select equal elements of y are in ascending order. If y is a table, \:y grades the base value of the rows, using a base larger than twice the magnitude of any of the elements. Higher ranks are treated as ,.y (as if the items were each ravelled). If y is literal, \:y grades according to the collating sequence specified by the alphabet a. ; another collating sequence cs can be imposed by grading csái.áy. For example: ]n=. 3 1 4 1 6,2 7 1 8 3,:6 1 8 0 3 3 1 4 1 6 2 7 1 8 3 6 1 8 0 3 \: n 2 0 1 \:~ t=. >;:'when eras die, their legacies' when their legacies eras die , Same [ ] _ _ _ Left, Right The monads [ and ] are each identity functions; each yields its argument. x [ y (left bracket) yields the left argument x, and x ] y yields the right argument y. For example: n=. i. 2 3 a=. 'abcde' ]n 0 1 2 3 4 5 [a abcde n[a 0 1 2 3 4 5 n]a abcde ([\ ; ]\ ; [\. ; ]\.) 'ABCDEF' õııııııÃııııııÃııııııÃııııııÀ şA şA şABCDEFşABCDEFş şAB şAB şBCDEF şBCDEF ş şABC şABC şCDEF şCDEF ş şABCD şABCD şDEF şDEF ş şABCDE şABCDE şEF şEF ş şABCDEFşABCDEFşF şF ş ÁııııııÂııııııÂııııııÂııııııã See the corresponding conjunctions [. and ]. (Lev and Dex) LEV, DEX [. ]. [. is a conjunction that yields the left argument and ]. is a conjunction that yields its right argument. For example: sqrt=. %: [. sqr=. *: sqrt 1 2 3 1 1.41421 1.73205 sqr 1 2 3 1 4 9 Cap [: _ _ _ Cap [: caps a left branch of a fork, as described in Section II F. For example, the function p=. [: +/ + * - applies the monad +/ to the result of the fork + * - . Caps make it possible to define a wider range of functions as unbroken trains. For example, the maximum divided by the product of the sum and difference would be defined by a single train, whereas (without the use of the cap) the definition of the maximum divided by the (monad) floor of the product of the sum and difference would require the use of trains interrupted by the monad. Thus: f=. >. % + * - g=. >. % <. @ (+ * -) 2.5 f 4 _0.410256 2.5 g 4 _0.4 The cap makes possible the use of an unbroken train as follows: h=. >. % [: <. + * - 2.5 h 4 _0.4 Since the domain of the cap is empty, it can be used (with :) to define a function whose monadic or dyadic case invokes a domain error. For example: abs=. | : [: res=. [: : | abs _4 0 5 4 0 5 3 res _4 0 5 2 0 2 3 abs _4 0 5 |domain error | 3 abs _4 0 5 Catalogue { 1 0 _ From {y forms a catalogue from the atoms of its argument, its shape being the chain of the shapes of the opened items of y. The common shape of the boxed results is $y. For example: { 'ht';'ao';'gtw'õıııÃıııÃıııÀşhagşhatşhawşÈıııÊıııÊııı³şhogşhotşhowşÁıııÂıııÂıııãõıııÃıııÃıııÀştagştatştawşÈıııÊıııÊııı³ştogştotştowşÁıııÂıııÂıııã If x is an integer in the range from -#y to <:#y, then x{y selects item (#y)|x from y. Thus: 2 0 _1 _3 { 'abcdefg'cage 1{t=.3 4$'abcdefghijkl'efghMore generally, >x ma y be a list whose successive elements are (possibly) boxed arrays that specify selection along successive axes of y. Finally, if any r=.>j{>x used in the selection is itself boxed, selection is made by the indices along that axis that do not occur in >r.Note that the result in the very last dyadic example is all except the last item (indexed by _1): t;(1{t);(1{"1 t);(2 0{t);((<2 0){t);((<2 0;1 3){t) õııııÃııııÃıııÃııııÃıÃııÀ şabcdşefghşbfjşijklşişjlş şefghş ş şabcdş şbdş şijklş ş ş ş ş ş ÁııııÂııııÂıııÂııııÂıÂııã (_1{m);(_1{"2 m);(_1{"1 m);(<<<_1){m=.i.2 3 4 õıııııııııııÃıııııııııııÃııııııııÃıııııııııÀ ş12 13 14 15ş 8 9 10 11ş 3 7 11ş0 1 2 3ş ş16 17 18 19ş20 21 22 23ş15 19 23ş4 5 6 7ş ş20 21 22 23ş ş ş8 9 10 11ş ÁıııııııııııÂıııııııııııÂııııııııÂıııııııııã CP=. {@(,&<) is called the Cartesian product. Thus: 0 1 CP 0 1 õıııÃıııÀ ş0 0ş0 1ş ÈıııÊııı³ ş1 0ş1 1ş ÁıııÂıııã Head {. _ 1 _ Take {. selects the leading item of its argument. For example: a=. i. 3 2 3 a;({.a);({."2 a);({."1 a)õııııııııÃıııııÃııııııııÃıııııÀş 0 1 2ş0 1 2ş 0 1 2ş 0 3şş 3 4 5ş3 4 5ş 6 7 8ş 6 9şş ş ş12 13 14ş12 15şş 6 7 8ş ş ş şş 9 10 11ş ş ş şş ş ş ş şş12 13 14ş ş ş şş15 16 17ş ş ş şÁııııııııÂıııııÂııııııııÂıııııã ]b=. ;/aõıııııÃıııııııÃııııııııÀş0 1 2ş6 7 8ş12 13 14şş3 4 5ş9 10 11ş15 16 17şÁııııı ıııııııÂııııııııã {.&> b 0 1 2 6 7 812 13 14 If x is an atom, x{.y takes from y an interval of |x items; beginning at the front if x is positive, ending at the tail if it is negative.In an overtake (in which the number to be taken exceeds the number of items), extra items consist of fills; zeros if y is numeric, j: if it is boxed, and spaces otherwise. The fill f is also specified by fit, as in {. !. f . Finally, if $y is 0,s, then the fill items are s$0 . In general, if y is not an atom, x may be a list of length not more than $$y, and if y is an atom, it is replaced by ((#x)$1)$y. Element k produces (k{x){."(($$y)-k) y. The following examples illustrate the use of the dyad take: y=. i. 3 4 y;(2{.y);(5{.y);(_5{.y);(_6{.'abcd');(2 _3{.y) õıııııııııÃıııııııÃıııııııııÃıııııııııÃııııııÃıııııÀ ş0 1 2 3ş0 1 2 3ş0 1 2 3ş0 0 0 0ş abcdş1 2 3ş ş4 5 6 7ş4 5 6 7ş4 5 6 7ş0 0 0 0ş ş5 6 7ş ş8 9 10 11ş ş8 9 10 11ş0 1 2 3ş ş ş ş ş ş0 0 0 0ş4 5 6 7ş ş ş ş ş ş0 0 0 0ş8 9 10 11ş ş ş ÁıııııııııÂıııııııÂıııııııııÂıııııııııÂııııııÂıııııã 6{.'ab';'cde';'fghi' õııÃıııÃııııÃÃÃÀ şabşcdeşfghişşşş ÁııÂıııÂııııÂÂÂã Tail {: _ {: selects the last item of its argument. For example: ]y=. a.{~ (a.i.'A') + i.4 5 ABCDE FGHIJ KLMNO PQRST f=. }: ; {: f y õıııııÃıııııÀ şABCDEşPQRSTş şFGHIJş ş şKLMNOş ş ÁıııııÂıııııã g=. }: ,. @; {: g y õıııııÀ şABCDEş şFGHIJş şKLMNOş Èııııı³ şPQRSTş Áıııııã h=. {. ,. @; }. h y õıııııÀ şABCDEş Èııııı³ şFGHIJş şKLMNOş şPQRSTş Áıııııã ITEM AMEND m } _ _ _ AMEND If m is numeric, and z=. m} y, then $z equals $m, which equals the shape of an item of y, that is, $"_1 y . If i is an atom of m, the corresponding atom of z is the corresponding atom of the item i{y : y=.a.{~(a.i.'A')+i.4 5 m=. 4| i. 5 y ; m ; m}yõıııııÃıııııııııÃıııııÀşABCDEş0 1 2 3 0şAGMSEşşFGHIJş ş şşKLMNOş ş şşPQRSTş ş şÁıııııÂıııııııııÂıııııã If m is not a gerund, x m} y is formed by replacing by x those parts of y selected by m&{. Thus: y ;'%*'(1 3;2 _1)} yõıııııÃıııııÀşABCDEşABCDEşşFGHIJşFGH%JşşKLMNOşKLMN*şşPQRSTşPQRSTşÁıııııÂıııııã$x must be a suffix of $m{y, and x has the same effect as ($m{y)$,x. Thus: y;'think' 1 2} yõıııııÃıııııÀşABCDEşABCDEşşFGHIJşthinkşşKLMNOşthinkşşPQRSTşPQRSTşÁıııııÂıııııã If m is a gerund, one of its elements determines the index argument to the adverb }, and the others modify the arguments x and y: x (v0`v1`v2)} y is (x v0 y) (x v1 y)} (x v2 y) (v0`v1`v2)} y is ( v1 y)} ( v2 y) ( v1`v2)} y is ( v1 y)} ( v2 y) For example, the following functions E1, E2, and E3 interchange two rows of a matrix, multiply a row by a constant, and add a multiple of one row to another: E1=. <@] C. [ [. E2=. f`g`[} [. E3=. F`g`[} f=. {:@]*{.@] { [ [. F=. [:+/(1:,{:@])*(}:@] { [) g=. {.@] M=. i. 4 4 M;(M E1 1 3);(M E2 1 10);(M E3 1 3 10) õıııııııııııÃıııııııııııÃıııııııııııÃıııııııııııııııÀ ş 0 1 2 3ş 0 1 2 3ş 0 1 2 3ş 0 1 2 3ş ş 4 5 6 7ş12 13 14 15ş40 50 60 70ş124 135 146 157ş ş 8 9 10 11ş 8 9 10 11ş 8 9 10 11ş 8 9 10 11ş ş12 13 14 15ş 4 5 6 7ş12 13 14 15ş 12 13 14 15ş ÁıııııııııııÂıııııııııııÂıııııııııııÂıııııııııııııııã ITEM AMEND u } _ _ _ AMEND u } is defined in terms of the noun case m }, the verb u applying to the argument or arguments to provide the numeric indices required by it. For example: x=. 100 + i. 2 4 u=. (*/@$@]) | (5: * i.@$@[) y=. i. 3 2 4 x ; y ; (x u y) ; (x u} y) õıııııııııııııııÃıııııııııııÃııııııııııÃıııııııııııııııÀ ş100 101 102 103ş 0 1 2 3ş 0 5 10 15ş100 105 2 3ş ş104 105 106 107ş 4 5 6 7ş20 1 6 11ş 4 101 106 7ş ş ş ş ş ş ş ş 8 9 10 11ş ş 8 9 102 107ş ş ş12 13 14 15ş ş 12 13 14 103ş ş ş ş ş ş ş ş16 17 18 19ş ş 16 17 18 19ş ş ş20 21 22 23ş ş104 21 22 23ş ÁıııııııııııııııÂıııııııııııÂııııııııııÂıııııııııııııııã The positions selected by x u} y may be made to depend on either or both of the arguments x and y, and related adverbs can be defined for convenient use in common cases. For example: A=. @(i.@$@]) u=. (<0 1)&|: x=. 'DIAG' [y=. a. {~ (a. i. 'a') + i. 4 5 x;y;(x u A y);(x u A} y) õııııÃıııııÃıııııııııÃıııııÀ şDIAGşabcdeş0 6 12 18şDbcdeş ş şfghijş şfIhijş ş şklmnoş şklAnoş ş şpqrstş şpqrGtş ÁııııÂıııııÂıııııııııÂıııııã Also see the case m } for the use of gerunds. .Behead }. _ 1 _ Drop }. drops the leading item of its ar-gument. x }. y drops (at most) |x items from y , dropping from the front if x is positive, and from the tail if it is negative.More generally, x may be a list of not more than r=. $$y elements; the effect of element k is (k{x)á}."(r-k) y.If y is atomic, the result is (0=x)$y. ]y=. a. {~ (a. i. 'A') + i. 4 5 ABCDE FGHIJ KLMNO PQRST f=. }. ; {. f y õıııııÃıııııÀ şFGHIJşABCDEş şKLMNOş ş şPQRSTş ş ÁıııııÂıııııã g=. }. ,. @; {. g y õıııııÀ şFGHIJş şKLMNOş şPQRSTş Èııııı³ şABCDEş Áıııııã (2 }. y) ; (_2 }. y) ; (6 }. y) ; ($ 6 }. y) õıııııÃıııııÃıııııÃıııÀ şKLMNOşABCDEş ş0 5ş şPQRSTşFGHIJş ş ş ÁıııııÂıııııÂıııııÂıııã : Curtail }: _ }:y drops the last item of y, and is equivalent to _1 }. y . Thus: ]y=. a. {~ (a. i. 'A') + i. 4 5 ABCDE FGHIJ KLMNO PQRST f=. }: ; {: f y õıııııÃıııııÀ şABCDEşPQRSTş şFGHIJş ş şKLMNOş ş ÁıııııÂıııııã g=. }: ,. @; {: g y õıııııÀ şABCDEş şFGHIJş şKLMNOş Èııııı³ şPQRSTş Áıııııã h=. {. ,. @; }. h y õıııııÀ şABCDEş Èııııı³ şFGHIJş şKLMNOş şPQRSTş Áıııııã RANK m " n (see next topics) The verb m"n produces the constant result m for each cell to which it applies. The rank used is 3 $&.|. n . For example, if n=.2, the three ranks are 2 2 2, and if n=. 2 3, they are 3 2 3. Thus: v=. 2 3 5 7 m=. i. 2 3 m ; (m"0 v) ; (m"1 v); (m"1 m) õıııııÃıııııÃıııııÃıııııÀ ş0 1 2ş0 1 2ş0 1 2ş0 1 2ş ş3 4 5ş3 4 5ş3 4 5ş3 4 5ş ş ş ş ş ş ş ş0 1 2ş ş0 1 2ş ş ş3 4 5ş ş3 4 5ş ş ş ş ş ş ş ş0 1 2ş ş ş ş ş3 4 5ş ş ş ş ş ş ş ş ş ş0 1 2ş ş ş ş ş3 4 5ş ş ş ÁıııııÂıııııÂıııııÂıııııã v m" 1 2 m 0 1 2 3 4 5 The verbs _9: through 9: are constant verbs, equivalent to _9"_ through 9"_. For example: odds=. 1: + 2: * i. odds 5 1 3 5 7 9 RANK u " n (see adjacent topics) The verb u"n applies u to each cell as specified by the rank n. The full form of the rank used is 3 $&.|. n . For example, if n=.2, the three ranks are 2á2 2, and if n=.2á3, they are 3 2 3. The following examples show uses of the rank conjunction. (] ; , ; ,"2) y=. a. {~ (a.i.'A') + i. 2 3 4 õııııÃııııııııııııııııııııııııÃııııııııııııÀ şABCDşABCDEFGHIJKLMNOPQRSTUVWXşABCDEFGHIJKLş şEFGHş şMNOPQRSTUVWXş şIJKLş ş ş ş ş ş ş şMNOPş ş ş şQRSTş ş ş şUVWXş ş ş ÁııııÂııııııııııııııııııııııııÂııııııııııııã (<"0 ; <"1 ; <@<"2 ; <@<"3) y Boxing of ranks 0, 1, 2, 3 õıııııııııÃııııııııııııııııÃıııııııııııııııÃııııııÀ şõıÃıÃıÃıÀşõııııÃııııÃııııÀşõııııııÃııııııÀşõııııÀş şşAşBşCşDşşşABCDşEFGHşIJKLşşşõııııÀşõııııÀşşşABCDşş şÈıÊıÊıÊı³şÈııııÊııııÊıııı³şşşABCDşşşMNOPşşşşEFGHşş şşEşFşGşHşşşMNOPşQRSTşUVWXşşşşEFGHşşşQRSTşşşşIJKLşş şÈıÊıÊıÊı³şÁııııÂııııÂııııãşşşIJKLşşşUVWXşşşş şş şşIşJşKşLşş şşÁııııãşÁııııãşşşMNOPşş şÁıÂıÂıÂıãş şÁııııııÂııııııãşşQRSTşş ş ş ş şşUVWXşş şõıÃıÃıÃıÀş ş şÁııııãş şşMşNşOşPşş ş ş ş şÈıÊıÊıÊı³ş ş ş ş şşQşRşSşTşş ş ş ş şÈıÊıÊıÊı³ş ş ş ş şşUşVşWşXşş ş ş ş şÁıÂıÂıÂıãş ş ş ş ÁıııııııııÂııııııııııııııııÂıııııııııııııııÂııııııã ('*#' ,"0 1 ' abcde') ; (+/"2 i. 2 3 4) õıııııııÃıııııııııııÀ ş* abcdeş12 15 18 21ş ş# abcdeş48 51 54 57ş ÁıııııııÂıııııııııııã ASSIGN RANK m " v u " v mv lv rv (see previous) The verbs m"v and u"v are equivalent to m"r and u"r, where r is the list of ranks of v. The results may be examined by using the basic characteristics adverb b. to obtain ranks. For example: , b. 0 _ _ _ %. b. 0 2 _ 2 ravel=. , " %. ravel b. 0 2 _ 2