Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Re: question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74953] Re: [mg74925] Re: question
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Thu, 12 Apr 2007 04:55:36 -0400 (EDT)
  • References: <evd3ku$5dd$1@smc.vnet.net> <200704110601.CAA02936@smc.vnet.net>

On 11 Apr 2007, at 15:01, Michael Weyrauch wrote:

> Hello,
>
>   well, I think your command
>
>> In[57]:=
>> FullSimplify[Log[x+1],ComplexityFunction\[Rule]
>> (Count[{#1},_Log,Infinity]&)]
>>
>
> fails, because Log[z] as implemented in Mathematica does not know
> the transformation rules back into Hypergeometric functions. If I  
> do it as
> follows under Mathematica 5.2 it  works without problems...
>
> Unprotect[Log];
>
> Simplify[Log[x + 1], ComplexityFunction ->
> (Count[{#1}, _Log, Infinity] & ),
> TransformationFunctions ->
> {Log[z_] := Hypergeometric2F1[1, 1, 2, -z + 1]*
> (z - 1)}]
>
> (*output*)
>
> x*Hypergeometric2F1[1, 1, 2, -x]
>
> Of course, I have to use Unprotect, since I am adding a rule to an  
> internal command.
>
> So, if for some reason I would like to "simplify" e.g. Log[x+1]^2  
> it works as exspected
>
> Simplify[Log[x + 1]^2, ComplexityFunction ->
> (Count[{#1}, _Log, Infinity] & ),
> TransformationFunctions ->
> {Log[z_] := Hypergeometric2F1[1, 1, 2, -z + 1]*
> (z - 1)}]
>
> (*output*)
>
> x^2*Hypergeometric2F1[1, 1, 2, -x]^2
>
> Therefore, I am not sure, if Andrzej Kozlowski is right here?
>
> Regards   Michael
>

I think I am ;-)

The reason why your code works is that by Unprotecting Log and then  
running Simplify with your new transformation function you have  
actually managed to modify the built-in definition of Log.

Observe that before modification:

In[1]:=
x*Hypergeometric2F1[1, 1, 2, -x]

Out[1]=
Log[x + 1]

But now let's run your code:

Unprotect[Log];

In[3]:=
Simplify[Log[x + 1]^2, ComplexityFunction ->
    (Count[{#1}, _Log, Infinity] & ),
   TransformationFunctions ->
    {Log[z_] := Hypergeometric2F1[1, 1, 2, -z + 1]*
       (z - 1)}]

Out[3]=
x^2*Hypergeometric2F1[1, 1, 2, -x]^2

It loks like you have achieved your purpose, but now try this:


Log[z]


(z - 1)*Hypergeometric2F1[1, 1, 2, 1 - z]

and, of course

x*Hypergeometric2F1[1, 1, 2, -x]


x*Hypergeometric2F1[1, 1, 2, -x]

Doesn't look like a very desirabe situation to me.

If one wants to restore the original behaviour of Log one needs to  
Clear it. But here is a nice puzzle (which I will leave to others to  
amuze themselves with  ;-))

The puzzle is that Log is still Protected even though we never used  
Protect only Unprotect:


Attributes[Log]

{Listable,NumericFunction,Protected,ReadProtected}

so we unprotect it again:

Unprotect[Log];

and then

Clear[Log]

restores the orignal behaviour:


Log[x]


Log[x]


x*Hypergeometric2F1[1, 1, 2, -x]

Log[x + 1]

Andrzej Kozlowski





  • References:
    • Re: question
      • From: "Michael Weyrauch" <michael.weyrauch@gmx.de>
  • Prev by Date: Re: Marking pivot elements in a matrix?
  • Next by Date: Fwd: ColorFunction help?
  • Previous by thread: Re: question
  • Next by thread: question