MathGroup Archive 2003

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

Search the Archive

Re: Simplify doesn't factor out 16 :-(

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43599] Re: [mg43586] Simplify doesn't factor out 16 :-(
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Tue, 23 Sep 2003 04:01:43 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

As you can imagine there is no "objective" criterion of what makes on 
expression simpler than another. WHen you use Simplify this is 
determined by the setting for the option ComplexityFunction. The 
default setting is Automatic, which is a bit mysterious since we 
(users) do not know exactly  what it is. Often it coincides with 
LeafCount but not in this case:


Simplify[-4*(16+4*L^2*(-1+3*u^2))]


-4*(16 + 4*L^2*(-1 + 3*u^2))

LeafCount[%]

16

Simplify[-4*(16+4*L^2*(-1+3*u^2)),ComplexityFunction->LeafCount]


-64 + L^2*(16 - 48*u^2)


LeafCount[%]


13


You can get the expression with 16 factored out by setting 
ComplexityFunction to Length:


Simplify[-4*(16+4*L^2*(-1+3*u^2)),ComplexityFunction->Length]


-16*(4 + L^2*(-1 + 3*u^2))


The LeafCount is better than with the default (Automatic) setting but 
worse than with the LeafCount setting:


LeafCount[%]


15

Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/


On Monday, September 22, 2003, at 04:14 PM, Pavel Pokorny wrote:

>   Dear Mathematica friends
>
> I can't understand why Simplify in Mathematica 5.0 doesn't factor out 
> 16
> in this expression
>
> In[1]:= Simplify[-4*(16 + 4*L^2*(-1 + 3*u^2))]
>
>                     2          2
> Out[1]= -4 (16 + 4 L  (-1 + 3 u ))
>
>
> only after using Expand
>
>
> In[2]:= Expand[%]//Simplify
>
>                   2         2
> Out[2]= 16 (-4 + L  (1 - 3 u ))
>
> Is it a bug or an intention?
>
> Pavel Pokorny
>
>
>


  • Prev by Date: how import data to mathematica????
  • Next by Date: Re: package functions in mathlink
  • Previous by thread: Simplify doesn't factor out 16 :-(
  • Next by thread: Solve real roots only ?