Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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)]
share|improve this question
    
Simplify[Cos[t w - t z]] –  rm -rf Feb 3 '13 at 0:22

2 Answers 2

up vote 1 down vote accepted

You need to Map it:

Map[Factor, Cos[t w - t z]]

Or with infix notation:

Factor /@ Cos[t w - t z]
share|improve this answer
    
For more complicated expressions, 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]] –  VF1 Feb 3 '13 at 0:57
    
Thanks @VF1, that is the general question i was trying to address –  AimForClarity Feb 5 '13 at 2:17

You want to use Collect instead of Factor.

Cos[Collect[t w - t z, t]]

This gives:

Cos[t (w - z)]

Hope it helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.