Re: Reasonable integration speed? (24 hrs and counting)
- To: mathgroup at smc.vnet.net
- Subject: [mg68055] Re: Reasonable integration speed? (24 hrs and counting)
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 21 Jul 2006 05:37:46 -0400 (EDT)
- Organization: The University of Western Australia
- References: <e9nkvm$9vo$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <e9nkvm$9vo$1 at smc.vnet.net>, axlq at spamcop.net (axlq) wrote: > I downloaded the trial version of Mathematica to see if it could > solve a complex integral. After getting comfortable with solving > simple integrals, I input my target problem: > > In[1]:= f[x] = Sqrt[a^2+(q-x)^2] > > In[2]:= Integrate[Cos[(2*n + 1)*Pi*x/d]* > (Exp[-I*k*f[x]]/(4*Pi*f[x]^5)*((1 + I*k*f[x])*(2*f[x]^2 - 3*a^2) > + (k*a*f[x])^2) * I*d/(2*Pi* w) + p), {x, -d/2, d/2}] > > Observations: > > 1. It's been sitting there for over 24 hours now. > > 2. Task Manager shows Mathematica's CPU usage at a constant 50%. > > 3. The "Kernel" pull-down menu has "Interrupt Evaluation" grayed out. > I can abort it. > > 4. Mathematica won't solve any subsequent problem in another window > (seems like the first one is occupying a queue). > > Earlier I tested some simple function-reference integrals (e.g. > defining f[x] first and then integrating f[x]dx) and they worked. > > What sort of speed can I expect from this? Is 24 hours too long to > solve a problem like this on a 2.6 GHz Windows XP platform with 1.25 > GB RAM? Is Mathematica hung up on something? Is the fact that I'm > using the trial version make any difference? Did I do something > wrong? Observations: 1. To paraphrase Barbie (http://www.sniggle.net/barbie.php), "integration is hard". 2. Let's break down your problem. First, the term involving p Integrate[Cos[(2 n + 1) Pi x/d] p, {x, -d/2, d/2}] is trivial. Next, can you compute, or do you expect to be able to compute Integrate[Cos[(2n + 1) Pi x/d] Exp[-I k f[x]], {x, -d/2, d/2}] ? This integral, even though it appears to be simple, is non-trivial. I suspect that it can be computed via Bessel functions. 3. Rescaling variables simplifies this integral slightly. 4. If you can compute this integral, then you can solve your target problem using parametric differentiation. Why? Because it is easy to verify that (1/a) D[(1/a) D[a D[Exp[-I k f[x]], a] - 2 Exp[-I k f[x]], a], a] multiplied by the constant d/(8 k Pi^2 w) (a combination of terms only involving differentiation with respect to a) equals the "difficult" part of your target problem, Exp[-I k f[x]]/(4 Pi f[x]^5) ((1 + I k f[x]) (2 f[x]^2 - 3 a^2) + (k a f[x])^2) I d/(2 Pi w)) 5. Note that Sqrt[a^2+(q-x)^2] is the distance between {q,a} and {x,0}. This suggests possible change of variables so as to simplify the integral. Cheers, Paul _______________________________________________________________________ Paul Abbott Phone: 61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) AUSTRALIA http://physics.uwa.edu.au/~paul