I did a small test with 5000 times LOG(X)/LOG(B) against LN(X)/LN(B). With LOG it was 17.6 seconds and with LN it was 18.05 seconds. Wondering why, I did the test without the division. There the LN version was 14.2 seconds and the LOG version 14.85 seconds. So, Thomas, the faster division compensates for the slower LOG and makes the LOG version slightly faster .
LOG bases
Re: LOG bases

 Posts: 715
 Joined: Wed May 03, 2017 7:46 pm
 Location: Malone, NY USA
Re: LOG bases
If you're coming from an ANSI/ISO BASIC world, it's even more confusing. In standard BASIC, LOG is LOGe, LOG2 is LB and LOG10 is LG. In many BASICs, LN is LOGe and there is no other base.Walter wrote: ↑Sat Mar 20, 2021 11:13 amBecause LN is calculated while LG is derived from LN.
(Nitpicky remark: LG is identical to LOG10 like LN being identical to LOGe and LB to LOG2. Never let any mathematician catch you with a naked LOG in your text!)
Tom L
Some people call me inept but I'm as ept as anybody!
DM10L SN: 059/100
DM41X SN: 00023 (Beta)
DM41X SN: 00506 (Shipping)
DM42 SN: 00025 (Beta)
DM42 SN: 00221 (Shipping)
Some people call me inept but I'm as ept as anybody!
DM10L SN: 059/100
DM41X SN: 00023 (Beta)
DM41X SN: 00506 (Shipping)
DM42 SN: 00025 (Beta)
DM42 SN: 00221 (Shipping)

 Posts: 925
 Joined: Tue May 02, 2017 5:48 pm
 Location: United States
 Contact:
Re: LOG bases
This is my test case:jneven wrote: ↑Sat Mar 20, 2021 12:39 pmI did a small test with 5000 times LOG(X)/LOG(B) against LN(X)/LN(B). With LOG it was 17.6 seconds and with LN it was 18.05 seconds. Wondering why, I did the test without the division. There the LN version was 14.2 seconds and the LOG version 14.85 seconds. So, Thomas, the faster division compensates for the slower LOG and makes the LOG version slightly faster .
Code: Select all
00 { 44Byte Prgm }
01▸LBL "LTEST"
02 0.1
03 SEED
04 TIME
05 STO 00
06 1ᴇ6
07 STO 01
08▸LBL 00
09 RAN
10 LN
11 RAN
12 LN
13 ÷
14 DSE 01
15 GTO 00
16 TIME
17 RCL 00
18 HMS
19 1ᴇ4
20 ×
21 END
Not saying any tests that disagree with that result are wrong! It may just be a bit more complicated than a simple "LN is faster" vs. "LOG is faster." More investigation needed.
In C and related programming languages, log() is natural (base e) and log10() is base 10. Also, in older mathematics texts in particular, "log" usually means natural. Except, I suppose, when you're looking at really old texts, because the first logarithm to be studied was the base10 one, because of its obvious relation to the number of digits in its argument.toml_12953 wrote: ↑Sat Mar 20, 2021 1:05 pmIf you're coming from an ANSI/ISO BASIC world, it's even more confusing. In standard BASIC, LOG is LOGe, LOG2 is LB and LOG10 is LG. In many BASICs, LN is LOGe and there is no other base.
The "natural" logarithm is called "natural" because its inverse, e^x, is the only exponential that has the nice property of being its own derivative. If you use the base10 logarithm in analytic derivations, you tend to get annoying factors of ln(10) cropping up.
Re: LOG bases
Your testcode is better, Thomas! I was using fixed values to take LOG/LN from. So, I was probably favorizing the LOG10function. Thanks for your reaction and code.Thomas Okken wrote: ↑Sat Mar 20, 2021 1:53 pmThis is my test case:jneven wrote: ↑Sat Mar 20, 2021 12:39 pmI did a small test with 5000 times LOG(X)/LOG(B) against LN(X)/LN(B). With LOG it was 17.6 seconds and with LN it was 18.05 seconds. Wondering why, I did the test without the division. There the LN version was 14.2 seconds and the LOG version 14.85 seconds. So, Thomas, the faster division compensates for the slower LOG and makes the LOG version slightly faster .
It took 7.56 seconds with LN on lines 10 and 12, and 7.78 seconds with LOG, running on an Intel Mac.Code: Select all
00 { 44Byte Prgm } 01▸LBL "LTEST" 02 0.1 03 SEED 04 TIME 05 STO 00 06 1ᴇ6 07 STO 01 08▸LBL 00 09 RAN 10 LN 11 RAN 12 LN 13 ÷ 14 DSE 01 15 GTO 00 16 TIME 17 RCL 00 18 HMS 19 1ᴇ4 20 × 21 END
Not saying any tests that disagree with that result are wrong! It may just be a bit more complicated than a simple "LN is faster" vs. "LOG is faster." More investigation needed.
Re: LOG bases
I think pure mathematicians tend to assume \(\log\) means \(\log_e\) because they don't have a lot of use for \(\log_{10}\).
Re: LOG bases
Re: LOG bases
FWIW, 'Log' has also been used to denote the base 10 logarithm.invariant wrote: ↑Sat Apr 10, 2021 5:33 amYes. In fact, I think Log, with a capital L is widely understood to be the natural logarithm.
ISO800002 recommends 'ln' for base e logarithm, 'lg' for base 10 logarithm, and 'lb' for base 2 logarithm. That is what the WP 34S uses, but in all caps.
Here are (some of) the meanings that have been commonly associated with the different notations:
 lb  base 2 logarithm
 ld  base 2 logarithm
 lg  base 10 logarithm, base 2 logarithm
 ln  base e logarithm
 log  base 10 logarithm, base e logarithm, base 2 logarithm, (unspecified base) logarithm
 Log  base 10 logarithm, base e complex logarithm (multivalued relation)
Re: LOG bases
Also we are adaptive: The WP 43S uses ln, lg, and lb as ISO 800002 recommends for good reason.
DM42 SN: 00041 β
WP 43S running on this device
HP35, HP45, ..., HP35S, WP 34S, WP 31S, DM16L
WP 43S running on this device
HP35, HP45, ..., HP35S, WP 34S, WP 31S, DM16L
Re: LOG bases
It does seem wise to avoid log / Log given the possible ambiguities indeed!