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

Re: mapping of function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69949] Re: [mg69914] mapping of function
  • From: Adriano Pascoletti <pascolet at dimi.uniud.it>
  • Date: Thu, 28 Sep 2006 06:15:01 -0400 (EDT)
  • References: <200609271005.GAA00190@smc.vnet.net>

Dimitris,
why not use replacement rules?

In[4]:=
exp1 /. {a:(x | z) :> Sin[a]}

Out[4]=
Sin[x]^3 + (1 + Sin[z])^2

Adriano Pascoletti

On 27 set 2006, at 12:05, dimmechan at yahoo.com wrote:

> Hello.
>
> I am working on John Gray's Book Mastering Mathematica.
>
> Here is one simple expression.
>
> exp1 = x^3 + (1 + z)^2
> x^3 + (1 + z)^2
>
> I am thinking of ways to map the sine function only to {x,z}.
> Here are some alternatives I considered.
>
> MapAt[Sin, exp1, Flatten[(Position[exp1, #1] & ) /@ Variables[exp1],
> 1]]
> Sin[x]^3 + (1 + Sin[z])^2
>
> MapAt[Sin, exp1, Position[exp1, _Symbol, Heads -> False]]
> Sin[x]^3 + (1 + Sin[z])^2
>
> Are there any other possibilities?
>
> Thanks for any response.
>


  • Prev by Date: Re: Re: Re: [TS 22578]--Re:does anyone have an ant task for mathematica?
  • Next by Date: Re: mapping of function
  • Previous by thread: Re: mapping of function
  • Next by thread: Re: mapping of function