MathGroup Archive 2007

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

Search the Archive

Re: FullSimplify with Pi

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84146] Re: FullSimplify with Pi
  • From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
  • Date: Tue, 11 Dec 2007 15:29:19 -0500 (EST)
  • References: <200712110320.WAA26066@smc.vnet.net> <fjlrie$9ot$1@smc.vnet.net>

Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:
> On 11 Dec 2007, at 12:20, Uberkermit wrote:
>
> > Greetings,
> >
> > I would like to simplify an expression involving Pi. Actually,
> > simplifying the expression isn't hard, getting Mathematica to
> > recognize the simplification is the hard part. Consider:
> >
> > Assuming[Element[x, Reals],
> >  FullSimplify[Log[1/Sqrt[2 Pi] Exp[x]]]]
> >
> > Mathematica doesn't do anything to simplify this. However, replacing
> > the symbol Pi with any other variable in the above leads to the
> > trivial substitutions.
> >
> > By trivial, I mean:
> > Log[Exp[x]] = x, and Log[a/b] = Log[a] - Log[b].
> >
> > Why does Pi confuse Mathematica so??
> >
> > Thanks,
> > -Chris
> >
>
> Well, how to put it, everything is the other way round. According to
> Mathematica's default ComplexityFunction (which is very close to
> LeafCount) the expression that you get when you use Pi is simpler:
>
> p = Assuming[Element[x, Reals],
>     FullSimplify[Log[E^x/Sqrt[2*a]]]]
> x - Log[a]/2 - Log[2]/2
>
> q = Assuming[Element[x, Reals],
>     Simplify[Log[E^x/Sqrt[2*Pi]]]]
>
> x - (1/2)*Log[2*Pi]

[snip]

It seems that neither you nor Carl understood the point Chris was making.
Your last output above is what I think Chris _wanted_. Note that he said
"Assuming[Element[x, Reals], FullSimplify[Log[1/Sqrt[2 Pi] Exp[x]]]]

Mathematica doesn't do anything to simplify this." So I must assume that
you and Carl are using version 6 while Chris is using some prior version.

In version 5.2, what Chris said is certainly true:

In[1]:= Assuming[Element[x, Reals],
FullSimplify[Log[(1/Sqrt[2*Pi])*Exp[x]]]]

Out[1]= Log[E^x/Sqrt[2*Pi]]

that is, virtually no simplification occurred. Contrast that with the
simplification obtained in version 5.2 when we use a variable rather than
Pi:

In[7]:= FullSimplify[Log[(1/Sqrt[2*a])*Exp[x]], Element[x, Reals]]

Out[7]= x - Log[2]/2 - Log[a]/2

And from that, we can then get the result which I suppose Chris wanted:

In[8]:= % /. a -> Pi

Out[8]= x - Log[2]/2 - Log[Pi]/2

In[9]:= FulSimplify[%]

Out[9]= x - (1/2)*Log[2*Pi]

So there are two morals to this story.
1)  There are improvements in version 6.
2)  Posters to this newsgroup who are using a previous version should
normally give an indication of that in their post.

David


  • Prev by Date: Re: Vieta infinite product formula
  • Next by Date: Re: how to speed up lenghty formulas??
  • Previous by thread: Re: FullSimplify with Pi
  • Next by thread: Re: FullSimplify with Pi