Using Piecwise with FourierTransform can cause kernel crash, version 7
- To: mathgroup at smc.vnet.net
- Subject: [mg108319] Using Piecwise with FourierTransform can cause kernel crash, version 7
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Sat, 13 Mar 2010 07:59:00 -0500 (EST)
- Reply-to: "Nasser M. Abbasi" <nma at 12000.org>
Using version 7 on windows XP SP2.
I was trying to find the CTFT (fourier transform) of a delayed windowed
cosine signal. i.e. a cosine which only extent over some time interval, and
then the signal is zero everywhere else. But the window can be shifted in
time.
First, I used Piecwise to define the signal. Then I call FourierTransform.
But I find that when the delay amount (the amount the cosine is shift) is
not an integer amount, then the kernel would _simetimes_ crash. It also
takes long time to return.
Then I defined the window by using UnitStep instead of Piecwise. Now the
kernel is happy. No crash, and much faster.
I show below the small code used to reproduce this. Ami doing something
wrong here? I will use UnitStep from now on, but wanted to see if someone
can see why the use of Piecwise is giving the kernel such a problem. May be
I am not using it correctly somehow?
--- using Piecewise ---
Manipulate[process[t0],
Control[{{t0, 0, "t0"},-10, 10, 0.1, Appearance -> "Labeled"}],
ContinuousAction -> False,
Initialization :>
{
process[t0_] := Module[{t, xa, w},
xa = Piecewise[{{0, -2 - t0 >= t || t >= 2 - t0},{Cos[2*Pi*(t - t0)],
True}}];
Chop[FourierTransform[xa, t, w]]
]
}
]
-- using UnitStep, no crash, and faster ----
Manipulate[
process[t0],
Control[{{t0, 0, "t0"}, -10, 10, 0.1, Appearance -> "Labeled"}],
ContinuousAction -> False,
Initialization :>
{
process[t0_] := Module[{t, xa, w},
xa = Cos[2*Pi*(t - t0)]*(UnitStep[t + 2 + t0] -UnitStep[t - 2 + t0]);
Chop[FourierTransform[xa, t, w]]
]
}
]
--------------
If you do not get a crash of kernel with the Piecewise version first time,
try few more times, i.e. move the slides around.
ps. here is a screen shot of one crash
http://12000.org/tmp/031210/ctft.PNG
--Nasser