|
[Date Index]
[Thread Index]
[Author Index]
Re: Taking the Log causing Mathematica kernel crash.
- To: mathgroup at smc.vnet.net
- Subject: [mg57089] Re: Taking the Log causing Mathematica kernel crash.
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Sun, 15 May 2005 03:03:43 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 5/14/05 at 4:57 AM, nma at 12000.org (Nasser Abbasi) wrote:
>"me" <nma at 12000.org> wrote in message
>news:d615dg$nn1$1 at smc.vnet.net...
>>Mathematica 5.1 on Windows.
>This is another small variation on this problem of the Log[]
>Now, this causes Mathematica kernel to start eating all the memory
>very quickly with full CPU consumption.
>Clear["Global`*"]
>f[t_] := Sin[3.5*t] + 2*Cos[2*t];
>g[t_] := Piecewise[{{0, t < -2*Pi}, {f[t], t >= -2*Pi && t <= 2*Pi},
>{0, t > 2*Pi}}];
>c[w_] := Integrate[g[t]*Exp[(-I)*w*t], {t, -Infinity, Infinity}];
>Plot[20*Log[10, Abs[c[w]]^2 +0.01], {w, -5, 5}, PlotRange -> All]
I don't think hte problem is with the Log function nor with any of the other functions you are using here.
Try using NIntegrate instead of Integrate.
Consider. The plot of c[w] has several lobes. Consequently, Plot needs to evaluate c[w] a fairly large number of times in order to achieve a valid representation of c[w]. By using Integrate, you are asking Mathematica to perform a symbolic integration every time c[w] is evaluated. This requires more memory for every evaluation of c[w] than a numeric evaluation. And this is most likely the cause of the crash.
In addition to using less memory, redefining c[w] with NIntegrate instead of Integrate things will run faster.
--
To reply via email subtract one hundred and four
Prev by Date:
Re: Count using pattern on two different matrices
Next by Date:
Re: Count using pattern on two different matrices
Previous by thread:
Re: Taking the Log causing Mathematica kernel crash.
Next by thread:
Integrate gives wrong answer
|