MathGroup Archive 2005

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

Search the Archive

Re: can Mathematica be useful for this?

  • To: mathgroup at
  • Subject: [mg56568] Re: can Mathematica be useful for this?
  • From: Peter Pein <petsie at>
  • Date: Fri, 29 Apr 2005 03:20:26 -0400 (EDT)
  • References: <> <d4q24j$ojr$>
  • Sender: owner-wri-mathgroup at

Pedrito wrote:
> Thanks a lot Andrzej.   Your idea of using Mathematica for the logic
> algebra simplifications is great.
> I have found a case where FullSimplify doesn't evaluate numerically: 
> FullSimplify[p[F], p[F] == 1/10]
> -->p[F]
> So I have to write:
> FullSimplify[p[F]+0., p[F] == 1/10]
> 0.1
> Is there another way for obtaining a numeric result with FullSimplify?
> Thanks in advance!
Hi Pedrito,

Mathematica in general considers expressions with a smaller LeafCount
(see docs) to me simpler. Now have a look at the following:

In[1]:= {TreeForm[p[f]],LeafCount[p[F]]}
Out[1]= {p[f],2}
In[2]:= {TreeForm[1/10],LeafCount[1/10]}
Out[2]= {Rational[1,10],3}

For Mathematica, 1/10 is 50% more complicated than p[F].

I'm not sure which of the following you had in mind:

In[3]:= {p[F]/.p[F]->1/10,N[1/10],1./10}
Out[3]= {1/10, 0.1`, 0.1`}

As you can see, Reals are considered even simpler:

In[4]:= FullSimplify[p[F],p[F]==.1]
Out[4]= 0.1

This is because

In[5]:= LeafCount[.1]
Out[5]= 1

You can read about this in the help ("ComplexityFunction").

Peter Pein

  • Prev by Date: Re: arrange lists side by side
  • Next by Date: Re: Programming
  • Previous by thread: can Mathematica be useful for this?
  • Next by thread: Re: can Mathematica be useful for this?