Re: ListCorrelate
- To: mathgroup at smc.vnet.net
- Subject: [mg37546] Re: ListCorrelate
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 4 Nov 2002 02:44:30 -0500 (EST)
- References: <aq07kc$5qp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Mike, Daniel, Clear["`*"]; j=2; ll = Array[aa,7]; With[{kernel = Unevaluated[{(j-1)*X,Y,(j+++1)*Z}]}, ListCorrelate[kernel,ll]] {X aa[1]+Y aa[2]+3 Z aa[3],2 X aa[2]+Y aa[3]+4 Z aa[4], 3 X aa[3]+Y aa[4]+5 Z aa[5],4 X aa[4]+Y aa[5]+6 Z aa[6], 5 X aa[5]+Y aa[6]+7 Z aa[7]} -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Mike" <mikeh1980 at optusnet.com.au> wrote in message news:aq07kc$5qp$1 at smc.vnet.net... > I think it is probably possible to use ListCorrelate in the following way: > > ListCorrelate[{(j-1)*X, Y,(j+1)*Z},{a,b,c,d,....}] > > Where j changes as they move along the row. The change reflects the position > or part of the element they are operating on. For example initially j =2 > then 3, 4...and the output would be > > {(2-1)*X*a+Y*b+(2+1)*Z*c,(3-1)*X*b+Y*c+(3+1)*Z*d, ...} > > I've tried to replace Times in ListCorrelate with a function that will do > this but had no success. If I can get this simple example to work I will > take this and Map a Matrix onto it: > > ListCorrelate[{(j-1)*X, Y,(j+1)*Z},#]&/@ list > > This will be part of a larger function which I've written alternatively > using MapThread and Map but I think it should work a lot faster if I can > incorporate ListCorrelate. > > Thanks > > Mike > > >