Re: Fourier Transfer and a game?!?!
- To: mathgroup at smc.vnet.net
- Subject: [mg54266] Re: Fourier Transfer and a game?!?!
- From: Maxim <ab_def at prontomail.com>
- Date: Mon, 14 Feb 2005 21:51:17 -0500 (EST)
- References: <cuf5kg$god$1@smc.vnet.net> <cukb23$lmi$1@smc.vnet.net> <cump6f$3t9$1@smc.vnet.net> <cuperu$gmc$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Mon, 14 Feb 2005 06:01:34 +0000 (UTC), Paul Abbott <paul at physics.uwa.edu.au> wrote: > In article <cump6f$3t9$1 at smc.vnet.net>, Maxim <ab_def at prontomail.com> > wrote: > >> Here's how we can apply Fourier to this problem: >> >> In[2]:= >> F = Fourier; >> IF = InverseFourier; >> SetOptions[#, FourierParameters -> {1, 1}]& /@ {F, IF}; >> >> Module[{L}, >> L = PadRight[{0., .35, .35, .15, .15}, 13]; >> IF[.4*F[L]^0 + .35*F[L]^1 + .15*F[L]^2 + .1*F[L]^3] // Chop >> ] > > Two comments: > > [1] SetOptions accepts a list of functions: > > SetOptions[{Fourier, InverseFourier}, FourierParameters -> {1, 1}] > > [2] One can use the Dot product as follows: > > InverseFourier[{0.4, 0.35, 0.15, 0.1} . > (Fourier[PadRight[{0., 0.35, 0.35, 0.15, 0.15}, 13]]^# & /@ > {0, 1, 2, 3})] > > There can be a problem with 0^0 using either approach. > > Cheers, > Paul > Thanks Paul, I didn't know that it was possible to use SetOptions[{sym1, sym2}, opts] syntax; strictly speaking, this is an undocumented feature. I believe that SetOptions is not Listable because otherwise SetOptions[{sym1, sym2}, {opt1, opt2}] would become {SetOptions[sym1, opt1], SetOptions[sym2, opt2]}. Also you're absolutely right that the result of the transform may contain zeros. So a more accurate way to use Fourier would be as follows: In[1]:= F = Fourier; IF = InverseFourier; SetOptions[{F, IF}, FourierParameters -> {1, 1}]; Module[{n = 13, L0, L}, L0 = PadRight[{1.}, n]; L = PadRight[{0., .35, .35, .15, .15}, n]; IF[.4*F[L0] + {.35, .15, .1}.Array[F[L]^#&, 3]] // Chop ] Out[4]= {0.4, 0.1225, 0.140875, 0.0935375, 0.0994875, 0.049875, 0.03995, 0.02565, 0.015975, 0.007425, 0.003375, 0.0010125, 0.0003375} Maxim Rytin m.r at inbox.ru