MathGroup Archive 2007

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

Search the Archive

Re: something funny

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78763] Re: something funny
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Mon, 9 Jul 2007 01:31:40 -0400 (EDT)
  • References: <824006.27968.qm@web43137.mail.sp1.yahoo.com>

            Andrzej Kozlowski       :
> On 7 Jul 2007, at 04:18, dimitris anagnostou wrote:
>
> > The version is 5.2.
> >
> > Say
> >
> > In[125]:=
> > o = 1/(2*e^z - e^z)
> >
> > Out[125]=
> > e^(-z)
> >
> > Then
> >
> > In[126]:=
> > o = (1/(2*e^z - e^z) /. e -> #1 & ) /@ Range[2, 10]
> >
> > Out[126]=
> > {2^(-z), 3^(-z), 4^(-z), 5^(-z), 6^(-z), 7^(-z), 8^(-z), 9^(-z), 10^(-
> > z)}
> >
> > However,
> >
> > In[128]:=
> > FullSimplify[(1/(2*#1^z - #1^z) & ) /@ Range[10]]
> >
> > Out[128]=
> > {1, 2^(-z), 3^(-z), 1/(2^(1 + 2*z) - 4^z), 5^(-z), 1/(2^(1 + z)*3^z -
> > 6^z), 7^(-z), 1/(2^(1 + 3*z) - 8^z), 9^(-z),
> >   1/(2^(1 + z)*5^z - 10^z)}
> >
> > No matter what I tried I could not simplify the expressions with even
> > base of z above.
> > Any ideas?
> >
> > My query becomes bigger considering that as I was informed even in
> > version 6 we get
> >
> > FullSimplify[(1/(2*#1^z - #1^z) & ) /@ Range[10]]
> >
> > {1, 2^(-z), 3^(-z), 4^(-z), 5^(-z), 1/(2^(1 + z)*3^z - 6^z),
> > 7^(-z), 8^(-z), 9^(-z), 1/(2^(1 + z)*5^z - 10^z)}
> >
> > What it is so exotic I can't figure out. It is so trivial!
>
> It is quite easy to see why this happens. Consider simply:
>
> 2*6^z
> 2^(z + 1) 3^z
>
> This automatic grouping is performed at the Evaluator level. This
> combined with the fact that the Evaluator automatically transforms
>
>   2^z*3^z
>   6^z
>
> is the reason why FullSimplify cannot simplify this expression:
>
> FullSimplify[2*6^z - 6^z]
> 2^(z + 1)*3^z - 6^z
>
> Automatic evaluation prevents the first summand form being converted
> to 2*6^z  and the second summand to 2^z*3^z, both of which would lead
> to the desired simplification.
>
> What happened is that the first term was transformed before the
> evaluator noticed that it is twice the second term, and now it is too
> late. On the other hand these have no problem:
>
>   2*5^z - 5^z
>   5^z
>
> 2*15^z - 15^z
> 15^z
>
>
> In the first case there was just one factor (5 is prime), in the
> second case there are 2 (15=5*3) but none of them is 2, so not
> problematic grouping takes place. An interesting case is:
>
> 2*8^z - 8^z
> 2^(3*z + 1) - 8^z
>
> but this time this can be dealt with by FullSimplify because both
> summands are powers of the same number (2):
>
> FullSimplify[%]
> 8^z
>
> All this seems trivial to humans but is by no means so to computer
> programs!
>
> This and a few other similar problems in Mathematica are caused by
> simplifications performed automatically by the evaluator. Such
> transformations cannot be undone by Simplify - or rather, they can be
> "undone" but the evaluator immediately applies them again. I believe
> the reason why the Mathematica evaluator performs such automatic
> simplifications must be to do with performance. I think "evaluation"
> is very much faster than "Simplification" so  making the Evaluator do
> more has a positive effect on Mathematica's performance (I have not
> ever tried testing this but I am almost sure). Other programs use a
> different approach - and in this particular case if a program does
> not perform this particular automatic transformation it will not fall
> into this "trap". But I would expect the overall performance of such
> "lazy" evaluators to be worse than that of Mathematica.
>
> Now, what can be done about this? There are several tricks one could
> try. One could try to use suitable transformations with HoldForm,
> that would put everything into some suitable form, but it seems
> simpler to use something like this:
>
> f[expr_, z_] :=
>   Block[{w}, PowerExpand[FullSimplify[expr /. z -> Log[w]] /. w -> Exp
> [z]]]
>
> Here we temporarily replace the exponent z by Log[w], FullSimplify,
> then replace w by Exp[z] and PowerExpand. The use of PowerExpand
> should not normally cause trouble in cases like the above one (where
> we already know that the transformation we want to perform is valid
> for all z). With this f we get:
>
> f[2*6^z - 6^z, z]
> 6^z
>
> f[2*10^z - 10^z, z]
> 10^z
>
> etc.
>
> Andrzej Kozlowski
>
>
>
>
>
> >
> > In[140]:=
> > FullSimplify[1/(2^(1 + 2*z) - 4^z) == 1/(2*4^z - 4^z)]
> >
> > Out[140]=
> > True
> >
> > In another CAS I took
> >
> > convert("(1/(2*#1^z - #1^z) & ) /@ Range[10]",FromMma);value(%);
> >
> >                          1
> >             map(unapply(----, _Z1), [seq(i, i = 1 .. 10)])
> >                            z
> >                         _Z1
> >
> >
> >             1     1     1     1     1     1     1     1     1
> >        [1, ----, ----, ----, ----, ----, ----, ----, ----, ---]
> >              z     z     z     z     z     z     z     z     z
> >             2     3     4     5     6     7     8     9    10
> >
> >
> > Dimitris
> >
> > Choose the right car based on your needs. Check out Yahoo! Autos
> > new Car Finder tool.

Thanks a lot!

Dimitris



  • Prev by Date: Re: Re: something funny!
  • Next by Date: Re: how to simplify n write in mathtype
  • Previous by thread: Re: something funny
  • Next by thread: the FontType option