MathGroup Archive 2002

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

Search the Archive

Re: FullSimplify and FunctionExpand

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37879] Re: [mg37867] FullSimplify and FunctionExpand
  • From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
  • Date: Sat, 16 Nov 2002 01:15:49 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On Friday, November 15, 2002, at 03:36 PM, Nevin Kapur wrote:

> I am a bit perplexed by the following behavior of Mathematica:
>
> ( 6:22PM) bombay[~]% math
> Mathematica 4.2 for Linux
> Copyright 1988-2002 Wolfram Research, Inc.
>  -- Motif graphics initialized --
>
> In[1]:= Gamma'[1/2]
>
>                               1
> Out[1]= Sqrt[Pi] PolyGamma[0, -]
>                               2
>
> In[2]:= FullSimplify[%]
>
>                               1
> Out[2]= Sqrt[Pi] PolyGamma[0, -]
>                               2
>
> In[3]:= FunctionExpand[%]
>
> Out[3]= Sqrt[Pi] (-EulerGamma - Log[4])
>
> According to the FunctionExpand help, it is automatically called by
> FullSimplify.  Why am I not getting Out[3] after the FullSimplify?
> Certainly it is "simpler" than Out[2].
>
> -Nevin
>
>
>

Not according to Matheamtica's default meaning of "simpler":

In[1]:=
v = Derivative[1][Gamma][1/2]

Out[1]=
Sqrt[Pi]*PolyGamma[0, 1/2]

In[2]:=
FullSimplify[v]

Out[2]=
Sqrt[Pi]*PolyGamma[0, 1/2]

In[3]:=
LeafCount[%]

Out[3]=
11

In[4]:=
FunctionExpand[v]

Out[4]=
Sqrt[Pi]*(-EulerGamma - Log[4])

In[5]:=
LeafCount[%]

Out[5]=
14

If you replace Leaf count by Depth and other usual measures of 
complexity still the first answer comes out as simpler. Here is one 
possible way to force the second to be regarded as simpler:

In[9]:=
FullSimplify[v, ComplexityFunction ->
    (StringLength[ToString[#1]] & )]

Out[9]=
Sqrt[Pi]*(-EulerGamma - Log[4])


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



  • Prev by Date: Re: Why is importing the table into Mathematica so slow???
  • Next by Date: RE: SsssComplement?
  • Previous by thread: Re: FullSimplify and FunctionExpand
  • Next by thread: Random number Newbie Question