Re: Simplifying algebraic expr: howto?
- To: mathgroup@smc.vnet.net
- Subject: [mg11404] Re: Simplifying algebraic expr: howto?
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Sun, 8 Mar 1998 20:13:24 -0500
- References: <6dqqf0$rk0@smc.vnet.net>
Daniel G. Hyams wrote: > I have an expression (for example): > > u*(nx*u + ny*v) ---- (1) > > and a definition: > > theta = nx*u+ny*v > > How do I get mathematica to simplify the expression (1) such that it > returns: > > u*theta ? > Daniel, One way is In[1]:= u*(nx*u + ny*v)/.{nx*u+ny*v->theta} Out[1]= theta u You might want to accumulate several rules in a list myRules = {nx*u+ny*v->thet, ....} and use them all together expr/.myRules and even repeatedly expr//.myRules -- Allan Hayes Training and Consulting Leicester, UK hay@haystack.demon.co.uk http://www.haystack.demon.co.uk voice: +44 (0)116 271 4198 fax: +44 (0)116 271 8642