Re: Defining constants causes integration to hang

*To*: mathgroup at smc.vnet.net*Subject*: [mg114242] Re: Defining constants causes integration to hang*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Sun, 28 Nov 2010 06:54:46 -0500 (EST)

----- Original Message ----- > From: "amannuc" <amannuc at yahoo.com> > To: mathgroup at smc.vnet.net > Sent: Saturday, November 27, 2010 2:37:37 AM > Subject: [mg114215] Defining constants causes integration to hang > Dear Mathematica group, > > I have found a situation where using the Constants option in Dt causes > an indefinite integration to hang. This is unexpected behavior because > when I don't provide the Constants information, the integration > finishes quickly. I am surprised that in this case providing more > information causes the problem. I am using Mathematica 7.0. > > The following works: > n12[r_] := n1 - r dni/lD12 (* n1, dni and lD12 are actually constants > *) > > g2[a_] := 2*a*Integrate[ Dt[n12[r], r] (n12[r]* Sqrt[n12[r]^2*r^2 - > a^2]), > {r, h2, h1}] > > and the resulting definite integral seems correct but contains a > number of spurious derivatives such as: Dt[dni, r], Dt[lD12, r], etc. What exactly do you get? I see an unevaluated integration. Which is "correct" in its way, but not very useful. > These derivatives are zero because n1, dni and lD12 are actually > constants, not dependent on r. When I specify such in the Dt[n12[r], > r] expression, the integral never finishes executing. That is, in the > above expression I replace > Dt[n12[r], r] with > Dt[n12[r], r, Constants -> {n1, dni, lD12} ]. The integral now does > not finish. No surprise really. Now Integrate has something that it thinks-- deep in the recesses of its reptilian brain-- it can integrate. And spends considerable effort in trying to do so. > So, if I do not use the Constants option in Dt, I have the spurious > derivatives in the calculated expression (e.g. Dt[dni,r]) which I > seek to remove. One way to do this is to use the transformation rule: > Dt[dni, r] -> 0 (for example). It turns out that I can apply this type > of rule one at a time, and once only. > > For example, the following works fine: > > g3[a] = g2[a] /. Dt[dni, r] -> 0 > > which removes the spurious derivatives of dni. If I try to remove > another spurious derivative, the integral hangs. Thus, the following > hangs (trying to remove Dt[dn1, r]: > > g4[a] = g3[a] /. Dt[dn1, r] -> 0 > > It turns out the key fact is that I apply the transformation twice. > For example, I could switch the order of the above two transformation > statements. In that case, the first one completes but the second one > hangs. > > Any help/advice is appreciated. > > -Tony Specifying one of those as zero does not suffice to fool Integrate into churning its wheels. Bit once both are so specified, it's off to the races... Daniel Lichtblau Wolfram Research