Re: ListConvolve?
- To: mathgroup at smc.vnet.net
- Subject: [mg42482] Re: ListConvolve?
- From: "Dana DeLouis" <delouis at bellsouth.net>
- Date: Thu, 10 Jul 2003 03:37:07 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Just another option. On your "Retention" variable, remove the old t's by
making a temp variable.
days = {t1, t2, t3};
retention = {f[b0, c0, t], f[b1, c1, t], f[b2, c2, t]}
temp = Apply[List, (Drop[#1, -1] & ) /@ retention, {1}]
{{b0, c0}, {b1, c1}, {b2, c2}}
f[_List, 0] := 0
f[x_List, y_] := f @@ Join[x, {y}]
TableForm[ListConvolve[temp, days, {1, 1}, 0, f, Plus, 1]]
f[b0, c0, t1],
f[b0, c0, t2] + f[b1, c1,t1],
f[b0, c0, t3] + f[b1, c1, t2] + f[b2, c2, t1]
HTH.
--
Dana DeLouis
Windows XP
Mathematica $VersionNumber -> 5.0 for Microsoft Windows (June 10, 2003)
delouis at bellsouth.net
= = = = = = = = = = = = = = = = =
<guillerm at usal.es> wrote in message news:bedvrg$fbt$1 at smc.vnet.net...
> Dear friend:
> I has two lists:
> days = {t1, t2, t3};
> retention = {f[b0, c0, t], f[ b1, c1, t], f[b2, c2, t]};
>
> I wish obtain this output:
>
> {f[b0, c0, t1], f[b0, c0, t2] + f[b1, c1, t1] ,
> f[b0, c0, t3] + f[b1, c1, t2] + f[b2, c2, t1] } // TableForm
>
> I have obtain a solution but it not efficient and my lists are alredy
large
> (here are examples). Any help?
>
> Thanks
>
> Guillermo