[Sorry for the truncated message: let's try again.]
The example given looks like an instance of a 1-dimensional convolution to
me. J has an idiom for that which generalizes.
pp=:+//.@(*/) NB. polynomial product
]data=:? 10 # 0
0.37327 0.422685 0.570172 0.26975 0.965298 0.150244 0.203398 0.861356
0.0348968 0.872465
(1 1 1%3) pp data NB. moving average
0.124423 0.265318 0.455376 0.420869 0.60174 0.461764 0.439647 0.404999
0.36655 0.589573 0.302454 0.290822
1 _1 pp data NB. forward difference
0.37327 0.0494151 0.147487 _0.300422 0.695548 _0.815054 0.0531548 0.657957
_0.826459 0.837569 _0.872465
1 _2 1 pp data NB. 2nd derivative approximation
0.37327 _0.323855 0.0980724 _0.44791 0.99597 _1.5106 0.868209 0.604802
_1.48442 1.66403 _1.71003 0.872465
Of course, you have to decide what to do at the endpoints.
If the program involves convolution in more than one dimension, J's
primitive ;: provides a mechanism.
Best wishes
John
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm