Re: Another Out of Memory Problem
- To: mathgroup at smc.vnet.net
- Subject: [mg91314] Re: Another Out of Memory Problem
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 15 Aug 2008 06:53:06 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g8137j$19$1@smc.vnet.net>
Kevin J. McCann wrote:
> I can do the following:
>
> Integrate[Cos[2*x]*
> Exp[I*z*Cos[x]],
> {x, -Pi, Pi}]
>
>
> which produces a Bessel function answer; however if I change the
> argument in the cosine to 2.5 as in:
>
> Integrate[Cos[2.5*x]*
> Exp[I*z*Cos[x]],
> {x, -Pi, Pi}]
>
> I almost immediately get this:
>
> No more memory available.
> Mathematica kernel has shut down.
> Try quitting other applications and then retry.
>
> Any ideas why? I am running XP with 2Gb of memory.
When using symbolic function (i.e. Integrate rather than NIntegrate,
Solve rather than NSolve, etc.) it is always a good idea to feed the
function with *exact* (infinite precision) numbers, thus 5/2 rather 2.5
in your case. (Mathematica does not find any closed form for your
integrand. Note that it take a while to compute but memory consumption
is under control.)
In[1]:= Integrate[Cos[5/2*x]*Exp[I*z*Cos[x]], {x, -Pi, Pi}]
Out[1]=
I z Cos[x] 5 x
Integrate[E Cos[---], {x, -Pi, Pi}]
2
Regards,
-- Jean-Marc