MathGroup Archive 2006

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

Search the Archive

Re: mapping of function revisited


On 9/27/06 at 6:05 AM, dimmechan at yahoo.com wrote:

>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?

<snip>

>Is it possible to obtain the previous result more compactly?

Yes,

In[4]:=
exp1 /. {x -> Sin[x], z -> Sin[z]}

Out[4]=
Sin[x]^3 + (Sin[z] + 1)^2
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Defining Solve results as variable
  • Next by Date: Re: Defining Solve results as variable
  • Previous by thread: Re: Smarter way to calculate middle-right terms of continued fraction partial sums
  • Next by thread: Re: showing variables in plots?