HP Forums

Full Version: ln() vs. log()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Not a single equation, but here there is an exponential function and a logarithmic (in base 10) plot.

[attachment=3411]
I think Massimo gave the most meaningful reason for why it makes sense to have both (and even the lg logarithm to the base 2) in his short answer
Quote: Why 10^x and e^x then?
If it's reasonable to have 10^x, e^x and 2^x then, I guess, it's reasonable to have their inverse fuctions log, ln and lg, too ...
(04-17-2016 10:06 PM)Don Shepherd Wrote: [ -> ]Interestingly, the original Dartmouth BASIC had log() but it was really ln().

In Casio BASIC as implemented on their pocket computers there were two variants:

LN and LOG for the FX series (e. g. FX-850)
LOG and LGT for the newer PB series (e. g. PB-1000 but not the older PB-100)

I had a hard time writing my BASIC to WAV translators (CASette I/O Utilities) in a way to handle both variants correctly.
(04-24-2016 02:38 PM)Marcus von Cube Wrote: [ -> ]
(04-17-2016 10:06 PM)Don Shepherd Wrote: [ -> ]Interestingly, the original Dartmouth BASIC had log() but it was really ln().

In Casio BASIC as implemented on their pocket computers there were two variants:

LN and LOG for the FX series (e. g. FX-850)
LOG and LGT for the newer PB series (e. g. PB-1000 but not the older PB-100)

I never understood why there is no common unambigous declaration of the logarithm function(s). In most programming languages, "log" returns the natural logarithm ln(x) while on most calculators this is correctly called "ln". Here, "log" usually is the base-10 logarithm, i.e. lg(x). Excel is a special case: in a worksheet log is the base-10 logarithm, while in a VBA function it's ln(x). #-) As far as I can see the WP34s is the only calculator that uses correct designations: ln, lg, ld and finally logxy for a base-x logarithm.

(04-24-2016 02:38 PM)Marcus von Cube Wrote: [ -> ]I had a hard time writing my BASIC to WAV translators (CASette I/O Utilities) in a way to handle both variants correctly.

?!? – what exactly was the problem?

Dieter
(04-18-2016 01:37 AM)Tim Wessman Wrote: [ -> ]There's also the added wrinkle that in most CAS software packages use log(...) as base e and many don't have a base 10 variant.

I wonder whether there ought to be a "log10" function -(identical to log) which makes the code much more readable and avoids any worries that this "log" might have come from someone else's formula which assumed ln..


I remember when I first implemented some astronomical Software, astronomical text would often reference "log" without making clear which log was needed. Until I discovered .that almost always it would be log10 (if I recall correctly), some of my first attempts would call a LOGANY function, which could be quickly changed to call one log or the other until I saw the expected answer...
(04-17-2016 10:19 PM)Han Wrote: [ -> ]That is \( \ln(x) = \frac{\log(x)}{\log(10)} \) with log just being a conventional shortcut for \( \log_{10}\).

But then \(\log_{10}(10) = 1\) and thus:

\(
\begin{align}
\ln(x)
&= \frac{\log(x)}{\log(10)} \\
&= \frac{\log_{10}(x)}{\log_{10}(10)} \\
&= \frac{\log_{10}(x)}{1} \\
&= \log_{10}(x) \\
&= \log(x) \\
\end{align}
\)

Thus, you either meant:

\(
\ln(x) = \frac{\log(x)}{\log(e)}
\)

Or then:

\(
\log(x) = \frac{\ln(x)}{\ln(10)}
\)
Actually, Bel is the original unit and the power of signal S, measured in Bel is

log (S / Sref) [using base-10 log]

As this unit was not convenient enough, a smaller unit became more popular. It is the deci Bel, which is a tenth part of a Bel. Hence the symbol is dB, with a lower case d and an upper case B. As the unit is the tenth part of the Bel, a 10-times multiplier should be applied to the magnitude.

So the power of signal S, measured in dB is

10 log (S / Sref) [using base-10 log]

Bels and deciBels are intended to compare powerlike quantities. As the power of an electrical signal is related to the square of the voltage, V (or, for that matter, the square of the current, I), it is usually possible to state that the power of signal S, measured in dB is

20 log (V / Vref) or 20 log (I / Iref) [using base-10 log]

However, this is valid only if the voltage (or current) of the signal and the reference are measured over the same impedance value. Otherwise, these formulas cannot be used.

Please disregard any idiomatic or formatting mistake.

(04-18-2016 01:25 PM)Tugdual Wrote: [ -> ]Also decibel is
\[20*\log _{ 10 }{ (\frac { V }{ { V }_{ ref } } ) }\]

I also find it interesting because it tells me the # of digits you need to write a number in base 10.
"I never understood why there is no common unambiguous declaration of the logarithm function(s)"

Because base 10 logs don't exist to Mathematicians.

The HP71 uses LOG10 and LGT [That is a new one!] for base 10, and LOG and LN for base e.
Pages: 1 2
Reference URL's