Re: help on Rewrite rules

• To: mathgroup at smc.vnet.net
• Subject: [mg50897] Re: help on Rewrite rules
• From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
• Date: Sun, 26 Sep 2004 05:32:19 -0400 (EDT)
• References: <cj320m\$53t\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Here is how you do it:

r = y^2 -> 1 - x^2;

Simplify[3*x^2 + 2*y^2 /. r]

2 + x^2

Simplify[(x^2 + y^2)^(1/2) /. r]

1

Your more general case gets rid of only the y^2 that lead to a
simplification. You need to use the TransformationFunctions option of
Simplify to do this sort of thing. I have defined a transformation function
f below to deal with cases slightly more general than your own (i.e. it uses
a pattern that matches expressions of the form f[a+ b y^2]).

f[(a_) + ((b_.)*1)*y^2] := a + b*(1 - x^2);

Simplify[A[x^2] + B[y^2] + C[x^2 + y^2], TransformationFunctions -> f]

A[x^2] + B[y^2] + C[1]

Steve Luttrell

"Jon Palmer" <Jonathan.palmer at new.ox.ac.uk> wrote in message
news:cj320m\$53t\$1 at smc.vnet.net...
>I am having trouble simplifying expressions in mathematica. My epxerissions
> involve two parameters x & y that parameterise a unit circle so that
>
> x^2 + y^2 =1
>
> Without chosing a particular parameterization for x and y I want to
> simplify
> epxpertions of the form:
>
>
> 3x^2 + 2y^2               -----> 2 + x^2
> or
> (x^2 + y^2)^(1/2)        -----> 1
>
> and more importantly for should perform the simplification
>
> A[x^2] + B [y^2] + C[x^2+y^2]    -----> A[ x^2] + B[ y^2] + C[1]
>
> where A,B&C are functions.
>
> I assume that this can me achieved with a relatively simple rewrite rule
> but
> I have had very limited success making this work. Can anyone suggest a
> solution,
>
> Many thanks
> Jon Palmer
>
> P.S. I also want to expand the problem to that of three variables x,y&z
> parameterizing a unit sphere but I suspect that this will be obvious form
> the solution of the unit circle problem.
>
>
>

```

• Prev by Date: Re: help on Rewrite rules
• Next by Date: Re: Re: trimming a string
• Previous by thread: Re: help on Rewrite rules
• Next by thread: Re: help on Rewrite rules