[Date Index]
[Thread Index]
[Author Index]
RE: Re: FourierTransform problem
*To*: mathgroup at smc.vnet.net
*Subject*: [mg35139] RE: [mg35118] Re: FourierTransform problem
*From*: "DrBob" <majort at cox-internet.com>
*Date*: Tue, 25 Jun 2002 19:55:28 -0400 (EDT)
*Reply-to*: <drbob at bigfoot.com>
*Sender*: owner-wri-mathgroup at wolfram.com
David's original code, unmodified, works just fine in version 4.1.
The cost of a student version is about $140. Spend it. You can't take
it with you.
Bobby
-----Original Message-----
From: JDW [mailto:wempenj at asme.org]
To: mathgroup at smc.vnet.net
Subject: [mg35139] [mg35118] Re: FourierTransform problem
David Turner <dturner at faulkner.edu> wrote in message
news:<af6hts$ll4$1 at smc.vnet.net>...
> Hello,
>
> I am using Mathematica for Students 3.0.1 with Windows 98. When I
execute
> the following code, I get the error messages below:
>
> In[1]:=
> <<Calculus`FourierTransform`
>
> In[2]:=
> Clear[fx, fw, a]
>
> In[3]:=
> a:=1
>
> In[4]:=
> fx[x_]:=Exp[-Abs[x*a]]
>
> In[5]:=
> fw[w_]:=InverseFourierTransform[fx[x], x, w]
>
> In[6]:=
> Plot[fw[w], {w, -5*a,5*a}]
>
> Plot::plnr : fw[w] is not a machine-size real number at w = -5..
> Plot::plnr : fw[w] is not a machine-size real number at w = -4.59433..
> Plot::plnr : fw[w] is not a machine-size real number at w = -4.15191..
> General:: stop : Further output of Plot::plnr will be suppressed
during this
> calculation.
>
> Does anyone know where I might obtain a corrected FourierTransform.m
package
> for Mathematica 3.0.1? My copy is dated 7/21/97. I contacted Wolfram
about
> this matter. However, they told me they no longer support version
3.0. I
> appreciate any help you may provide.
>
> Thanks.
>
> David
David,
The problem doed not exist in the FourierTransform package but in your
function deffinition. You have used the SetDelayed operator (:=) to
define all your fuctions. This holdes the function unevaluated and is
evaluated afresh each time it is called. You have several options to
fix this.
Evlauate fx[x] in the fw[w] function (very slow for plotting the
function fx[x] must me evlauted afresh for each point the the plot)
fw[w_] := InverseFourierTransform[Evaluate[fx[x]], x, w]
or you may evlautate the fw[w] function in the plot command (slightly
faster)
Plot[Evaluate[fw[w]], {w, -5*a, 5*a}]
or best yet don't use the := operator when you don't need to.
Needs["Calculus`FourierTransform`"]
Clear[fx, fw, a]
a = 1;
fx[x_] = Exp[-Abs[x*a]];
fw[w_] = InverseFourierTransform[fx[x], x, w];
Plot[fw[w], {w, -5*a, 5*a}]
Also you can avoid shadowing problems (they can be quite confusing) by
using the Needs[] function to read in packages rather than <<.
--JDW
Prev by Date:
**New Mathematica 4.2 Delivers XML and Java Functionality**
Next by Date:
**Re: FourierTransform problem**
Previous by thread:
**Re: FourierTransform problem**
Next by thread:
**Re: FourierTransform problem**
| |