Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Adding new rules to Simplify

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56379] Re: [mg56341] Re: Adding new rules to Simplify
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sat, 23 Apr 2005 01:16:11 -0400 (EDT)
  • References: <27457333.1114080708731.JavaMail.jakarta@nitrogen.mathforum.org> <200504221023.GAA18791@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 22 Apr 2005, at 19:23, John Billingham wrote:

> Here's another one!
>
> r1[x_ /; ! FreeQ[x, f]] := x /. f[y_] -> a[y]/b[y];
> r1[x_] := x;
>
> r2[x_ /; ! FreeQ[x, g]] := x /. g[y_] -> b[y]/a[y];
> r2[x_] := x;
>
> Simplify[f[X] g[X], TransformationFunctions -> {r1, r2}]
>
> gives
>
> f(X) g(X)
>
>
> I would have hoped to get 1 here, particularly since
>
> r1[r2[f[X]g[X]]]
>
> gives me 1 as expected!
>
> So I tell it to Simplify using just two rules, the successive 
> application of which gives 1, but Mathematica fails to simplify at 
> all.
>
> What's going on here??
>
> John
>
>

Again, it won't work without a suitable complexity function:

In[5]:=
Simplify[f[X] g[X], TransformationFunctions -> {r1, \
r2},ComplexityFunction->(Count[#,f[_]|g[_],Infinity]&)]

Out[5]=
1

What happens is that whenever Simplify performs just one of the 
transformations the default complexity actually increases, so the 
transformation is abandoned. You need to apply both transformations 
before the default complexity goes down but Simplify never gets that 
far. So this is why you need to carefully choose the ComplexityFunction 
as well as TransformationFunctions.


Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/andrzej/index.html
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Re: Can I make permanent font settings in Mathematica 5
  • Next by Date: Re: symbolic matrix calculation doesn't work
  • Previous by thread: Re: Adding new rules to Simplify
  • Next by thread: Adding new rules to Simplify