Re: can Mathematica be useful for this?
- To: mathgroup at smc.vnet.net
- Subject: [mg56568] Re: can Mathematica be useful for this?
- From: Peter Pein <petsie at arcor.de>
- Date: Fri, 29 Apr 2005 03:20:26 -0400 (EDT)
- References: <718e40e89ee7126bf169d5585b776d5c@akikoz.net> <d4q24j$ojr$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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
Berlin