Re: Diferent solution of integral in versions 4 and 5...
- To: mathgroup at smc.vnet.net
- Subject: [mg73655] Re: Diferent solution of integral in versions 4 and 5...
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Sat, 24 Feb 2007 02:09:35 -0500 (EST)
- References: <ergr6r$jjg$1@smc.vnet.net>
Very smart David's "trick"; isn't it? Using ComplexExpand helps you write the original complex function f[k3_, x3_, k12_] = Exp[(-I)*k3*x3]/(k12^2 + k3^2)^2; as an complex function with even real part and odd imaginary part. So ComplexExpand[Exp[(-I)*k3*x3]/(k12^2 + k3^2)^2] % /. (x_) + _Complex*(y_) :> {x, -y} FullSimplify[(Integrate[#1, {k3, -Infinity, Infinity}, Assumptions -> k12 != 0 && Im[k12] == 0 && Im[x3] == 0] & ) /@ %] Cos[k3*x3]/(k12^2 + k3^2)^2 - (I*Sin[k3*x3])/(k12^2 + k3^2)^2 {Cos[k3*x3]/(k12^2 + k3^2)^2, -(Sin[k3*x3]/(k12^2 + k3^2)^2)} {(Pi*(k12*Abs[x3] + Sign[k12]))/(E^(Abs[k12]*Abs[x3])*(2*k12^3)), 0} With 0 of course since you integrate an odd function of the variable k3. To justify David's solution use e.g. lst = (Thread[{k12, x3} -> #1] & ) /@ Table[{Random[Real, {0.5, 5}], Random[Real, {0.5, 5}]}, {10}] {{k12 -> 1.1675616186532962, x3 -> 2.6556810667683277}, {k12 -> 1=2E2713568684823673, x3 -> 1.8099144913805543}, {k12 -> 3.4841237443650503, x3 -> 2.6535719393016723}, {k12 -> 2=2E6959642507267563, x3 -> 4.226417058787291}, {k12 -> 1.5395293992705767, x3 -> 1.5734587645644789}, {k12 -> 3=2E1580481534632434, x3 -> 2.0136089223196194}, {k12 -> 4.952236080890497, x3 -> 2.009508324193675}, {k12 -> 4=2E970425147443978, x3 -> 2.3277432697426503}, {k12 -> 4.004721039068641, x3 -> 3.128152964876208}, {k12 -> 4=2E676832867372604, x3 -> 4.597146905502109}} Integrate[ComplexExpand[Exp[(-I)*k3*x3]/(k12^2 + k3^2)^2], {k3, - Infinity, Infinity}, Assumptions -> k12 != 0 && Im[k12] == 0 && Im[k3] == 0 && Im[x3= ] == 0] % /. lst (Pi*(k12*Abs[x3] + Sign[k12]))/(E^(Abs[k12]*Abs[x3])*(2*k12^3)) {0.18219270130020737, 0.2527185275980308, 0.000036741125830956446, 0=2E000011187424981952258, 0.13069411326823527, 0.0006352959378698386, 6.749698849139478*^-6, 1=2E5189304176249685*^-6, 1.1996229219208607*^-6, 1=2E5888359974689758*^-10} Block[{Message}, NIntegrate[Evaluate[f[k3, x3, k12] /. lst], {k3, - Infinity, Infinity}, PrecisionGoal -> 6, MaxRecursion -> 12, SingularityDepth -> 1000]] {0.18219266715939364 + 3.148189729130901*^-8*I, 0.25271857118317564 - 4=2E5314371968234484*^-10*I, 0.00003674694940154206 - 1.1845327836269097*^-9*I, 0=2E000011170820307341834 + 1.7880411380287162*^-9*I, 0.13069412758859972 + 2.4988687899502313*^-18*I, 0=2E0006352975403380257 - 2.954614701784285*^-19*I, 6.745953764694171*^-6 - 2.210755992333724*^-19*I, 1=2E519528484728677*^-6 + 1.733753911631708*^-9*I, 1.1930880005214226*^-6 - 1.3997219453377313*^-19*I, 1=2E6358628816503943*^-9 - 6.258311844972166*^-10*I} Note also as I have already mentioned that Block[{Message}, Integrate[f[k3, x3, k12] /. lst, {k3, -Infinity, Infinity}]] {0.18219270130020737 + 0.*I, 0.2527185275980308 + 0.*I, 0=2E00003674112583095645 + 0.*I, 0.000011187424981952258 + 0.*I, 0.13069411326823527 + 0.*I, 0.0006352959378698385 + 0.*I, 6=2E749698849139476*^-6 + 0.*I, 1.5189304176249685*^-6 + 0.*I, 1.1996229219208607*^-6 + 0.*I, 1.588835997468976*^-10 + 0.*I} i=2Ee. no need of ComplexExpand Below I also provide another method of getting the correct result with the current version of Mathematica (5.2). It is not so general as David's solution but it has proved very helpful in many occasions. I have adopted this (very smart!) method from an old post of Paul Abbott; unfortunately I could not find his original post in the archives right now. Searching in the archives of my posts you can find one or two occasions I made use of this method in order to reply to someone. First let see the Built-in Symbols with the attribute Constant: Select[Names["*"], MemberQ[Attributes[#1], Constant] & ] N[ToExpression[%]] {"Catalan", "Degree", "E", "EulerGamma", "Glaisher", "GoldenRatio", "Khinchin", "MachinePrecision", "Pi"} {0.915965594177219, 0.017453292519943295, 2.718281828459045, 0=2E5772156649015329, 1.2824271291006226, 1.618033988749895, 2.6854520010653062, 15.954589770191003, 3.141592653589793} We choose EulerGamma for our purposes (note that EulerGamma is real and possitive) and we work as follows With[{x3 = EulerGamma}, Integrate[Exp[(-I)*k3*x3]/(k12^2 + k3^2)^2, {k3, -Infinity, Infinity}, Assumptions -> k12 != 0 && Im[k12] == 0]] % /. EulerGamma -> x3 (Pi*(EulerGamma*k12 + Sign[k12]))/ (E^(EulerGamma*k12*Sign[k12])*(2*k12^3)) (Pi*(k12*x3 + Sign[k12]))/(E^(k12*x3*Sign[k12])*(2*k12^3)) That is we let x3 to be EulerGamma, we evaluate the integral and then replace EulerGamma by x3 again. (*check*) % /. lst {0.18219270130020737, 0.2527185275980308, 0.000036741125830956446, 0=2E000011187424981952258, 0.13069411326823527, 0.0006352959378698386, 6.749698849139478*^-6, 1=2E5189304176249685*^-6, 1.1996229219208607*^-6, 1=2E5888359974689758*^-10} Note that this method will work providing x3 is positive. For negative x3 one should work as With[{x3 = -EulerGamma}, Integrate[Exp[(-I)*k3*x3]/(k12^2 + k3^2)^2, {k3, -Infinity, Infinity}, Assumptions -> k12 != 0 && Im[k12] == 0]] % /. EulerGamma -> -x3 (Pi*(EulerGamma*k12 + Sign[k12]))/ (E^(EulerGamma*k12*Sign[k12])*(2*k12^3)) (E^(k12*x3*Sign[k12])*Pi*((-k12)*x3 + Sign[k12]))/(2*k12^3) (*check*) lst2 = (Thread[{k12, x3} -> #1] & ) /@ Table[{Random[Real, {0.5, 5}], - Random[Real, {0.5, 5}]}, {10}] {{k12 -> 0.8881767241577119, x3 -> -0.736609587255088}, {k12 -> 1=2E8261316181460772, x3 -> -2.771652261645303}, {k12 -> 2.8975139042175497, x3 -> -4.131417125843646}, {k12 -> 2=2E5869558351901247, x3 -> -4.05053597205049}, {k12 -> 3.860896602257241, x3 -> -4.419494896650965}, {k12 -> 0=2E7804818929478696, x3 -> -0.7130682368080272}, {k12 -> 4.283396756458498, x3 -> -2.932595422980895}, {k12 -> 2=2E136651260729555, x3 -> -4.566349688073738}, {k12 -> 1.5059197733814464, x3 -> -2.481240143792421}, {k12 -> 3=2E6458823911369582, x3 -> -2.687996421241035}} (Pi*(k12*Abs[x3] + Sign[k12]))/(E^(Abs[k12]*Abs[x3])*(2*k12^3)) /. lst2 {1.9279132918489237, 0.009907357612293364, 5.29836913480746*^-6, 0=2E00002929951155419272, 1.9159809524036275*^-8, 2.947744959661626, 9.499149878855855*^-7, 0.00010030400755062146, 0=2E0519294748579972, 0.000019408989269586413} (E^(k12*x3*Sign[k12])*Pi*((-k12)*x3 + Sign[k12]))/(2*k12^3) /. lst2 {1.9279132918489237, 0.009907357612293364, 5.29836913480746*^-6, 0=2E00002929951155419272, 1.9159809524036275*^-8, 2.947744959661626, 9.499149878855855*^-7, 0.00010030400755062146, 0=2E0519294748579972, 0.000019408989269586413} Kind Regards Dimitris =CF/=C7 vromero =DD=E3=F1=E1=F8=E5: > Hello, > I tried the following integral: > > Integrate[Exp[-I k3 x3]/(k12^2 + k3^2)^2,{k3,-Infinity,Infinity}, > Assumptions -> k12!=0 && Im[k12] == 0 && Im[k3] == 0 && Im[x3] = == 0] > > The result in version 5 is > > (Abs[k12]*MeijerG[{{1/2}, {}}, {{0, 1/2, 3/2}, {}}, > (-(1/4))*k12^2*x3^2])/(k12^4*Sqrt[Pi]) > > But in version 4 is > > (1 + Abs[k12] Abs[x3]) / Abs[k12]^2 * Exp[- Abs[k12] Abs[x3]] > > How can I get last result from version 5? > > Thanks in advance... > > Victor Romero