Re: Log[x]//TraditionalForm
- To: mathgroup at smc.vnet.net
- Subject: [mg96086] Re: Log[x]//TraditionalForm
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 4 Feb 2009 05:22:23 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <gm99vi$9d$1@smc.vnet.net>
In article <gm99vi$9d$1 at smc.vnet.net>, "slawek" <human at site.pl> wrote:
> The natural logarithm function in "traditional form" in Mathematica (version
> 6.0.2.0)
>
> Log[x]//TraditionalForm
> log(x)
>
> This is "not a bug but a feature", but in mathematics the natural logarithm
> is just ln(x) or even ln x.
> The true traditional notation use log for decimal logarithm, ln for natural
> logarithm, lb for binary logarithm, and
> log_{b}x for logarithm with base b. Unfortunatelly in most computer
> programs (see FORTRAN) LOG
> stands for natural logarithm (an exception is Pascal).
>
> Nevertheless, how to force to use ln(x) instead log(x) ?
>
> The brute way is use /.Log->ln//TraditionalForm.
>
> Is any more elegant way to do this?
Hi Slavek,
One can change or define the format of built-in and user-defined
function thanks to the function Format[]. (See
http://reference.wolfram.com/mathematica/ref/Format.html for more info.)
For instance,
In[1]:=
Unprotect[Log];
Format[Log[x_], TraditionalForm] := ln[x]
Protect[Log];
Log[x] // TraditionalForm
Out[4]//TraditionalForm=
ln(x)
(Note that one may have to use Unprotect[], especially for built-in
functions).
Regards,
--Jean-Marc