Re: Defining constants causes integration to hang
- To: mathgroup at smc.vnet.net
- Subject: [mg114248] Re: Defining constants causes integration to hang
- From: Leonid Shifrin <lshifr at gmail.com>
- Date: Sun, 28 Nov 2010 06:55:52 -0500 (EST)
Hi Tony,
This will work:
Block[{a},
g2[a_] = (# /. r -> h2) - (# /. r -> h1) &[
2*a*Integrate[
Dt[n12[r], r,
Constants -> {n1, dni, lD12}] (n12[r]*
Sqrt[n12[r]^2*r^2 - a^2]), r]]];
But the answer is not nice. Anyway, at least it's the answer.
Regards,
Leonid
On Sat, Nov 27, 2010 at 11:37 AM, amannuc <amannuc at yahoo.com> wrote:
> 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.
> 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.
>
> 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
>
>