0

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?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

1 Answers1

1
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 *)

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198