Re: mapping of function
- To: mathgroup at smc.vnet.net
- Subject: [mg69945] Re: mapping of function
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 28 Sep 2006 06:14:43 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <efdjnn$ms$1@smc.vnet.net>
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. > exp1 = x^3 + (1 + z)^2; exp1 /. {x -> Sin[x], z -> Sin[z]} --> Sin[x]^3 + (1 + Sin[z])^2 Regards, Jean-Marc