Samp28


28. Polynomials: Stopes


The expression */ x + s * i. n
is often called a factorial function but,
to avoid confusion with the function ! ,
we will call it a stope; the factors occurring
in its definition differ by steps of size s,
like the steps in a mine stope. Stopes are useful in actuarial work and
in the difference calculus.


The stope is a variant of the power ^
(being equivalent for the case s=:0),
and is provided by the fit conjunction in the variant ^!.s.
For example:

   x + s * i. n  [ x=: 7 [ n=: 5 [ s=: _1
7 6 5 4 3
   (*/x + s * i. n);(x ^!.s n);(x ^!.0 n);(x^n)
+----+----+-----+-----+
|2520|2520|16807|16807|
+----+----+-----+-----+

The phrase +/c * x^!.s i.#c
is called a stope polynomial, just as +/c*x^i.#c
may be called a power polynomial. We define an
adverb P that applies to any step size s to provide
the corresponding stope polynomial:

   P=: 1 : '+/@([ * ] ^!. x i.@#@[)"1 0'
   c=: 1 3 3 1 [ d=: 1 7 6 1 [ x=: 0 1 2 3 4
   (c p. x);(c 0 P x);(d _1 P x);(d p.!._1 x)
+-------------+-------------+-------------+-------------+
|1 8 27 64 125|1 8 27 64 125|1 8 27 64 125|1 8 27 64 125|
+-------------+-------------+-------------+-------------+

As illustrated above, stope polynomials are (for a suitable
choice of coefficients) equivalent to ordinary polynomials.
Moreover, the transformations between them are provided by
a matrix product as follows:

   VM=: 1 : '[ ^!.x/ i.@#@]'
   TO=: 2 : '(x VM %. y VM)~ @i.@#'
   (0 TO _1 c) +/ . * c
1 7 6 1

The matrices 0 TO _1 and _1 TO 0 are
mutually inverse, and are simply related to Stirling numbers:

   (0 TO _1 i.5);(_1 TO 0 i.5)
+---------+------------+
|1 0 0 0 0|1 0  0  0  0|
|0 1 1 1 1|0 1 _1  2 _6|
|0 0 1 3 7|0 0  1 _3 11|
|0 0 0 1 6|0 0  0  1 _6|
|0 0 0 0 1|0 0  0  0  1|
+---------+------------+

The stope polynomial is also provided by the variant p.!.s .