adding assumptions to Integrate
- To: mathgroup at smc.vnet.net
- Subject: [mg69630] adding assumptions to Integrate
- From: dimmechan at yahoo.com
- Date: Sun, 17 Sep 2006 22:46:20 -0400 (EDT)
Hello to all. The follow commands have the same result. Assuming[0 < Re[a] < Re[b], Integrate[1/x, {x, a, b}]] -Log[a] + Log[b] Integrate[1/x, {x, a, b}, Assumptions -> 0 < Re[a] < Re[b]] -Log[a] + Log[b] Block[{$Assumptions = 0 < Re[a] < Re[b]}, Integrate[1/x, {x, a, b}]] -Log[a] + Log[b] old$Assumptions = $Assumptions; $Assumptions = 0 < Re[a] < Re[b]; Integrate[1/x, {x, a, b}] -Log[a] + Log[b] $Assumptions = old$Assumptions; Clear[old$Assumptions] Here are my questions... Can I trust all of these ways to add conditions for Integrate even for more complicated integrals? Or some method is more preferable for reasons of reliability/timing etc? E.g. I have read somewhere that it is more preferable to use (for versions 5.X) Assuming[...,Integrate[...]] than Integrate[...,Assumtions->...]. Is that true? If the answer is yes can someone offer me a specific example? Consider also the following integral. Timing[Integrate[BesselJ[n, x]/(1 + x)^m, {x, 0, Infinity}]] {49.453*Second, If[Re[m] > -(1/2) && Re[n] > -1, -((2^(-1 - m)*m*Gamma[(1/2)*(-m + n)]*HypergeometricPFQ[{1/2 + m/2, 1 + m/2}, {3/2, 1 + m/2 - n/2, 1 + m/2 + n/2}, -(1/4)])/ Gamma[(1/2)*(2 + m + n)]) + (Gamma[(1/2)*(1 - m + n)]*HypergeometricPFQ[{1/2 + m/2, m/2}, {1/2, 1/2 + m/2 - n/2, 1/2 + m/2 + n/2}, -(1/4)])/(2^m*Gamma[(1/2)*(1 + m + n)]) + (Gamma[-1 + m - n]*HypergeometricPFQ[{1/2 + n/2, 1 + n/2}, {1 - m/2 + n/2, 3/2 - m/2 + n/2, 1 + n}, -(1/4)])/ (2^n*Gamma[m]), Integrate[BesselJ[n, x]/(1 + x)^m, {x, 0, Infinity}, Assumptions -> Re[m] <= -(1/2) || (Re[m] > -(1/2) && Re[n] <= -1)]]} Here is the value of the integral for special {m,n} along with the proper numerical verification. Simplify[%[[2]] /. {m -> 5/3, n -> 2}] N[%] Timing[NIntegrate[BesselJ[n, x]/(1 + x)^m /. {m -> 5/3, n -> 2}, {x, 0, Infinity}, Method -> Oscillatory]] (4*Gamma[-(4/3)]*(-20 + 20*HypergeometricPFQ[{-(1/2)}, {-(5/6), -(1/3)}, -(1/4)] - 9*HypergeometricPFQ[{1/2}, {1/6, 2/3}, -(1/4)]))/(81*Gamma[5/3]) + (Gamma[2/3]*(28*HypergeometricPFQ[{5/6}, {1/2, 7/3}, -(1/4)] - 15*HypergeometricPFQ[{11/6}, {3/2, 10/3}, -(1/4)]))/ (56*2^(2/3)*Gamma[7/3]) - (Gamma[1/6]*(85*HypergeometricPFQ[{4/3}, {3/2, 17/6}, -(1/4)] - 8*HypergeometricPFQ[{7/3}, {5/2, 23/6}, -(1/4)]))/(204*2^(2/3)*Gamma[17/6]) 0.15406619415903422 {0.6100000000000065*Second, 0.1540661941590603} Based on my experience I have got the impression that if you execute a symbolic calculation, such as definite integration, the next time you will execute the same calculation (if you do not exit the kernel of course) the needing time is much less. E.g. Timing[Integrate[1/Abs[Sqrt[x]], {x, -1, 2}]] Timing[Integrate[1/Abs[Sqrt[x]], {x, -1, 2}]][[1]] {0.5*Second, 2*(1 + Sqrt[2])} 0.10899999999999999*Second However I do not understand why exist the big difference in times below. Timing[Assuming[Re[m] > 0 && Re[n] > 0, Integrate[BesselJ[n, x]/(1 + x)^m, {x, 0, Infinity}]]][[1]] 39.71900000000001*Second Timing[Integrate[BesselJ[n, x]/(1 + x)^m, {x, 0, Infinity}, Assumptions -> Re[m] > 0 && Re[n] > 0]][[1]] 15.859000000000009*Second Timing[Block[{$Assumptions = Re[m] > 0 && Re[n] > 0}, Integrate[BesselJ[n, x]/(1 + x)^m, {x, 0, Infinity}]]][[1]] 8.734000000000009*Second old$Assumptions = $Assumptions; $Assumptions = Re[m] > 0 && Re[n] > 0; Timing[Integrate[BesselJ[n, x]/(1 + x)^m, {x, 0, Infinity}]][[1]] $Assumptions = old$Assumptions; Clear[old$Assumptions] 6.891000000000005*Second I will really appreciate any kind of guidance. Dimitris Anagnostou
- Follow-Ups:
- Re: adding assumptions to Integrate
- From: Andrey <newsgroup@gorodok.net>
- Re: adding assumptions to Integrate