0
$\begingroup$

I am totally new to Mathematica, so if this is a simple googleable question, I am sorry

I have this expression: $\left(e^{i \text{p1} x}-e^{-i \text{p1} x}\right) \left(e^{i \text{p2} x}-e^{-i \text{p2} x}\right) \left(e^{i \text{p3} x}-e^{-i \text{p3} x}\right) \left(e^{i \text{p4} x}-e^{-i \text{p4} x}\right) $

 (Exp[I*p1 *x] - Exp[-I*p1 *x]) (Exp[I*p2 *x] - Exp[-I*p2 *x]) (Exp[I*p3 *x] - Exp[-I*p3 *x]) (Exp[I*p4 *x] - Exp[-I*p4 *x])

I want to see it as a sum of $e^{iax}$ terms. Expand does that, but it gives: enter image description here which could be further simplified as you can see by looking at it. How do I change these terms with minus signs(for eg, $p1-p2+p3-p4$) in the exponential and hence shorter?

$\endgroup$
3
  • $\begingroup$ Take a look at What's the correct method to simplify exponentials? $\endgroup$
    – Artes
    Commented Jan 28, 2021 at 17:16
  • $\begingroup$ Did you try FullSimplify? $\endgroup$
    – geom
    Commented Jan 28, 2021 at 17:16
  • $\begingroup$ With Expand you get $e^{-i p_1 x-i p_2 x-i p_3 x-i p_4 x}-e^{i p_1 x-i p_2 x-i p_3 x-i p_4 x}-\cdots-e^{-i p_1 x+i p_2 x+i p_3 x+i p_4 x}+e^{i p_1 x+i p_2 x+i p_3 x+i p_4 x}$. With FullSimplify you get $16 \sin \left(p_1 x\right) \sin \left(p_2 x\right) \sin \left(p_3 x\right) \sin \left(p_4 x\right)$. $\endgroup$ Commented Jan 28, 2021 at 17:19

1 Answer 1

1
$\begingroup$
Clear["Global`*"]

Format[p[n_]] := Subscript[p, n]

expr[n_Integer?Positive] := 
 Product[Exp[I*p[k]*x] - Exp[-I*p[k]*x], {k, 1, n}] 

expr[4] // FullSimplify

enter image description here

expr[4] // ComplexExpand

enter image description here

(expr[4] // Expand) /. E^x_ :> E^(Simplify[x])

enter image description here

Or,

% === Map[Simplify, expr[4] // Expand, {2}]

(* True *)
$\endgroup$
1
  • $\begingroup$ Thanks! I was looking for the last part of your answer. $\endgroup$ Commented Jan 28, 2021 at 18:37

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.