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

23. Polynomials

The monadic function M=: 3: * ] ^ 2: is a multiple of an integral power of its argument, and is called a monomial; and a sum of monomials such as SM=: (3:*]^2:)+(2.5"_*]^4:)+(_5:*]^0:) is a polynomial.

Any polynomial can be expressed in the standard form c&p, where c is a suitable list of coefficients, and where p=: +/@([*]^i.@#@[)"1 0 . For example:
   SM=: (3:*]^2:)+(2.5"_*]^4:)+(_5:*]^0:)
   p=: +/@([*]^i.@#@[)"1 0
   c=: _5 0 3 0 2.5
   x=: _2 _1 0 1 2
   (SM x),(c p x),:(c&p x)
47 0.5 _5 0.5 47
47 0.5 _5 0.5 47
47 0.5 _5 0.5 47
The primitive p. is equivalent to the function p defined above, and will be used hereafter. The polynomial c&p. is very important for a number of reasons, including:

1. It applies to any numeric argument, real or complex (and the parameter c may also be complex).

2. It can be used to approximate a wide range of functions.

3. It is closed under a number of operations; that is, the sum, difference, product, the composition @, the derivative, and the integral of polynomials are themselves polynomials.

4. The coefficients of the results of each case listed in 3 are easily expressed. For example, if #c equals #d, then c&p. + d&p. is equal to (c+d)&p. . More generally, it is equal to (+/c,:d)&p. . Thus:
ps=: +/@,:                    Polynomial sum
pd=: -/@,:                    Polynomial difference
pp=: +//.@(*/)                Polynomial product
D=: d.1                       Scalar (rank 0) first derivative
pD=: 1: }. ] * i.@#           Polynomial derivative
pI=: 0: , ] % 1: + i.@#       Polynomial integral



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