>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  Help  Dictionary

28. Secondaries

It is convenient to supplement the primitives or primaries provided in a language by secondaries whose names belong to an easily recognized class. The following examples use names beginning with a capital letter:

 Ad=: [ 0:}-@>:@\$@]{.] Append diagonal scalar Ai=: >:@i. Augmented integers Area=: [: Det ] ,. %@!@#"1 Area (Vol) try Area tet=:0,=i.3 Bc=: i. !/ i. Binomial coefficients Bca=: %.@Bc Binomial coefficients (alternating) By=: ' '&;@,.@[ ,. ] By (format; see Ta) Cpa=: ]%.i.@#@]^/Ei@[ Coeffs of poly approx CPA=: 1 : 'x@] %.i.@#@]^/Ei@[' Coeffs of poly approx (adverb) Det=: -/ . * Determinant Dpc=: 1: }. ] * i.@# Differentiate poly coeffs D1=: ("0)(D.1) Derivative (scalar, first) Ei=: i.@(+*+0&=) Extended integers Epc=: Bc@# X ] Expand poly coeffs Ipc=: 0: , ] % Ai@# Integrate poly coeffs Inv=: ^:_1 Inverse Id=: =@i. Identity matrix Mat=: -: /:~ Monotone ascending test Mdt=: -: \:~ Monotone descending test Mrg=: +&\$ {. ,@(|:@,:) Merge Over=: ({.;}.)@":@, Over (format; see Ta) Pad=: 2 : 'x%.]^/Ei@(y"_)' Polynomial approx of degree Pp=: +//.@(*/) Polynomial coeffs product Si=: (Ei@+: - |) : (-/ i.) Symmetric and subsiding int Span=: 2 : 'y"_ x\ ]' Span of apply of left arg S1=: |:@|@(^!._1/~%.^/~)@i. Stirling numbers (1st kind) S2=: |:@ (^/~%.^!._1/~)@i. Stirling numbers (2nd kind) Ta=: 1 : '[By]Over x/' Table adverb Thr=: ] * 0.1&^@[ <: |@] Threshold for non-zero Tile=: \$@]{.[\$~\$@]+2:|1:+\$@] Tile (try 0 1 Tile i. 2 3 4) X=: +/ . * Times (matrix product) XA=: -/ . * Times (alternating)

Exercises

 28.1 Enter the definitions of the secondaries (or at least those used in these exercises), and then enter the following expressions: ```(Ai 2 3);(Ai 2 _3);(Ei 2 3);(Ei 2 _3) (i.;i.@-;Ai;Ai@-;Ei;Ei@-) 4 (Si 4);(7 4 Si 4) +Ta~@i. 4 (S1;S2) 7 (];X/;%/;%./;(%./%{.)) y=: (Bc ,: Bca) 5 (0 1&Cb;1 _1&Cb) i. 2 3 4 ``` 28.2 Perform further experiments with the secondaries.

>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  Help  Dictionary