>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary

26. Linear Functions
A function`f` is said to be linear if`f(x+y)` equals`(f x)+(f y)` for all arguments`x` and`y` .`` For example:

       f=: 3&|. @: +: @: |.
       ]x=: i.# y=:2 3 5 7 11
    0 1 2 3 4

       x+y                            f x+y
    2 4 7 10 15                    8 4 30 20 14

       (f x),:(f y)                   (f x)+(f y)
    2 0  8  6  4                   8 4 30 20 14
    6 4 22 14 10

A linear function can be defined equivalently as follows:`f` is linear if`f@:+` and`+&f` are equivalent. For example:

       x f@:+ y x +&f y
    8 4 30 20 14 8 4 30 20 14

If`f` is a linear function, then`f y` can be expressed as the matrix product `mp&M y` ,`` where

       mp=: +/ . *
       M=: f I=: = i.#y            I is an identity matrix

       mp&M y
    6 4 22 14 10
       f y
    6 4 22 14 10

Conversely, if`m` is any square matrix of order`#y` ,`` then`m&mp` is a linear function on`y` ,`` and if`m` is invertible, then`(%.m)&mp` is its inverse:

       x=: 1 2 3 [ y=: 2 3 5
       ]m=: ?. 3 3$9
    3 8 8
    4 2 0
    2 7 4
       ]n=: %. m
    0.0909091   0.272727 _0.181818
    _0.181818 _0.0454545  0.363636
     0.272727 _0.0568182 _0.295455

       g=: mp&m
       h=: mp&n

       x g@:+ y
    45 90 56

       x +&g y
    45 90 56
        g h y
    2 3 5

Exercises

26.1 | For each of the following functions, determine the matrix`M` such that`M (mp=: +/ . *) N` is equivalent to the result of the function applied to the matrix`N` ,`` and test it for the case`N=: i. 6 6`
    |.
    -
    +:
    (4&*-2&*@|.)
    2&A.

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary