       Re: Simplify

• To: mathgroup at smc.vnet.net
• Subject: [mg98683] Re: Simplify
• From: Szabolcs <szhorvat at gmail.com>
• Date: Thu, 16 Apr 2009 04:14:29 -0400 (EDT)
• References: <gs47pv\$7tv\$1@smc.vnet.net>

```On Apr 15, 12:01 pm, dh <d... 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
>

Hello Daniel,

There are two reasons.  First, try this:

In:= FullForm[Hold[x^2/y^2]]
Out//FullForm= Hold[Times[Power[x,2],Power[Power[y,2],-1]]]

In:= FullForm[x^2/y^2]
Out//FullForm= Times[Power[x,2],Power[y,-2]]

Second, (x/y)^2 autoevaluates to x^2/y^2, so no function can return (x/
y)^2 without some kind of Hold-wrapper.

The LeafCounts of the different forms are

In:= LeafCount[Unevaluated[x^2/y^2]]
Out= 9

In:= LeafCount[x^2/y^2]
Out= 7

In:= LeafCount[Unevaluated[(x/y)^2]]
Out= 7

```

• Prev by Date: Re: Plotting a x,y,z function
• Next by Date: problem with replace all and functions
• Previous by thread: Re: Simplify
• Next by thread: Re: Simplify