1
$\begingroup$

I am trying to simplify the following expression

code:

Cos[(Sqrt[Integrate[(-1 - I)*dper*Ex[t1], {t1, 0, Infinity}]]*
    Sqrt[Integrate[(-1 + I)*dper*Ex[t1], {t1, 0, Infinity}]])/hbar

with previous assumption declared as

$Assumptions = Element[\[Alpha] | \[Beta] | ap | a0 | E0 | Ep | t | Ex[t1] | Ex[] |
 t1 | Nd | T | hbar | dper | dpara, Reals];

However, somehow it seems Mathematica is not able to understand (-1+i)dper does not depend on t1, and therefore, it cannot be simplified. Any thoughts on how I could improve that?

Thanks!

$\endgroup$
6
  • 1
    $\begingroup$ What is Ex? Should it be Exp? $\endgroup$
    – Bob Hanlon
    Mar 8, 2021 at 18:49
  • 2
    $\begingroup$ Can you, please, include the code shown in the picture as easily copy-&-paste-able text in a code block here? $\endgroup$ Mar 8, 2021 at 18:55
  • 1
    $\begingroup$ The code yo included is not WL. and what is dper? $\endgroup$ Mar 8, 2021 at 19:31
  • 1
    $\begingroup$ To paraphrase the question: Why is Integrate[a*f[x], x] auto-simplified to a*Integrate[f[x], x] but Integrate[a*f[x], {x, x1, x2}] remains as-is without extracting the constant a from the integral? $\endgroup$
    – Roman
    Mar 8, 2021 at 19:36
  • 1
    $\begingroup$ @denis - prior to copy and paste of your code, convert it to Raw InputForm $\endgroup$
    – Bob Hanlon
    Mar 8, 2021 at 19:37

1 Answer 1

3
$\begingroup$

This is your expression:

expr = Cos[(Sqrt[Integrate[(-1 - I)*dper*Ex[t1], {t1, 0, Infinity}]]*
      Sqrt[Integrate[(-1 + I)*dper*Ex[t1], {t1, 0, Infinity}]])/hbar];

Try this:

expr2 = Simplify[
  expr /. Sqrt[Integrate[a_*Ex[t1], {t1, 0, Infinity}]] :> 
     Sqrt[a]*Sqrt[(Integrate[Ex[t1], {t1, 0, Infinity}])] /. 
   Sqrt[a_]*Sqrt[b_] :> Sqrt[a*b], dper \[Element] Reals]

(*  Cos[(Sqrt[2] Abs[dper] \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(\[Infinity]\)]\(Ex[
     t1] \[DifferentialD]t1\)\))/hbar]  *)

enter image description here

Have fun!

$\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.