2
$\begingroup$

I would like to group the following integral result according to e^(r1^2+r2^2)+e^(r1^2-r2^2)+e^(r1-r2)^2. I've tried Collect, Factor, FactorTerms, doThat, Simplify...etc. but no luck.

Here is the integral

    Integrate[
    E^(-((ρ1^2 + ρ2^2)/(4*σ^2)))*
    E^(-((ρ2 - ρ1)^2/(2*δij^2)))*
    E^((I*k)/(2*B)*(A*(ρ1^2 - ρ2^2) - 
    2*(r1*ρ1 - r2*ρ2) + 
    D*(r1^2 - r2^2))), {ρ1, -Infinity, 
    Infinity}, {ρ2, -Infinity, Infinity}, 
    GenerateConditions -> False]

and the expected/simplified result is given in the below image. Also, I couldnt group the exponentials according to e^(r1^2+r2^2)+e^(r1^2-r2^2)+e^(r1-r2)^2 if the expr is written by hand like in the following:

    expr = Exp[(I*k*A)/(2*B)*(r1^2 - r2^2) - k^2/(4*p^2*B^2)*r1^2 + 
    1/(4*p^2)*(a*r1 - b*r2)^2]

the expected/simplified result is:

enter image description here

somehow they do it (dont worry about the constants out of the exponentials). Any idea? Thanks in advance.

$\endgroup$

1 Answer 1

5
$\begingroup$
Clear["Global`*"]
expr = Integrate[
  E^(-((ρ1^2 + ρ2^2)/(4*σ^2)))*
   E^(-((ρ2 - ρ1)^2/(2*δij^2)))*
   E^((I*k)/(2*B)*(A*(ρ1^2 - ρ2^2) - 
        2*(r1*ρ1 - r2*ρ2) + 
        D*(r1^2 - r2^2))), {ρ1, -Infinity, 
   Infinity}, {ρ2, -Infinity, Infinity}, 
  GenerateConditions -> False]

enter image description here

To collect as desired:

expr /. Exp[a_] :> Exp[ Collect[a, {r1 - r2, r1 + r2}]] /. 
 Exp[Plus[a_, b_, c_]] :> Times[E[a], E[b], E[c]]

enter image description here

$\endgroup$
5
  • $\begingroup$ Thank you @Nasser for the edit. $\endgroup$
    – Syed
    Commented Sep 13, 2022 at 10:06
  • $\begingroup$ Thank you @Syed, it works for the integral result. But, now, I couldnt group the exponentials for the hand written form like the one in the edited post. Can you help me once again? $\endgroup$
    – MiLearning
    Commented Sep 13, 2022 at 11:23
  • $\begingroup$ Your problem is clearly stated as far as the separation of exponential functions is concerned. Beyond that it is not easy (or at least I can't readily think of an obvious transformation). If you want someone to help you further, please load definitions of Aij, Bij, Iij, Qij, Rij. I also note that I and D are reserved words in Mathematica. $\endgroup$
    – Syed
    Commented Sep 13, 2022 at 11:39
  • $\begingroup$ Everything is a constant except for r1,r2, I removed the constants from the image. I is the complex unit, I edited D to A, because I didnt know that D is reserved (thanks @Syed by the way). So, what I am trying to do is trying to get to the second line of the image from the first line by using mathematica. $\endgroup$
    – MiLearning
    Commented Sep 13, 2022 at 12:07
  • $\begingroup$ After @Syed pointed out the i imaginary, I noticed that I have to take it under i paranthesis. So I will delete the question and renew it. $\endgroup$
    – MiLearning
    Commented Sep 15, 2022 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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