0
$\begingroup$

I am trying to integrate a simple equation. The code is as follows

V = -V0/(1 + Exp[(r - R)/a]);
s0 = 2 Sqrt[1/b^3] Exp[-r^2/(2*b^2)]/(Pi)^(1/4);
s1 = Sqrt[2/3]*Sqrt[1/b^3]*(3 - 2*r^2/b^2)*Exp[-r^2/(2*b^2)];
s2 = Sqrt[1/b^3]*Exp[-r^2/(2*b^2)]*(4*r^4/b^4 - 20*r^2/b^2 + 15)/(2*Sqrt[15]*Pi^(1/4));
s3 = Sqrt[1/b^3]*Exp[-r^2/(2*b^2)]*(-8*r^6/b^6 + 84*r^4/b^4 - 210*r^2/b^2 + 105)/(6*Sqrt[210]*Pi^(1/4));
s4 = Sqrt[1/b^3]*Exp[-r^2/(2*b^2)]*(16*r^8/b^8 - 288*r^6/b^6 + 1512*r^4/b^4 - 2520*r^2/b^2 + 945)/(144*Sqrt[105]*Pi^(1/4));
s00 = s0*s0*V*r^2;
s01 = s0*s1*V*r^2;
s00ws = Integrate[s00, {r, 0, Infinity}, Assumptions -> b > 0]
s01ws = Integrate[s01, {r, 0, Infinity}, Assumptions -> b > 0]

When I evaluate the above integral I get the following output

Integrate[-((4 E^(-(r^2/b^2)) r^2 V0)/(
  b^3 (1 + E^((r - R)/a)) Sqrt[\[Pi]])), {r, 0, \[Infinity]}, 
 Assumptions -> b > 0]

Integrate[-((2 Sqrt[2/3] E^(-(r^2/b^2)) r^2 (3 - (2 r^2)/b^2) V0)/(
  b^3 (1 + E^((r - R)/a)) \[Pi]^(1/4))), {r, 0, \[Infinity]}, 
 Assumptions -> b > 0]

Mathematica did not integrate the equation at all. Does anyone know what the problem is?

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Aug 24 '15 at 8:34
  • $\begingroup$ You use Sqrt[[Pi]] instead of Sqrt[Pi], and [Infinity] instead of \[Infinity]. (That last one might be a copy-paste error.) $\endgroup$ – Patrick Stevens Aug 24 '15 at 8:34
  • 1
    $\begingroup$ s00ws reduces, up to a constant, to Integrate[( (E^-(u + d/2)^2) (u^2) )/Cosh[d u - e], {u, 0, Infinity}] for constant d, e. I see no particular reason for that to have a closed form… $\endgroup$ – Patrick Stevens Aug 24 '15 at 8:39
  • 3
    $\begingroup$ @PatrickStevens Displaying Sqrt[[Pi]] is caused by the parser on the SE side. If you try to edit the question you will see that the `\` are actually present, i.e. you have to escape those backslashes $\endgroup$ – Sektor Aug 24 '15 at 8:55
  • 1
    $\begingroup$ First point is that you should not introduce s2, s3 and s4. They were not used in the integration and needlessly increases the complexity of your question. I plotted s00 as a function of r using a Manipulate to control the other variables. Manipulate[ Plot[-((4 E^(-(r^2/b^2)) r^2 V0)/( b^3 (1 + E^((r - R)/a)) Sqrt[\[Pi]])), {r, 0, 4}], {{R, 1}, 0.1, 10}, {{a, 1}, 0.1, 10}, {{b, 1}, 0.1, 2}, {{V0, 1}, 0.1, 100} ] It appears to go to zero at high r values. When I attempt to integrate s00 by substituting 1 for the parameters a, b, R and V0 it also will not integrate. $\endgroup$ – Jack LaVigne Aug 24 '15 at 13:00
3
$\begingroup$

I am using π rather than Pi in the equations you gave. I think this is what you wanted.

When I substitute in 1 for the variables a, b, R and V0 it will not integrate in a closed form.

Integrate[-((4 E^-r^2 r^2)/((1 + E^(-1 + r)) Sqrt[π])),
 {r, 0, Infinity}]

Mathematica graphics

However, NIntegrate works.

NIntegrate[-((4 E^-r^2 r^2)/((1 + E^(-1 + r)) Sqrt[π])),
 {r, 0, Infinity}]

-0.470468

To see how the variables affect the results you can plot the curve as a function of r and wrap the plot and numerical integration in a Manipulate.

Manipulate[
 Column[{
   Plot[-((4 E^(-(r^2/b^2)) r^2 V0)/(
     b^3 (1 + E^((r - R)/a)) Sqrt[π])), {r, 0, 4}, 
    ImageSize -> 400],
   Framed[
    NIntegrate[-((4 E^(-(r^2/b^2)) r^2 V0)/(
      b^3 (1 + E^((r - R)/a)) Sqrt[π])),
     {r, 0, Infinity}],
    Background -> LightCyan
    ]
   }],

 {{R, 1}, 0.1, 10, Appearance -> "Open"},
 {{a, 1}, 0.1, 10, Appearance -> "Open"},
 {{b, 1}, 0.1, 2, Appearance -> "Open"},
 {{V0, 1}, 0.1, 100, Appearance -> "Open"}
 ]

Mathematica graphics

You can change the values for R, a, b or V0 and see the result in the plot and the result of the numerical integration.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.