MathGroup Archive 2009

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

Search the Archive

Re: Simplify

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98705] Re: [mg98659] Simplify
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Thu, 16 Apr 2009 04:18:30 -0400 (EDT)
  • References: <200904150902.FAA08151@smc.vnet.net>

Hi Daniel,

One reason may be the following:

In[1] = Hold[x^2/y^2]//FullForm

Out[1] = Hold[Times[Power[x, 2], Power[Power[y, 2], -1]]]

In[2] = x^2/y^2 // FullForm

Out[2] = Times[Power[x, 2], Power[y, -2]]

The LeafCount of the latter is then 7, not 10.

However, there seems to be more to it, since it looks like
there is a built-in rule, so that even if you type (x/y)^2, it will
be immediately rewritten as x^2/y^2 (or, (a*b)^c->a^c*b^c, etc):

In[3] = (x/y)^2

Out[3] = x^2/y^2

In[4] = Block[{Power}, Hold[Evaluate[((x/y)^2)]]]

Out[4] = Hold[(x/y)^2]

This probably means that even if LeafCount would indeed be larger, there
would be no chance to get the final result unless you either somehow
block this specific rule, or get inside Simplify  and intercept some
intermediate result.

Regards,
Leonid



On Wed, Apr 15, 2009 at 2:02 AM, dh <dh at metrohm.com> wrote:

>
>
> Hi,
>
> can somebody explain, why
>
> Simplify[x^2/y^2,ComplexityFunction->LeafCount]
>
> does not simplify to (x/y)^2, although the LeafCount is:
>
> LeafCount[Hold[x^2/y^2]] gives 10
>
> and
>
> LeafCount[Hold[(x/y)^2]] gives 8
>
>
>
> Daniel
>
>
>
>


  • References:
  • Prev by Date: Re: hyperlink problem in a ActionMenu
  • Next by Date: Re: About Reduce and domains
  • Previous by thread: Simplify
  • Next by thread: Re: Simplify