Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Re: Automatic expansion of Log[a^n] for a,n explicit positive integers?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28234] Re: [mg28229] Re: [mg28180] Automatic expansion of Log[a^n] for a,n explicit positive integers?
  • From: Mianlai Zhou <lailai at carmen.nikhef.nl>
  • Date: Fri, 6 Apr 2001 01:52:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

If you want to avoid defining another function lg, of course you can also
use the following code:

Unprotect[Log]
Log[n_?EvenQ /; n>2] := Log[n/2] + Log[2]
Protect[Log]

Then all the stuff like Log[2], Log[6], Log[8], Log[12] etc. will be
extracted of the factor 2 automatically.

Good luck.

M Zhou
NIKHEF, Amsterdam

On Thu, 5 Apr 2001, Tomas Garza wrote:

> If you are only concerned about powers of 2, then you may define the
> functiion lg and use it always instead of Log:
>
> In[1]:=
> lg[n_] := If[Mod[n, 2] == 0, IntegerExponent[n, 2]*Log[2], Log[n]]
>
> Then, e.g.,
>
> In[1]:=
> {lg[2], lg[4], lg[8], lg[16], lg[32], lg[3]}
> Out[1]=
> {Log[2], 2 Log[2], 3 Log[2], 4 Log[2], 5 Log[2], Log[3]}
>
> Tomas Garza
> Mexico City
> ----- Original Message -----
> From: "Harald Anlauf" <anlauf at hep.tu-darmstadt.de>
To: mathgroup at smc.vnet.net
> To: mathgroup at smc.vnet.net
> Subject: [mg28234] [mg28229] [mg28180] Automatic expansion of Log[a^n] for a,n explicit positive
> integers?
>
>
> > Hi,
> >
> > is there a way to force Mathematica 4.0 to always expand expressions like
> >
> > Log[4], Log[8], Log[16], etc. to 2*Log[2] etc.
> >
> > automatically?
> >
> > It is very annoying to have such logarithms expanded manually each
> > time they pop up again...
> >
> > PowerExpand[] apparently does not help/work.
> >
> > --
> > Ciao,
> > -ha
> >
>
>




  • Prev by Date: Re: complex coefficients and rules...
  • Next by Date: Re: Re: Automatic expansion of Log[a^n] for a,n explicit positive integers?
  • Previous by thread: Re: Re: Automatic expansion of Log[a^n] for a,n explicit positive integers?
  • Next by thread: Re: Re: Automatic expansion of Log[a^n] for a,n explicit positive integers?