       Discrete functions - Pure function domain

• To: mathgroup at smc.vnet.net
• Subject: [mg104403] Discrete functions - Pure function domain
• From: Rui <rui.rojo at gmail.com>
• Date: Fri, 30 Oct 2009 02:20:20 -0500 (EST)

```I have been trying to implement a function to compute the continuous
(finite) to discrete fourier transform, and I've run into some
trouble, I wanna know your opinions as to a nice way to implement
this. Ideally, with it you can get a formula, if its possible, and if
not it should still be useful to get the values. Ideally also, it also
tells the user the frequency domain for which the transformed function
is valid (-Infinity,..., -2/P, -1/P, 0, 1/P, ...., Inifitny)
Basically, it's just this:
CDFT[f_, P_]:= (* P would be the length of the time function domain
and f is the function itself*)
(
Return[
(Integrate[f[t] * E^(-I 2 \[Pi] # t), {t, 0, P}]//FullSimplify)&
]
)
That seemed to work but the function returned is valid for all f, and
it doesn't even tell the user where it should be valid. I then added a
Print line.

It seemed to work more or less ok, but I run into trouble in a case
where the CCFT gave me indetermination, infinity, blah, where it
should give a number. That's when I added a Limit

CDFT[f_, P_]:=
(
Return[
(Limit[Integrate[f[t] * E^(-I 2 \[Pi] r t), {t, 0, P}]//FullSimplify,
r->#])&
]
)

It's getting uglier and uglier :P. Anyway, CDFT gives a good result
now but if CDFT[t] gets evaluated first and then replaced t->0, I run
again into the same trouble. And if I want, for example, to plot it, I
get a Print message for every time it calls CDFT, which is not good.
However, I don't know how else to tell the user of the allowed
frequencies (returning a list with the result and the message seems
very ugly). I would restrict the domain of the pure function with /;
if I knew how.

Particularly, I've been working with one period [0, 24] of the
function
x[t_] := (UnitStep[T + 6] - UnitStep[T])*(T + 6) + (UnitStep[T] -
UnitStep[T - 6])*(6 - T) /. T -> Mod[t, 24, -12] ;

Rui Rojo

```

• Prev by Date: Re: Re: SetterBar/ButtonBar, Dynamic and the visual
• Next by Date: Using the Interpolate/Spline Functionality for regression splines
• Previous by thread: Memory Management Issue - Possible Bug or Incompatibility w W7?
• Next by thread: Using the Interpolate/Spline Functionality for regression splines