Something simple: I'd like TrigExpand[Sin[3n-3]] to return Sin[3n]Cos[3]-Cos[3n]Sin[3] instead of -Cos[n]^3 Sin[3]+3 Cos[3] Cos[n]^2 Sin[n]+3 Cos[n] Sin[3] Sin[n]^2-Cos[3] Sin[n]^3.

Is there a way to get Mathematica to expand the addition/sum without expanding the multiplier(s)?

(The reason: I'm working with Fourier series and I want to be able to see things as combinations of Sin[a n] and Cos[a n].)

  • 2
    $\begingroup$ expLmtd[exp_, var_] := Module[{k}, TrigExpand[exp /. Times[s_, var] :> k[s, var]] /. k :> Times]; expLmtd[Sin[3 n - 3], n] $\endgroup$ – Dr. belisarius Oct 13 '15 at 19:40
  • 2
    $\begingroup$ @belisariusisforth why not answer it with that? Looks like a nice approach to me. $\endgroup$ – Sjoerd C. de Vries Oct 13 '15 at 19:51
expLmtd[exp_, var_] := Block[{k = Unique[]}, 
                       TrigExpand[exp /. Times[s_, var] :> k[s, var]] /.  k :> Times]
expLmtd[Sin[3 n - 3], n]

(* -Cos[3 n] Sin[3] + Cos[3] Sin[3 n] *)
| improve this answer | |

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.