Logs, Lns and Log10: OneNote gets it right


As I mentioned before, one of the areas of OneNote I took when I came to the team was what we call "Napkin Math."  This the ability to type equations like

8-4=        And getting a "4" when you press Enter or the spacebar.


It also works for basic trigonometric functions like

Sin(45)=0.707106781186547 (note this is based on 90 degrees)


So far, so good.  But I hit a snag with logarithms.


Try this:

Case 1: Type


And hit enter.  You get 0.999896315728952, right?


Great.  This is the natural log of 2.718.


Case 2:

Now try:


And hit enter (or space).  You get 2, right?  This is the base 10 log of 100, and again, OneNote gets it right.


Case 3:

Now try this:


And you get 2.302585092994046.  Hmm.  What number raised to 2.302585092994046 results in 10?  The answer is e, the natural log.  OK, mathematically, this makes sense, but every textbook I've used in school would say log(10)=1. 


All of my textbooks, and the Windows & Macintosh calculators, Excel and probably every physical calculator would evaluate log(10) as being base 10.  So here OneNote is in seeming disagreement with the rest of the (English speaking) world.  Based on this unexpected behavior, I entered a bug in our database.  My next task was to help figure out where things went wrong and help develop a plan to fix the problem.


As it turns out, nothing is wrong.  Here's why.


As I typically do when OneNote does something I do not understand, I went to talk with Irina, another tester on our team.  She has a Master's degree in Math, and since I only have a BA in Math, she automatically knows more than me.  She said it's only in America that log(x) has any meaning, as most math books in the rest of the world use lg(x) to denote base 10 logs.  Hmm, and an interesting clue.  What to do?


I turned next to the fountain of all human knowledge: the internet.  And buried in the National Institute of Standards and Technology documentation about how to represent just about any mathematical expression in typography , I found exactly how logarithms are expected to be typeset [in section 10.1.2].  Here's the link, and what follows is the gist of it as it relates to logs:


ln x

(ln x = loge x)

lg x

(lg x = log10 x)


And to specify base 10?

loga x

(logarithm to the base a of x)


And here is where OneNote is right, and most other math apps get it wrong.  To get a base 10 log, we expect you to tell us the base 'a' by typing log10(1000) to compute "3".  Instead of assuming you mean "10" if you do not specify a base, we use "e" - the gels with behavior seen in the real world.  Now that I understand it's going to use "e" as the base, I'm happy with the behavior.


By the NIST guidelines, an equation like log(8) has no meaning since the base is not specified.  The behavior we show, which returns a natural log in this case, sort of makes sense now.  Since we do not know the base, we default to using natural logs.  This is the same behavior as MATLAB, by the way.


Since OneNote obeys the NIST standards, my bug report came back as "Won't Fix," and Dan Escapa suggested I blog about why.  This is why.


Questions, comments, concerns and criticisms always welcome,