MathGroup Archive 1993

[Date Index] [Thread Index] [Author Index]

Search the Archive

MapAt complaint

  • To: mathgroup at
  • Subject: MapAt complaint
  • From: wmm at (Martin McClain)
  • Date: Fri, 5 Nov 93 14:46:43 EST

Dear MathGroupers:
        I am a fairly experienced Mma user, but quite frequently I cannot
get MapAt to do what I want.  My question:  Am I missing something obvious,
or does MapAt really need to be extended?  Here is the latest example:

I want to go from   expr1 = 1+Sin[a+b]+Sin[a-b]

to                  expr2 = 1 + 2 Cos[a] Sin[b].  

Simplify or Factor[#,Trig->True]& does this if applied to parts 2 and 3 of
expr1, but it gets discouraged and does nothing if applied to the whole
thing.  So alternatively, I would like to use  MapAt to make Simplify work
on parts 2 and 3 together.  But I can't find any one-line way to do this. 
If you try


it seems to try the two parts separately, producing no change.  If you try


it thinks you mean MapAt[Simplify,expr1,{2,3}] and complains that there is
no part {2,3}.  Of course, it can always be done by extracting,
Simplifying, and replacing, but I am looking for an easy one liner.  Any

Thanks-  Martin McClain, Chem Dept, Wayne State University, Detroit

  • Prev by Date: operators
  • Next by Date: Accuracy of linear fit
  • Previous by thread: Re: operators
  • Next by thread: MapAt complaint