Re: Transformations in expressions

*To*: mathgroup at smc.vnet.net*Subject*: [mg91891] Re: Transformations in expressions*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Fri, 12 Sep 2008 05:25:47 -0400 (EDT)*Organization*: The Open University, Milton Keynes, UK*References*: <gaar3o$16q$1@smc.vnet.net>

Miguel wrote: > How can I to transform a specific expression to other by substitution > of a part of it. > > For example, I want to transform the expression Log[x^2+y^3]/ > Sin[x^2+y^3] in Log[z]/Sin[z] by substitution x^2+y^3 --> z. You could write a transformation rule ("->") and apply it thanks to the replacement operator ("/.") In[1]:= expr = Log[x^2 + y^3]/Sin[x^2 + y^3] ; expr /. x^2 + y^3 -> z Out[2]= Csc[z] Log[z] > And other question: Is the new expression dependent of z. I see it is, > but how can I to programar it. In[3]:= f[z_] = Log[x^2 + y^3]/Sin[x^2 + y^3] /. x^2 + y^3 -> z f[2] % // N Out[3]= Csc[z] Log[z] Out[4]= Csc[2] Log[2] Out[5]= 0.762289 You should have a look at tutorial/DefiningFunctions http://reference.wolfram.com/mathematica/tutorial/DefiningFunctions.html Regards, -- Jean-Marc