How do you use Factor so that it will factor expressions inside the arguments of some bigger expression.
For example
Factor[ Cos[t w - t z]]
gives
Cos[t w - t z]
but i would like it to give:
Cos[t(w - z)]
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityHow do you use Factor so that it will factor expressions inside the arguments of some bigger expression.
For example
Factor[ Cos[t w - t z]]
gives
Cos[t w - t z]
but i would like it to give:
Cos[t(w - z)]
You need to Map
it:
Map[Factor, Cos[t w - t z]]
Or with infix notation:
Factor /@ Cos[t w - t z]
MapAll
may prove useful, working on all levels: compare Factor //@ Cos[t w - t z + Sin[a x + a y]]
to Factor /@ Cos[t w - t z + Sin[a x + a y]]
$\endgroup$
You want to use Collect instead of Factor.
Cos[Collect[t w - t z, t]]
This gives:
Cos[t (w - z)]
Hope it helps.
Simplify[Cos[t w - t z]]
$\endgroup$