>>  <<  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
5 7 3
7 2 3
4 4 2

   ]n=: %.m
 _1.33333 _0.333333  2.5
_0.333333 _0.333333    1
  3.33333   1.33333 _6.5

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

   x g@:+ y 
82 63 40 

   x +&g y
82 63 40

   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