0
$\begingroup$

I wish to simplify the overlap of two gaussian-type orbitals,

primGauOrb = ((2 α)/π)^(3/4)E^(-α (x^2 + y^2 + z^2));

And then integrate it,

Assuming[Element[{xA, yA, zA, xB, yB, zB}, Reals] && α > 0 && β > 0, 
 Integrate[(primGauOrb /. {x -> x - xB, y -> y - yB, 
   z -> z - zB, α -> β})*(primGauOrb /. {x -> x - xA, y -> y - yA, z -> z - zA}), 
   {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity, Infinity}]] /. 
{xA^2 - 2*xA*xB + xB^2 + yA^2 - 2*yA*yB + yB^2 + zA^2 - 2*zA*zB + zB^2 -> Norm[RA - RB]^2}

Gives me the result,

ConditionalExpression[(1/Sqrt[((α+β)^3)])2 Sqrt[2] E^(-((α β Norm[RA-RB]^2)/(α+β))) (α β)^(3/4) Sqrt[-((α+β)/(xA^2 α^2+yA^2 α^2+zA^2 α^2+2 xA xB α β+2 yA yB α β+2 zA zB α β+xB^2 β^2+yB^2 β^2+zB^2 β^2))] Sqrt[-((xA^2 α^2+yA^2 α^2+zA^2 α^2+2 xA xB α β+2 yA yB α β+2 zA zB α β+xB^2 β^2+yB^2 β^2+zB^2 β^2)/(α+β))],(α+β) (xA^2 α^2+yA^2 α^2+zA^2 α^2+2 xA xB α β+2 yA yB α β+2 zA zB α β+xB^2 β^2+yB^2 β^2+zB^2 β^2)<0]

This is true, as the right answer is $\frac{2 \sqrt{2} (\alpha \beta )^{3/4} e^{-\frac{\alpha \beta \left\| \text{RA}-\text{RB}\right\| ^2}{\alpha +\beta }}}{\sqrt{(\alpha +\beta )^3}}$, but the condition may always be false.

That is, although $x<0$, $\sqrt{\frac{1}{x}}\sqrt{x}$ part should also cancel.

$\endgroup$
  • $\begingroup$ I want to know what is the right way to do this in mathematica $\endgroup$ – junjie yang Dec 10 '19 at 21:14
0
$\begingroup$

you can add a rule to simplify it

the FullSimplify@@expr can easily deal with the conditional expression.

formula=FullSimplify@@ConditionalExpression[(1/Sqrt[((α+β)^3)])2 Sqrt[2] E^(-((α β Norm[RA-RB]^2)/(α+β))) (α β)^(3/4) Sqrt[-((α+β)/(xA^2 α^2+yA^2 α^2+zA^2 α^2+2 xA xB α β+2 yA yB α β+2 zA zB α β+xB^2 β^2+yB^2 β^2+zB^2 β^2))] Sqrt[-((xA^2 α^2+yA^2 α^2+zA^2 α^2+2 xA xB α β+2 yA yB α β+2 zA zB α β+xB^2 β^2+yB^2 β^2+zB^2 β^2)/(α+β))],(α+β) (xA^2 α^2+yA^2 α^2+zA^2 α^2+2 xA xB α β+2 yA yB α β+2 zA zB α β+xB^2 β^2+yB^2 β^2+zB^2 β^2)<0];
((formula//Numerator)/.Sqrt[x_]*Sqrt[y_]:>Sqrt[x y]//FullSimplify)/(formula//Denominator)
$\endgroup$
0
$\begingroup$

It is ofter very tricky to make Mathematica simplify a result in a way you desire.

First, let's compute the integral "as is" an see what assumptions Mathematica will use:

ClearAll["Global`*"]
primGauOrb[x_, y_, z_, α_] := ((2 α)/π)^(3/4) E^(-α (x^2 + y^2 + z^2));
Integrate[primGauOrb[x - xB, y - yB, z - zB, β]*
 primGauOrb[x - xA, y - yA, z - zA, α], {x, -Infinity, Infinity},
 {y, -Infinity, Infinity}, {z, -Infinity, Infinity}]

Blockquote

So we can use this same assumption to get final output:

result=Integrate[primGauOrb[x - xB, y - yB, z - zB, β]*
 primGauOrb[x - xA, y - yA, z - zA, α], {x, -Infinity, Infinity},
 {y, -Infinity, Infinity}, {z, -Infinity, Infinity}, 
 Assumptions -> Re[α + β] >= 0]

Blockquote

Now we can make final substitution to represent numerator in exponent in desired form:

Simplify[result, (xA^2 - 2 xA xB + xB^2 + yA^2 - 2 yA yB + yB^2 + zA^2 - 2 zA zB + 
 zB^2) == Norm[RA - RB]^2]

Blockquote

Or if you like more traditional form:

Format[norm[a_]] := DoubleBracketingBar[a]
Simplify[result, (xA^2 - 2 xA xB + xB^2 + yA^2 - 2 yA yB + yB^2 + zA^2 - 2 zA zB + 
 zB^2) == norm[RA - RB]^2]

Blockquote

$\endgroup$
  • $\begingroup$ Hi Alx, thank you very much for your help. What is the difference between primGauOrb = ((2 α)/π)^(3/4)E^(-α (x^2 + y^2 + z^2)); and primGauOrb[x_, y_, z_, α_] := ((2 α)/π)^(3/4) E^(-α (x^2 + y^2 + z^2)); ? In my point of view, the first is a symbolic expression, and the second is a function that takes symbolic variables. Are they different? $\endgroup$ – junjie yang Dec 11 '19 at 4:06
  • $\begingroup$ I defined primGauOrb as a function to simplify input of integral, to not make those ReplaceAll substitutions of x -> x - xA etc. If you need to use some expression many times with different internals (x etc in this case) it is better to define that as a function. $\endgroup$ – Alx Dec 11 '19 at 4:16
  • $\begingroup$ I did as what you suggested in your answer, the result can be obtained in this way. But I got some error information. $Assumptions::cas: Warning: contradictory assumption(s) Re[\[Alpha]+\[Beta]]>0&&\[Alpha]+\[Beta]<0 encountered. I tried to restart my notebook, but that does not work.... $\endgroup$ – junjie yang Dec 11 '19 at 4:28
  • $\begingroup$ You probably have some previously setted assumptions, there is no such contradicted in my code as you show. Try with fresh Mathematica session: Evaluation -> Quit Kernel, then run my code, it should work. $\endgroup$ – Alx Dec 11 '19 at 4:33
  • $\begingroup$ You can also clear previous asuumptions with: $Assumptions=.. $\endgroup$ – Alx Dec 11 '19 at 4:40

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.