Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

mapping of function revisited

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69923] mapping of function revisited
  • From: dimmechan at yahoo.com
  • Date: Wed, 27 Sep 2006 06:05:33 -0400 (EDT)

Searching a little more I found one more alternative

exp1 = x^3 + (1 + z)^2;

MapAt[Sin, exp1, Flatten[(Position[exp1, #1] & ) /@ Cases[exp1, _?(
!NumberQ[#1] & ), {-1}], 1]]
Sin[x]^3 + (1 + Sin[z])^2

Are there any other alternatives? Especially with proper pattern
matching?

Thinking a little harder I consider the following pure function

g = TrueQ[First[ToCharacterCode[ToString[p]]] <
First[ToCharacterCode[ToString[#1]]] <
First[ToCharacterCode[ToString[z]]]] & ;

Then

MapAt[Sin, exp1, Flatten[(Position[exp1, #1] & ) /@ Cases[exp1, _?(
!NumberQ[#1] && g[#1] & ), {-1}], 1]]
(1 + z)^2 + Sin[x]^3

Is it possible to obtain the previous result more compactly?

Thanks


  • Prev by Date: RE: How to remove just the outermost braces of a list?
  • Next by Date: Re: Mapping Functions That Take More Than One Argument
  • Previous by thread: Program to calculate division of continued fractions
  • Next by thread: Re: mapping of function revisited