I found that looking at the original motivation of logarithms has been more elucidating than the way the topic is presented in grade-school. Thinking through the functional form that can solve the multiplication problem that Napier was facing (how to simplify multiplying large astronomical observations), f(ab) = f(a) + f(b), and why that leads to a unique family of functions, resonates a lot better with me for why logarithms show up everywhere. This is in contrast to teaching them as the inverse of the exponential function, which was not how the concept was discussed until Euler. In fact, I think learning about mathematics in this way is more fun — what original problem was the author trying to solve, and what tools were available to them at the time?
Toeplitz wrote "Calculus: The Genetic Approach" and his approach of explaining math via its historical development is apparently more widely used: https://en.wikipedia.org/wiki/Genetic_method . Felix Klein remarked: "on a small scale, a learner naturally and always has to repeat the same developments that the sciences went through on a large scale"
We could really take a page from this style for teaching advanced computing. We try to imagine that architectures just kind of come out of nowhere. Starting with mechanical computing and unit record equipment makes so much make more sense.
I'm sympathetic but there's no clear historic chronology. For instance the ancient egyptians dealt with both algebra and calculus (at least in part) long before Pythagoras. And thats not starting on China and India which had very different chronologies.
Choose a chronology that makes sense. We can see how Western ideas build, we have less clarity on how the ancient Egyptians or Chinese ideas developed, and therefore it's harder to explain to a learner.
If you're sensitive to that singular world view warping the learner's prospect, you could at each point explain similar ideas from other cultures that pre-date that chronology.
For example, once you've introduced calculus and helped a student understand it, you can then jump back and point out that ancient Egyptians seemed to have a take on it, explain it, ask the student to reason did they get there in the same way as the Western school of ideas did, is there an interesting insight to that way of thinking about the World?
Another ideas is how ideas evolved. We know Newton and Leibniz couldn't have had access to direct Egyptian sources (hieroglyphs were a lost language in their life times), but Greek ideas would have been rolling around in their heads.
There is Mathematics for the Million by Lancelot Hogben, which not only covers math, but the history of math and why it was developed over the centuries. It starts with numbers, then geometry, arithmetic, trig, algebra, logarithms and calculus, in that order. It's a very cool book.
A book without expecting any knowledge of mathematical notation would be a good start.
I've bought 3 math books to get into it and quit all of them within the first chapter.
I often wonder about this. I also believe that mathematical pedagogy strive to attract people that are very smart and think in the abstract like euler, and not operationally, meaning they will get it intuitively.
For other people, you need to swim in the original problem for a while to see the light.
I really disagree with the straightforward reduction of engineering to 'math but practical', but I'm finding it hard to express exactly why I feel this way.
The history of mathmatical advancement is full of very grounded and practical motivations, and I don't believe that math can be separated from these motivations. That is because math itself is "just" a language for precise description, and it is made and used exactly to fit our descriptive needs.
Yes, there is the study of math for its own sake, seemingly detached from some practical concern. But even then, the relationships that comprise this study are still those that came about because we needed to describe something practical.
So I suppose my feeling is that, teaching math without a use case is like teaching english by only teaching sentence construction rules. It's not that there's nothing to glean from that, but it is very divorced from its real use.
Agreed, and it's such a shame! A kid goes to math class and learns, say, derivatives as this weird set of transformations that have to be memorized, and it's only later in in physics class that they start to see why the transformations are useful.
I mean, imagine a programming course where students spend the whole first year studying OpenGL, and then in the second year they learn that those APIs they've been memorizing can be used to draw pictures :D
I was recently struggling to model a financial process and solved it with Units. Once I started talking about colors of money as units, it became much easier to reason about which operations were valid.
I think it is a combination of factors. Mathematical pedagogy is legitimate if the end goal is to train mathematicians, so yes it is geared towards those who think in the abstract. (I'm going to ignore the comment about very smart, since I don't think mathematical ability should be used as a proxy for intelligence.)
On the other side, I don't think those who are involved in curriculum development are very skilled in the applications of mathematics. I am often reminded of an old FoxTrot comic where Jason calculated the area of a farmer's field using calculus.
Frankly I wish I had known integral calculus going into geometry, I could tell there was a pattern behind formulas for areas and volumes but I couldn't for the life of me figure it out. There are worse ways to remember the formula for the volume of a sphere than banging out a quick integral!
I had known it. Thanks Dr Steven Giavat. The geometric shapes gave the patterns meaning. I read 'mathematics and the imagination' and mathematics a human endever' while I was starting algebra. Also the time-life book on math. All very brilliant because they used the methods that were used to investigate it, to show how it was discovered. These allowed me to fly ahead in math until I got to trig. Which took a long year to get facile, until I was able to finish my degree.
I had brilliant teachers.
Napier's bones, were for adding exponents, hense multiplication. Brilliant and nessary for the development of the slide rule, and the foundation of modern engineering, until the pocket calculator.
I think this should be front and center. To that end I propose "magnitude notation"[0] (and I don't think we should use the word logarithm, which sounds like advanced math and turns people away from the basic concept, which does make math easier and more fun).
I have been writing the same thing by (ab)using the existing unit of measurement known as a bel (B), which is most commonly seen with the SI prefix “deci” (d) as dB or decibel. I write the speed of light as 8.5 Bm/s (“8.5 bel meters per second”), which resembles the expression 20 dBV (“20 decibel volts”) shown at https://en.wikipedia.org/wiki/Decibel.
> I think this should be front and center. To that end I propose "magnitude notation"[0] (and I don't think we should use the word logarithm, which sounds like advanced math and turns people away from the basic concept, which does make math easier and more fun).
The only reason that "logarithm" sounds like advanced math is because it was so useful that mathematicians, well, used it. Since this terminology is just logarithms without saying the word, if it is more useful it, too, will probably be used by mathematicians, and then it will similarly come to sound like advanced math. So what's the point of running away from a name for what we're doing that fits with what it's actually called, if eventually we'll just have to make up a new, even less threatening name for it?
(I'd argue that "logarithm" is frightening less because it sounds like advanced math than because it's an unfamiliar and old-fashioned-sounding word. I'm not completely sure that "magnitude" avoids both these issues, but it's at least arguable that it suffers less from them.)
It's written like ^6 and said like "mag 6", which sounds like an earthquake (and this is basically the Richter scale writ large). One syllable, sounds cool, easy to type/spell, evokes largeness. "Logarithm" is 3-4 syllables, hard to pronounce, hard to spell, sounds jargon-y.
I actually prefer the straightforward log is an inverse of exponents. It's more intuitive that way because I automatically can understand 10^2 * 10^3 = 10^5. Hence if you are using log tables, addition makes sense. I didn't need an essay to explain that.
Take logs, add 2 + 3 = 5 and then raise it back to get 10^5.
This is how I've always taught logarithms to students I've tutored. I photocopy a table of various powers of ten, we use it in all sorts of ways to solve problems, and then I sneakily present an "inverse power" problem where they need to make the lookup backwards.
Almost every student gets it right away, and then I tell them looking up things backwards in the power table is called taking a logarithm.
That's how I mentally processed them when first learning them years ago. Doing operations on x and y with log(x) = y in the background somehow felt far less intuitive than thinking about 10^y = x.
I really enjoyed this author's work, BTW. Just spent several hours reading the entire first five chapters or so. What an excellent refresher for high school math in general.
This would be an interesting thing to study: How many different ways people learned about logarithms, and how they generally fared in math. I learned about logarithms by seeing my dad use his slide rule, and studying stock charts, which tended to be semi-logarithmic.
Presumably the book from this thread by Charles Petzold will be a great canonical resource, but originally there was a quote by Howard Eves that I came across that got me curious:
> One of the anomalies in the history of mathematics is the fact that logarithms were discovered before exponents were in use.
One can treat the discovery of logarithms as the search for a computation tool to turn multiplication (which was difficult in the 17th century) into addition. There were previous approaches for simplifying multiplication dating back to antiquity (quarter square multiplication, prosthaphaeresis), and A Brief History of Logarithms by R. C. Pierce covers this, where it’s framed as establishing correspondences between geometric and and arithmetic sequences. Playing around with functions that could possibly fit the functional equation f(ab) = f(a) + f(b) is a good, if manual, way to convince oneself that such functions do exist and that this is the defining characteristic of the logarithm (and not just a convenient property). For example, log probability is central to information theory and thus many ML topics, and the fundamental reason is because Claude Shannon wanted a transformation on top of probability (self-information) that would turn the probability of multiple events into an addition — the aforementioned "f" is the transformation that fits this additive property (and a few others), hence log() everywhere.
Interestingly, the logarithm “algorithm” was considered quite groundbreaking at the time; Johannes Kepler, a primary beneficiary of the breakthrough, dedicated one of his books to Napier. R. C. Pierce wrote:
> Indeed, it has been postulated that logarithms literally lengthened the life spans of astronomers, who had formerly been sorely bent and often broken early by the masses of calculations their art required.
I had a slide rule in high school. It was more of a novelty item by that point in time, only one of my math teachers even knew what a slide rule was, but that didn't stop me from figuring out how it was used and how it works. It didn't take much to figure out that the sliding action was solving problems by addition, and the funky scales were logarithmic. In other words: it performed multiplication by adding logs.
That said, I did encounter references to its original applications in other places. I studied astronomy and had an interest in the history of computation.
Yes, but such a property was not available to Napier, and from a teaching perspective, it requires understanding exponentials and their characterizations first. Starting from the original problem of how to simplify large multiplications seems like a more grounded way to introduce the concept.
From a teaching perspective it goes like this: first we learn additions, and to undo additions we have subtractions; then we learn repeated additions i.e. multiplications, and to undo multiplications we have divisions; finally we learn repeated multiplications, i.e. exponentiation, and to undo exponentiation we have logarithms and roots.
Interesting insight why applying a log transform often makes data normally distributed: Pretty much all laws of nature are multiplications (F=ma, PV=nRT, etc). If you start with i.i.d random variables and multiply them, you get log-normal data by virtue of the central limit theorem (because multiplications are additions on a log scale; and the CLT is also somewhat robust to non iid-ness). Thinking of data as the result of a lot of multiplications of influential factors, we thus get a log-normal distribution.
The CLT does not require iid (independent, identically distributed) variables. Just independent and having a variance, plus some rather weak condition on slightly higher orders. Otherwise the variables can be quite different from each other.
No but it holds more generally. Taking the log of data tends to make it look "more correct" even when it's not theoretically justified, and this can lead to very wrong conclusions.
Matt Parker says it's because that's how humans are naturally inclined to think, and used the midway point between 1 and 9 to illustrate. We'd say five but "children and others not exposed to math would say 3" and then gave some explanation with beads or coins. It didn't make sense to me but I do know that if a graph is log scale I need to actually look at it harder to make sure they're not trying to pull a fast one on us here folks.
How timely! I just learned how to use a slide rule yesterday. Looking to pick one up, and a bit overwhelmed by the plethora of choices, I went down a small rabbit hole[0]. Some slide rules produced are pure works of art!
Lately, I've been rediscovering the surprising niceties that analog tools can provide over our everything-is-a-panel-of-glass interfaces these days. Recently, I have been enjoying pen and paper as my editor for initial drafts of projects I'm coding.
Does HN have love for any analog tools in particular?
I've been doing a math course and occasionally think of picking up these analogue tools. Someone on Hacker News had me interested in the Soroban, the Japanese abacus [1], which is still used to train insane mental math speeds to this day [2].
We're definitely on a similar wavelength. I actually own a couple Japanese abaci and know the basics. Top performers feel near magical: double-fisters[0] and blazingly fast mental arithmetic [1].
I have several slide rules and use them daily. Especially in the kitchen where we deal a lot with scaling proportions they are the best tool available: you set them for the desired scale, and then you can just read off any proportion you need in the blink of an eye.
I'm honestly surprised they are not standard issue in kitchens.
They go for a bit more than the original price, according to this:
"Pricing varied by retailer, however Pickett did offer demonstration slide rules in 4 foot and 7 foot lengths: a 4 foot rule sold for $15 and the 7 foot rule was $25 in 1960. These were available with scales to match models N4, N803, and N1010 with the Ln scale added. These large rules were available free to schools which ordered 24 or more slide rules!"
The general version of this is called inverse transform sampling [0], which uses the fact that for the cdf F of any random variable X the random variable Y = F(X) has a standard uniform distribution [1]. Since every cdf increases monotonically on the unit interval, every cdf is invertible [2]. So apply the inverse cdf to both sides of the previous equation and you get F^-1(Y) = X is distributed like X.
Sampling from a standard uniform distribution and then using the inverse transform is the commonest way of generating random numbers from an arbitrary distribution.
For the particular case of the exponential distribution we can go further. By taking advantage of the theory of Poisson processes, we can take samples using a parallel algorithm. It even has a surprisingly succinct SQL translation:
SELECT *
FROM Population
WHERE weight > 0
ORDER BY -LN(1.0 - RANDOM()) / weight
LIMIT 100 -- Sample size.
Notice our exponentially distributed random variable on prominent display in the ORDER BY clause.
Oops. I had quite forgotten that I need to write about that. I said I would over a decade ago, so that's a long time for you to wait. Sorry about that.
I mainly write for myself, so I need the time and the motivation. Until recently, my job at G took up my time and also provided an internal community where I could scratch the writing itch, which reduced the motivation for public writing on my blog. But now that I'm semi-retired, I'll try to write more frequently.
One way to understand why without writing down the CDF/PDF:
When X is an exponential variable and c is a constant, X + c has the same distribution as X after conditioning on large outcomes. In other words, these two variables have same "tail." This is true exactly for exponential distributions. (Sometimes this is called "memorylessness.")
Similarly, when U has a uniform distribution on [0, 1] and c is a constant, cU has the same distribution as U after conditioning on small outcomes.
But if cU is distributed like U near 0, then -ln(c U) is distributed like -ln(U) near infinity. But -ln(c U) = -ln(c) - ln(U), so the tail of -ln(U) doesn't change when we add a constant, meaning it must have an exponential distribution.
Most textbooks on probability have some discussion of the relationships between the various distributions commonly in use. If you just want a quick overview, I found John D. Cook’s diagram to be handy:
Possibly unhelpful answer: Arguably none! This is presented as a surprising fact, but you could easily argue that this is the proper definition of an exponential distribution. If you do
x = -log(rand())/lambda
a bunch a times, that comes from something, right? Well, let's call that something an exponential distribution.
From this perspective, the thing that actually needs math is finding the density function of the exponential distribution. (For that, in theory you just need calc 101 and probability 101.)
Unless I'm missing something, this can just be directly verified, no “understanding” necessary. All you need to know is that probability distributions can be characterized by their probability density function (PDF).
If Y=-ln(X)/lambda, then P(Y<a) = P(-ln(X)/lambda<a) = P(X>exp(-lambda a)) = 1-exp(-lambda a).
And if Z is exponential with rate parameter lambda, then P(Z<a) = P(lambda exp(-lambda t)<a) = integral from 0 to a of lambda exp(-lambda t)dt, which can be directly computed to be 1-exp(-lambda a).
They have the same PDF, so they're the same distribution.
I mean if starting from scratch that seems like many years in most western education systems to get to probability, logarithms, exponentiation.
I would say If you knew 2+2=4, and not much else you're years away from 'understanding', if you know ln(exp(y)) = y, and P(x>0.5) = 0.5 for a uniform distribution on [0, 1) then you don't need any additional understanding.
I would bet the GP comment is somewhere inbetween the two extremes, but I think a random sampling of the population would likely result in people generally not knowing the log / exponentiation relation, or anything about the uniform distribution.
I love that you asked this, but I think it's not quite the right question.
I've been wishing for years that someone would maintain a "dependency graph" for mathematical concepts. I think Khan Academy tried to do something like this at one point but took it down a long time ago. As long as we're far enough from the bleeding-edge of research topics, I feel like maths is the one field where this might be possible to do really well. You should be able to point at something you don't understand and trace backwards in a very granular fashion until you hit a concept you already know/understand, and then learn what you need to fill in the gap!
I had wanted to build a website like this as a hobby, except not limited strictly to mathematical concepts. I wanted to build a graph of the skills/concepts you’d need to understand electrical impedance, fix an air conditioning system, bake bread reliably.
One source of information could be course syllabi, which describe a progression of topics and their prerequisites.
Rather than be the authority on what concepts must precede others, I envisioned making a system that could represent different educational approaches: not every educator agrees that Calculus I ought to be a prerequisite for studying Physics I. Not all bread recipes use yeast.
I had a hard time finding a good domain for this effort. “Tree of knowledge” dot TLD was taken.
Not long. We were taught logs, and use of log tables, at Middle School. So probably around about age 11.
I also vaguely recall a couple of lessons where we went over Napier's Bones, and they had us produce equivalents on pieces of paper to cut out and move around.
I believe I still have my school day log tables around somewhere. I'd just have to practice for 1/2 hr to remind myself how to use them. That said, they did have usage instructions in the last few pages.
Having scanned through his book, it makes it seem overly complex.
At middle school, this was taught after having only done simply arithmetic and learning about fractions (rational numbers) in primary school, then decimal fractions in middle school.
The use of logs from the tables was simply a set of basic rules for how to apply them to a few scenarios. I can't recall if it covered trig with those tables, but I doubt it.
I learnt as a child between 10 (when I started middle school), and say around 12 at most. I've forgotten the use, but vaguely recall some way of representing negative numbers in the table (n-bar, with a bar above the digit).
I'm way over 30. I never used log tables after high school, and have forgotten the rules for usage, but recall it didn't take long to learn the first time. *
However for simple uses (multiplication and division) I'd expect I'd be able to pick it up again in at most a weeks worth of practice. It would be made a lot easier now by being able to compare and check calculations with a computer or pocket calculator.
I'd expect any adult able to program a computer to also be able to pick it up in a similar period, or at most a month.
Remember we used to teach this to kids, and expect them to be able to pick it up (if not be accurate in application) in under a weeks worth of lessons.
* Note I didn't even know how to do long multiplication when I learnt, as due to political interference with teaching curriculum, I'd not been taught at primary school.
It seems like there's always more than one way to skin a cat, but I'd have turned to calculus, had I needed to derive something like this and didn't think to look it up (e.g., before the Internet).
All you need is plot -log(x) for x between 0 and 1 and you will see that log(x) transforms a uniform line into an exponential decay (towards 1). Its being said in a fancy way. This is also the origin of the log likelihood loss function in ML
I know what all these words mean, it "makes sense" to me in the sense that I read it and I think "ok.." but I wouldn't have the slightest idea how to use this to get weighted random samples or "generate event times."
So I guess I "understand it" in the sense that it doesn't sound like a foreign language, but I can't apply it in any meaningful way.
I started using LMAX Disruptor for some projects. One quirk with Disruptor is that the queue size always has to be an exponent of two.
I wanted to make sure that I always have at least enough room for any size and I didn't want to manually compute, so I wrote this:
var actualSize = Double.valueOf(Math.pow(2, Math.ceil(Math.log(approxSize) / Math.log(2)))).intValue();
A bit much for a single line, but just using some basic log rules in order to the correct exponent. I learned all this in high school, but some of my coworkers thought I was using this amazing, arcane bit of math that had never been seen before. I guess they never use log outside of Big-O notation.
This is perfectly usable, of course, but I’d write
var actualSize = Integer.highestOneBit(approxSize - 1) << 1;
purely to avoid involving the horrors that live beneath the humble pow() and log().
(Integer.highestOneBit, also known as “isolate leftmost bit”, “most significant one”, or the like, essentially has to be a primitive to be efficient, unlike its counterpart for the lowest bit, x&-x. The actual CPU instruction is usually closer to Integer.numberOfLeadingZeros, but that’s just a bitshift away.)
That's pretty cool; I didn't even consider doing any cool bitwise arithmetic.
I didn't particularly care about performance or anything for this particular case, since it runs exactly once at the start of the app just to initiate the Disruptor.
Nope. I don’t know why the Java folks decided not to use the fairly standard verb “isolate” for this method, but that’s what it is[1]:
> public static int highestOneBit(int i)
> Returns an int value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit in the specified int value. Returns zero if the specified value has no one-bits in its two's complement binary representation, that is, if it is equal to zero.
There isn’t a straight floor(log2(·)) as far as I can tell, only Integer.numberOfLeadingZeros, and turning the former into the latter is annoying enough[2] that I wouldn’t prefer it here.
I can strongly recommend memorising some logarithms for use in mental maths. It's given me powers I did not expect to have! Here's what I wrote about it when I started: https://entropicthoughts.com/learning-some-logarithms
It's been about as useful as one would expect. I don't need it daily, but when I need it, I can usually estimate a good enough answer in the time it takes someone else to do it on a calculator.
It has also helped a little with getting a geometric appreciation for numbers, but I suspect that could be improved significantly with more active practice.
The Logarithmic derivative is also something that is surprisingly fundamental.
(ln(f))' = f'/f
In function theory you use it all the time. But people rarely notice, that it related to a logarithm.
Also the functions that have nice logarithmic derivative are a lot more interesting than expected. Nature is full of Gompertz functions. Once you're familiar with it, you see it everywhere.
There used to be practical value to be able to do some basic back of the envelope log calculations in your head (no calculators, this was how you did fast multiplications/divisions or exponents). There's a story in Feyman's Surely you're joking book about Los Alamos scientists doing speed competitions for mental log calculations
(I'm sure this is in the book) John Napier, the father of logarithms (the N in ln), basically had a sweatshop of human calculators making log tables over something like 20 years - critical for celestial navigation. There was a huge price attached to the person that developed a method to safely navigate across the oceans, also lead to the invention of the pocket watch
I learned the multiplication using addition and a lookup table in a class taught by Huffman (of Huffman compression fame). You weren't allowed to use a calculator on the test.
“The discovery of Benford's law goes back to 1881, when the Canadian-American astronomer Simon Newcomb noticed that in logarithm tables the earlier pages (that started with 1) were much more worn than the other pages.”
You can do even better if you memorize three numbers: 301, 477, 845. These are the values of 1000log10(n) for n = 2, 3, 7. From these you can quickly get the values for 4 (= 22), 5 (=10/2), 6 (=23), 8 (=222) and 9 (=33).
For your example 1.49 is close to 3 / 2 so the log will be very close 0.477 - 0.301 = 0.176.
This means that your answer is near 8.176 (actual value is 8.173).
This tiny table of logs can also let you answer parlor trick questions like what is the first digit of 2^1000 (the result is very nearly 10^301 but a bit above, so 1 is the leading digit).
1.49 is in between 1.2 and 1.6 and I have memorised log(1.2)=0.1 and log(1.6)=0.2, so I would think log(1.5) is close to 0.17, using sloppy linear interpolation.
That would make log(149,135,151) approximately 8.17. My calculator also says 8.17. Your guess was good!
I have found linear interpolation such an intuitive approximation method that the tradeoff of having to memorise more logarithms is worth it.
There was an interesting text, by Isaac Asimov, where he explained in a very clear way the historical importance of logarithms -- they allowed Kepler to finalize his work by replacing tables of multiplications (which were difficult and error-prone) with sums.
The traditional explanations of logarithms I've encountered are far too math and terminology heavy for most people to grasp.
Think of a number line.... show example..... 1..2..3..4..5.. etc
Any given move to the right, makes the value go up by 1.
But... What if we did a special number line where each time it doubled instead of adding one? 1..2..4..8..16, etc...
That line would go up way to fast to see numbers like 10, so we can expand it out a bit...show that... and start to fill in the numbers... 2^10 (1024) is almost 1000... so you can divide that distance by 3 to get 10 on the line, then move one unit left for 5... and build out a slide ruler.
Computing logarithms with a 4 function calculator isn't hard by the way, I used to do it for fun on my lunch breaks.
Wow, I thought it was just some random guy, but was then quite surprised to see this was being authored by none other than the legendary Charles Petzold. I'd buy this book - just to put it next to my copy of "Programming Windows 95" (who remembers?) :)
I have a few old math manuals at home, from late 19th / early 20th century. Many of them have a logarithm table as an appendix. It looked like the type of things that if you had a few extra sheets to print to make a booklet, you'd just add because it was bound to be very useful to someone.
Charles Petzold was one of my favorite tech authors from the way begone era.
Written in a style very similar in vein to the Lost of Art of Logarithms he made me fall in love with the various mundane tech concepts that would never jump out as a anything of interest, otherwise. What a treat!
Anyone here who hasn’t read it should do so - you might think it’s ’below you’, but it’s so well written it’s a joy to read, and I suspect you’ll come out thinking of some things differently.
Notation for writing log has always bugged me. Like I feel like it should be more like <10>^<527> which would be the log base 10 of 527. That's not it, but something. The current notation just doesn't feel quite right.
I never understand why anyone thinks its good notation. The layout means nothing and lets you infer nothing because exponentiation isn't a 2d planar geometric operation. All the information and rules are contained in the idea "exponentials map the additive reals to the multiplicative reals".
The notation conveys no information at all, and provides no means of proving anything, and even the notation for function composition is worse.
Given the operator pow : R^2->R there are 2 possible inverses. root and log
root isn't even interesting. its just pow with the 2nd argument precomposed with reciprocal. root x b = pow x 1/b
I think it's good for explanation purposes, but not actually great as notation, especially for operations that are so common, too much room for ambiguity, especially when writing quickly.
The Triangle of power explanation of logarithms is what really got me across logs.
It wasn't until seeing the triangle and having the relationships explained that I had any clue about logarithms, up until then logs had been some archaic number that meant nothing to me.
Because of the triangle of power, I now rock up to B and B+ Trees and calculate the number of disc accesses each will require in the worst case, depending on the number of values in each block (eg, log2(n), log50(n) and log100(n))
Ironically, that notation, which I just discovered, confuses me more than anything else.
Logs clicked for me when someone online said "amongst all the definitions we have for logs, the most useful and less taught is that log() is just a power". At that exact instant, it's like if years of arcane and foreign language just disappeared in front of my eyes to leave only obviousness and poetry.
I don't understand the comment about it just being a power, but, for me, knowing that it's filling in the third vertice on the triangle with exponents at the top, and n on the other is what makes it work for me - I now know in my head when I am looking for the log of n, I am looking for the exponent that would turn the log into n.
I don't go looking for the exact log, I only look for whole numbers when I am calculating the value in my mind.
But it makes sense when I am looking for the log2 of 8 to know that the answer is "what exponent will make 2 into 8"? and that's "3"
Well, currently exponentiation has a superscript exponent to the right of the base, and logs have a subscript base to the left of the exponent. They're already very similar to your example, but they also include the word "log".
One of the best uses of logarithms is how they can be used to quickly calculate db (as in decibel) gains and losses mentally. See this older comment for more details
Yes the office door stop as it was known as at our place. Top book though just faded in utility and no one had the heart to dispose of it because of the good memories.
I feel frustrated that we cannot conceive of numbers like 10^80 (atoms in the universe) or 10^4000 (number configurations for a system with 4000 variables having 10 states each). Maybe there are superbrains out there in the universe that can do so.
I guess you have to define what you mean by "conceive".
I'm not sure you can even conceive a number like 1,000, if you're talking about holding an intuitive visual understanding in your mind at once.
Like, I can easily see 100 in my mind's eye as a 10x10 grid of circles. Even if I don't see each one clearly, I have a good sense of the 10 on each edge and the way it fills in. But ask me to imagine 10 of those side-by-side to make 1,000, and I don't think I can. Once I imagine the 10 groups, each one is just a square simplification, rather than any individual pieces within.
But I'm totally familiar with 1,000 as a concept I can multiply and divide with, and I can do math with 10^80 as well. And I can do so fairly "intuitively" as well -- it's just all the numbers up to 80 digits long. Even 4,000 digits fits on a single page of a book.
My first cut at conceiving is to answer "how long would it take a really fast computer to count to that number". The answer for 10^4000 is still something like 10^3978 years. So, a still inconceivable time.
(100 tera-ops computer)
[edited to correct calculation)
But the length of time it takes a modern computer to count to 10 or 1,000 is perhaps inconceivably small by your metric, no? Your idea arbitrarily selects numbers around 2 billion as being conceivable, at least for a single core on my MacBook.
But my question isn't what makes 10^4000 inconceivable -- my question is what makes 10^4000 any less conceivable than 1000. To me, they're both firmly in the realm of abstractions we can reason about using the same types of mathematical methods. They're both qualitatively different from numbers like 5 or 10 which are undoubtedly "conceivable".
> But I'd just call it "instantaneous" and something I experience frequently.
Then since you're OK with all smaller numbers being equally "instantaneous", then 1/10^4000 seconds is instantaneous too. Add up enough of those to make a second, and you can conceive of your previously inconceivable number! :)
Of course, that will seem silly. I'm just illustrating I don't think there are any grounds for claiming exponentially large numbers are inconceivable, but exponentially small numbers are somehow conceivable. They're just as far from 1, multiplicatively, no matter which direction you go in.
All right! I cannot count to any fractional number, even conceivable ones, so using the counting time to assess conceivability fails for all fractions.
For small numbers, groping for any experience in the macro world fails once you get below the Planck scale.
I'm afraid you might have broken the fabric of the universe by even typing such a small number.
To me it's hard because we don't come across these magnitudes on a daily basis. Grains of sand on a beach is an off the top of my head way to visualize such quantities. But yeah, numbers that big, are so big that we have nothing to compare them with.
If the author is in here, thank you. Been looking for a text for my daughter on the subject. This might just fit the bill. If you're just the linker, then thank you Ozanonay.
Notes from "How should logarithms be taught?" (2021)
https://news.ycombinator.com/item?id=28519356 re: logarithms in the Python standard library, NumPy, SymPy, TensorFlow, PyTorch, Wikipedia
Charles Petzold wrote one of my favorite books - "Code: The Hidden Language of Computer Hardware and Software". Very excited to see how this turns out and thanks for giving some of this knowledge away for free!
I would also recommend the "NAND to Tetris" book. Covers much the same ground (as I remember things anyway) but is a hands on approach. I enjoyed Code also though and is worth a look for those interested.
I found that looking at the original motivation of logarithms has been more elucidating than the way the topic is presented in grade-school. Thinking through the functional form that can solve the multiplication problem that Napier was facing (how to simplify multiplying large astronomical observations), f(ab) = f(a) + f(b), and why that leads to a unique family of functions, resonates a lot better with me for why logarithms show up everywhere. This is in contrast to teaching them as the inverse of the exponential function, which was not how the concept was discussed until Euler. In fact, I think learning about mathematics in this way is more fun — what original problem was the author trying to solve, and what tools were available to them at the time?
Toeplitz wrote "Calculus: The Genetic Approach" and his approach of explaining math via its historical development is apparently more widely used: https://en.wikipedia.org/wiki/Genetic_method . Felix Klein remarked: "on a small scale, a learner naturally and always has to repeat the same developments that the sciences went through on a large scale"
We could really take a page from this style for teaching advanced computing. We try to imagine that architectures just kind of come out of nowhere. Starting with mechanical computing and unit record equipment makes so much make more sense.
Plus, unit record equipment was cool.
I always longed for a book/course on mathematics where topics are in chronological order:
1. ... (mathematical topics at the beginning of history of which I am ignorant of)
2. pythagoras theorem
3. ...
4. euclid geometry
5. ...
6. algebra
7. ...
8. calculus
9. ...
10. set theory
11. ...
12. number theory
13. etc. etc. (you get the point)
Maybe there's already something that lays out topics like this. I haven't searched too hard.
I'm sympathetic but there's no clear historic chronology. For instance the ancient egyptians dealt with both algebra and calculus (at least in part) long before Pythagoras. And thats not starting on China and India which had very different chronologies.
Choose a chronology that makes sense. We can see how Western ideas build, we have less clarity on how the ancient Egyptians or Chinese ideas developed, and therefore it's harder to explain to a learner.
If you're sensitive to that singular world view warping the learner's prospect, you could at each point explain similar ideas from other cultures that pre-date that chronology.
For example, once you've introduced calculus and helped a student understand it, you can then jump back and point out that ancient Egyptians seemed to have a take on it, explain it, ask the student to reason did they get there in the same way as the Western school of ideas did, is there an interesting insight to that way of thinking about the World?
Another ideas is how ideas evolved. We know Newton and Leibniz couldn't have had access to direct Egyptian sources (hieroglyphs were a lost language in their life times), but Greek ideas would have been rolling around in their heads.
There is Mathematics for the Million by Lancelot Hogben, which not only covers math, but the history of math and why it was developed over the centuries. It starts with numbers, then geometry, arithmetic, trig, algebra, logarithms and calculus, in that order. It's a very cool book.
There are two books which do a fantastic job of this:
Mathematics: From the Birth of Numbers, by Jan Gullberg
and
Mathematics: A Cultural Approach, by Morris Klein
A book without expecting any knowledge of mathematical notation would be a good start. I've bought 3 math books to get into it and quit all of them within the first chapter.
I often wonder about this. I also believe that mathematical pedagogy strive to attract people that are very smart and think in the abstract like euler, and not operationally, meaning they will get it intuitively.
For other people, you need to swim in the original problem for a while to see the light.
Math is rarely taught with practical problems in mind — that’s engineering !
I really disagree with the straightforward reduction of engineering to 'math but practical', but I'm finding it hard to express exactly why I feel this way.
The history of mathmatical advancement is full of very grounded and practical motivations, and I don't believe that math can be separated from these motivations. That is because math itself is "just" a language for precise description, and it is made and used exactly to fit our descriptive needs.
Yes, there is the study of math for its own sake, seemingly detached from some practical concern. But even then, the relationships that comprise this study are still those that came about because we needed to describe something practical.
So I suppose my feeling is that, teaching math without a use case is like teaching english by only teaching sentence construction rules. It's not that there's nothing to glean from that, but it is very divorced from its real use.
Well, logarithms were made from physical entities (celestial bodies) but not on engineering per se.
I think this is already enough context to root the mental effort deeper.
Agreed, and it's such a shame! A kid goes to math class and learns, say, derivatives as this weird set of transformations that have to be memorized, and it's only later in in physics class that they start to see why the transformations are useful.
I mean, imagine a programming course where students spend the whole first year studying OpenGL, and then in the second year they learn that those APIs they've been memorizing can be used to draw pictures :D
I've never seen an introductory math textbook that didn't point out how position, velocity and acceleration are related by the derivative.
Rules for derivatives require the least memorization
Therein lies the rub. Treating abstract and the concrete in isolation was always tough sledding for me.
Bouncing between the two is where the action is.
And units: if I had it all to do over, I would pore over the units sooner rather than later.
Absolutely. Units are such a useful idea.
I was recently struggling to model a financial process and solved it with Units. Once I started talking about colors of money as units, it became much easier to reason about which operations were valid.
Strictly speaking this is about dimensional analysis, not units. (When discussing curricula we should be precise!)
I think it is a combination of factors. Mathematical pedagogy is legitimate if the end goal is to train mathematicians, so yes it is geared towards those who think in the abstract. (I'm going to ignore the comment about very smart, since I don't think mathematical ability should be used as a proxy for intelligence.)
On the other side, I don't think those who are involved in curriculum development are very skilled in the applications of mathematics. I am often reminded of an old FoxTrot comic where Jason calculated the area of a farmer's field using calculus.
Frankly I wish I had known integral calculus going into geometry, I could tell there was a pattern behind formulas for areas and volumes but I couldn't for the life of me figure it out. There are worse ways to remember the formula for the volume of a sphere than banging out a quick integral!
I had known it. Thanks Dr Steven Giavat. The geometric shapes gave the patterns meaning. I read 'mathematics and the imagination' and mathematics a human endever' while I was starting algebra. Also the time-life book on math. All very brilliant because they used the methods that were used to investigate it, to show how it was discovered. These allowed me to fly ahead in math until I got to trig. Which took a long year to get facile, until I was able to finish my degree.
I had brilliant teachers.
Napier's bones, were for adding exponents, hense multiplication. Brilliant and nessary for the development of the slide rule, and the foundation of modern engineering, until the pocket calculator.
Mathematicians also hate the current version of math education.
I think this should be front and center. To that end I propose "magnitude notation"[0] (and I don't think we should use the word logarithm, which sounds like advanced math and turns people away from the basic concept, which does make math easier and more fun).
https://saul.pw/mag
I have been writing the same thing by (ab)using the existing unit of measurement known as a bel (B), which is most commonly seen with the SI prefix “deci” (d) as dB or decibel. I write the speed of light as 8.5 Bm/s (“8.5 bel meters per second”), which resembles the expression 20 dBV (“20 decibel volts”) shown at https://en.wikipedia.org/wiki/Decibel.
If logarithm sounds too advanced, just say log and logs. I think it could work!
> I think this should be front and center. To that end I propose "magnitude notation"[0] (and I don't think we should use the word logarithm, which sounds like advanced math and turns people away from the basic concept, which does make math easier and more fun).
The only reason that "logarithm" sounds like advanced math is because it was so useful that mathematicians, well, used it. Since this terminology is just logarithms without saying the word, if it is more useful it, too, will probably be used by mathematicians, and then it will similarly come to sound like advanced math. So what's the point of running away from a name for what we're doing that fits with what it's actually called, if eventually we'll just have to make up a new, even less threatening name for it?
(I'd argue that "logarithm" is frightening less because it sounds like advanced math than because it's an unfamiliar and old-fashioned-sounding word. I'm not completely sure that "magnitude" avoids both these issues, but it's at least arguable that it suffers less from them.)
It's written like ^6 and said like "mag 6", which sounds like an earthquake (and this is basically the Richter scale writ large). One syllable, sounds cool, easy to type/spell, evokes largeness. "Logarithm" is 3-4 syllables, hard to pronounce, hard to spell, sounds jargon-y.
By the way, there's another function that can be used to turn multiplication into addition: f(x) = x^2 / 2
a * b = f(a + b) - (f(a) + f(b))
I actually prefer the straightforward log is an inverse of exponents. It's more intuitive that way because I automatically can understand 10^2 * 10^3 = 10^5. Hence if you are using log tables, addition makes sense. I didn't need an essay to explain that.
Take logs, add 2 + 3 = 5 and then raise it back to get 10^5.
This is how I've always taught logarithms to students I've tutored. I photocopy a table of various powers of ten, we use it in all sorts of ways to solve problems, and then I sneakily present an "inverse power" problem where they need to make the lookup backwards.
Almost every student gets it right away, and then I tell them looking up things backwards in the power table is called taking a logarithm.
That's how I mentally processed them when first learning them years ago. Doing operations on x and y with log(x) = y in the background somehow felt far less intuitive than thinking about 10^y = x.
I really enjoyed this author's work, BTW. Just spent several hours reading the entire first five chapters or so. What an excellent refresher for high school math in general.
We used logarithms routinely for large multiplications, divisions, etc. in 11th and 12th grade. No calculators were allowed. This was in India.
This would be an interesting thing to study: How many different ways people learned about logarithms, and how they generally fared in math. I learned about logarithms by seeing my dad use his slide rule, and studying stock charts, which tended to be semi-logarithmic.
This is how I learned them in middle school — just common logs, as an aid to doing roots, powers and multiplications of big numbers.
We were told in an off-hand way that logs could be to any base, even ‘e’, but not to worry about that for a few years.
Where did you pick this up? Is there a book that covers it that way?
Presumably the book from this thread by Charles Petzold will be a great canonical resource, but originally there was a quote by Howard Eves that I came across that got me curious:
> One of the anomalies in the history of mathematics is the fact that logarithms were discovered before exponents were in use.
One can treat the discovery of logarithms as the search for a computation tool to turn multiplication (which was difficult in the 17th century) into addition. There were previous approaches for simplifying multiplication dating back to antiquity (quarter square multiplication, prosthaphaeresis), and A Brief History of Logarithms by R. C. Pierce covers this, where it’s framed as establishing correspondences between geometric and and arithmetic sequences. Playing around with functions that could possibly fit the functional equation f(ab) = f(a) + f(b) is a good, if manual, way to convince oneself that such functions do exist and that this is the defining characteristic of the logarithm (and not just a convenient property). For example, log probability is central to information theory and thus many ML topics, and the fundamental reason is because Claude Shannon wanted a transformation on top of probability (self-information) that would turn the probability of multiple events into an addition — the aforementioned "f" is the transformation that fits this additive property (and a few others), hence log() everywhere.
Interestingly, the logarithm “algorithm” was considered quite groundbreaking at the time; Johannes Kepler, a primary beneficiary of the breakthrough, dedicated one of his books to Napier. R. C. Pierce wrote:
> Indeed, it has been postulated that logarithms literally lengthened the life spans of astronomers, who had formerly been sorely bent and often broken early by the masses of calculations their art required.
In my case, it was by chance.
I had a slide rule in high school. It was more of a novelty item by that point in time, only one of my math teachers even knew what a slide rule was, but that didn't stop me from figuring out how it was used and how it works. It didn't take much to figure out that the sliding action was solving problems by addition, and the funky scales were logarithmic. In other words: it performed multiplication by adding logs.
That said, I did encounter references to its original applications in other places. I studied astronomy and had an interest in the history of computation.
This follows directly from the fact that exp(x+y)=exp(x)exp(y).
Yes, but such a property was not available to Napier, and from a teaching perspective, it requires understanding exponentials and their characterizations first. Starting from the original problem of how to simplify large multiplications seems like a more grounded way to introduce the concept.
From a teaching perspective it goes like this: first we learn additions, and to undo additions we have subtractions; then we learn repeated additions i.e. multiplications, and to undo multiplications we have divisions; finally we learn repeated multiplications, i.e. exponentiation, and to undo exponentiation we have logarithms and roots.
You see how one of those isn't like the others?
Interesting insight why applying a log transform often makes data normally distributed: Pretty much all laws of nature are multiplications (F=ma, PV=nRT, etc). If you start with i.i.d random variables and multiply them, you get log-normal data by virtue of the central limit theorem (because multiplications are additions on a log scale; and the CLT is also somewhat robust to non iid-ness). Thinking of data as the result of a lot of multiplications of influential factors, we thus get a log-normal distribution.
The CLT does not require iid (independent, identically distributed) variables. Just independent and having a variance, plus some rather weak condition on slightly higher orders. Otherwise the variables can be quite different from each other.
All data is linear when plotted on a loglog scale with a thick marker.
the joy of an engineer is to find a straight line in a double logarithmic diagram
But in my explanation, there is no x axis.
No but it holds more generally. Taking the log of data tends to make it look "more correct" even when it's not theoretically justified, and this can lead to very wrong conclusions.
Matt Parker says it's because that's how humans are naturally inclined to think, and used the midway point between 1 and 9 to illustrate. We'd say five but "children and others not exposed to math would say 3" and then gave some explanation with beads or coins. It didn't make sense to me but I do know that if a graph is log scale I need to actually look at it harder to make sure they're not trying to pull a fast one on us here folks.
How timely! I just learned how to use a slide rule yesterday. Looking to pick one up, and a bit overwhelmed by the plethora of choices, I went down a small rabbit hole[0]. Some slide rules produced are pure works of art!
Lately, I've been rediscovering the surprising niceties that analog tools can provide over our everything-is-a-panel-of-glass interfaces these days. Recently, I have been enjoying pen and paper as my editor for initial drafts of projects I'm coding.
Does HN have love for any analog tools in particular?
[0]:https://sliderulemuseum.com/
I've been doing a math course and occasionally think of picking up these analogue tools. Someone on Hacker News had me interested in the Soroban, the Japanese abacus [1], which is still used to train insane mental math speeds to this day [2].
1. https://en.wikipedia.org/wiki/Soroban
2. https://www.youtube.com/watch?v=s6OmqXCsYt8
We're definitely on a similar wavelength. I actually own a couple Japanese abaci and know the basics. Top performers feel near magical: double-fisters[0] and blazingly fast mental arithmetic [1].
[0]:https://www.youtube.com/watch?v=EK6uIjjkrGE
[1]:https://youtu.be/-kjUCtqSWlw?feature=shared&t=451
I have several slide rules and use them daily. Especially in the kitchen where we deal a lot with scaling proportions they are the best tool available: you set them for the desired scale, and then you can just read off any proportion you need in the blink of an eye.
I'm honestly surprised they are not standard issue in kitchens.
Soroban. Japanese abacus. Every number only has one representation. +-*/ and other calculations.
http://totton.idirect.com/
Where can I get the meter-long slide rule the man is holding in OP?
They show up on eBay. A search this minute revealed two:
https://www.ebay.com/itm/205220626817 https://www.ebay.com/itm/156686655356
They go for a bit more than the original price, according to this:
"Pricing varied by retailer, however Pickett did offer demonstration slide rules in 4 foot and 7 foot lengths: a 4 foot rule sold for $15 and the 7 foot rule was $25 in 1960. These were available with scales to match models N4, N803, and N1010 with the Ln scale added. These large rules were available free to schools which ordered 24 or more slide rules!"
[0] https://www.sphere.bc.ca/oldsite/test/pickett.html
Indeed, I use pen/pencil and (dot) paper. Different brain space.
Here's an logarithmic fact that I've made use of frequently:
If X is a random variable having a uniform distribution between zero and one, then –ln(X)/λ has an exponential distribution with rate λ.
This relationship comes in handy when, for example, you want to draw weighted random samples. Or generating event times for simulations.
The general version of this is called inverse transform sampling [0], which uses the fact that for the cdf F of any random variable X the random variable Y = F(X) has a standard uniform distribution [1]. Since every cdf increases monotonically on the unit interval, every cdf is invertible [2]. So apply the inverse cdf to both sides of the previous equation and you get F^-1(Y) = X is distributed like X.
Sampling from a standard uniform distribution and then using the inverse transform is the commonest way of generating random numbers from an arbitrary distribution.
0. https://en.m.wikipedia.org/wiki/Inverse_transform_sampling
1. https://en.m.wikipedia.org/wiki/Probability_integral_transfo...
2. Not every cdf is one-to-one, however, so you may need a generalized inverse.
For the particular case of the exponential distribution we can go further. By taking advantage of the theory of Poisson processes, we can take samples using a parallel algorithm. It even has a surprisingly succinct SQL translation:
Notice our exponentially distributed random variable on prominent display in the ORDER BY clause.If you're curious, I explore this algorithm and the theory behind it in https://blog.moertel.com/posts/2024-08-23-sampling-with-sql....
Quite off-topic, but do you know when you'll write the article about CPS, if ever?
Oops. I had quite forgotten that I need to write about that. I said I would over a decade ago, so that's a long time for you to wait. Sorry about that.
I mainly write for myself, so I need the time and the motivation. Until recently, my job at G took up my time and also provided an internal community where I could scratch the writing itch, which reduced the motivation for public writing on my blog. But now that I'm semi-retired, I'll try to write more frequently.
Thanks for the accountability!
Inverse transform sampling is a special case of normalizing flow where we don't need to learn anythin.g
https://en.wikipedia.org/wiki/Flow-based_generative_model
One way to understand why without writing down the CDF/PDF:
When X is an exponential variable and c is a constant, X + c has the same distribution as X after conditioning on large outcomes. In other words, these two variables have same "tail." This is true exactly for exponential distributions. (Sometimes this is called "memorylessness.")
Similarly, when U has a uniform distribution on [0, 1] and c is a constant, cU has the same distribution as U after conditioning on small outcomes.
But if cU is distributed like U near 0, then -ln(c U) is distributed like -ln(U) near infinity. But -ln(c U) = -ln(c) - ln(U), so the tail of -ln(U) doesn't change when we add a constant, meaning it must have an exponential distribution.
How long do I have to study math to understand this?
Most textbooks on probability have some discussion of the relationships between the various distributions commonly in use. If you just want a quick overview, I found John D. Cook’s diagram to be handy:
https://www.johndcook.com/blog/distribution_chart/
Possibly unhelpful answer: Arguably none! This is presented as a surprising fact, but you could easily argue that this is the proper definition of an exponential distribution. If you do
x = -log(rand())/lambda
a bunch a times, that comes from something, right? Well, let's call that something an exponential distribution.
From this perspective, the thing that actually needs math is finding the density function of the exponential distribution. (For that, in theory you just need calc 101 and probability 101.)
Unless I'm missing something, this can just be directly verified, no “understanding” necessary. All you need to know is that probability distributions can be characterized by their probability density function (PDF).
If Y=-ln(X)/lambda, then P(Y<a) = P(-ln(X)/lambda<a) = P(X>exp(-lambda a)) = 1-exp(-lambda a).
And if Z is exponential with rate parameter lambda, then P(Z<a) = P(lambda exp(-lambda t)<a) = integral from 0 to a of lambda exp(-lambda t)dt, which can be directly computed to be 1-exp(-lambda a).
They have the same PDF, so they're the same distribution.
I mean if starting from scratch that seems like many years in most western education systems to get to probability, logarithms, exponentiation.
I would say If you knew 2+2=4, and not much else you're years away from 'understanding', if you know ln(exp(y)) = y, and P(x>0.5) = 0.5 for a uniform distribution on [0, 1) then you don't need any additional understanding.
I would bet the GP comment is somewhere inbetween the two extremes, but I think a random sampling of the population would likely result in people generally not knowing the log / exponentiation relation, or anything about the uniform distribution.
Yea got many answers and I dont understand a single one. Good thing you barely need math in programming.
I love that you asked this, but I think it's not quite the right question.
I've been wishing for years that someone would maintain a "dependency graph" for mathematical concepts. I think Khan Academy tried to do something like this at one point but took it down a long time ago. As long as we're far enough from the bleeding-edge of research topics, I feel like maths is the one field where this might be possible to do really well. You should be able to point at something you don't understand and trace backwards in a very granular fashion until you hit a concept you already know/understand, and then learn what you need to fill in the gap!
That's more-or-less the purpose of https://mathworld.wolfram.com/ or at least, it's significantly better at it than, say, wikipedia.
I had wanted to build a website like this as a hobby, except not limited strictly to mathematical concepts. I wanted to build a graph of the skills/concepts you’d need to understand electrical impedance, fix an air conditioning system, bake bread reliably.
One source of information could be course syllabi, which describe a progression of topics and their prerequisites.
Rather than be the authority on what concepts must precede others, I envisioned making a system that could represent different educational approaches: not every educator agrees that Calculus I ought to be a prerequisite for studying Physics I. Not all bread recipes use yeast.
I had a hard time finding a good domain for this effort. “Tree of knowledge” dot TLD was taken.
Not long. We were taught logs, and use of log tables, at Middle School. So probably around about age 11.
I also vaguely recall a couple of lessons where we went over Napier's Bones, and they had us produce equivalents on pieces of paper to cut out and move around.
I believe I still have my school day log tables around somewhere. I'd just have to practice for 1/2 hr to remind myself how to use them. That said, they did have usage instructions in the last few pages.
Look im 30, most people I know have forgotten all of school math long ago, me included. Entry barrier too big now.
Having scanned through his book, it makes it seem overly complex.
At middle school, this was taught after having only done simply arithmetic and learning about fractions (rational numbers) in primary school, then decimal fractions in middle school.
The use of logs from the tables was simply a set of basic rules for how to apply them to a few scenarios. I can't recall if it covered trig with those tables, but I doubt it.
I learnt as a child between 10 (when I started middle school), and say around 12 at most. I've forgotten the use, but vaguely recall some way of representing negative numbers in the table (n-bar, with a bar above the digit).
I'm way over 30. I never used log tables after high school, and have forgotten the rules for usage, but recall it didn't take long to learn the first time. *
However for simple uses (multiplication and division) I'd expect I'd be able to pick it up again in at most a weeks worth of practice. It would be made a lot easier now by being able to compare and check calculations with a computer or pocket calculator.
I'd expect any adult able to program a computer to also be able to pick it up in a similar period, or at most a month.
Remember we used to teach this to kids, and expect them to be able to pick it up (if not be accurate in application) in under a weeks worth of lessons.
* Note I didn't even know how to do long multiplication when I learnt, as due to political interference with teaching curriculum, I'd not been taught at primary school.
Khan academy could get you through it, in I'd guess a month or three, depending on your time available.
It seems like there's always more than one way to skin a cat, but I'd have turned to calculus, had I needed to derive something like this and didn't think to look it up (e.g., before the Internet).
Depends where you're starting from but from highschoolish maths you can probably sort this out in a few hours or days.
All you need is plot -log(x) for x between 0 and 1 and you will see that log(x) transforms a uniform line into an exponential decay (towards 1). Its being said in a fancy way. This is also the origin of the log likelihood loss function in ML
If you study calculus and introduction to probability theory, then you're ready to learn this. So the answer is about 2 years after high school.
to understand what they said, or to understand a proof of why it would be true?
any stats class would be enough to understand what they said
I know what all these words mean, it "makes sense" to me in the sense that I read it and I think "ok.." but I wouldn't have the slightest idea how to use this to get weighted random samples or "generate event times."
So I guess I "understand it" in the sense that it doesn't sound like a foreign language, but I can't apply it in any meaningful way.
Depends on how much you practiced high school math. It's not hard but we forget it without practice.
Ask chatgpt to explain it to you like you're 18. It made it really easy to understand.
I started using LMAX Disruptor for some projects. One quirk with Disruptor is that the queue size always has to be an exponent of two.
I wanted to make sure that I always have at least enough room for any size and I didn't want to manually compute, so I wrote this:
A bit much for a single line, but just using some basic log rules in order to the correct exponent. I learned all this in high school, but some of my coworkers thought I was using this amazing, arcane bit of math that had never been seen before. I guess they never use log outside of Big-O notation.This is perfectly usable, of course, but I’d write
purely to avoid involving the horrors that live beneath the humble pow() and log().(Integer.highestOneBit, also known as “isolate leftmost bit”, “most significant one”, or the like, essentially has to be a primitive to be efficient, unlike its counterpart for the lowest bit, x&-x. The actual CPU instruction is usually closer to Integer.numberOfLeadingZeros, but that’s just a bitshift away.)
The above gives an incorrect result for approxSize = 1 (namely 0). The following works (for values up to 2^30, of course):
Or, if you want 0 to map to 0 instead of to 1: Of course, you could also use a variation of:That's pretty cool; I didn't even consider doing any cool bitwise arithmetic.
I didn't particularly care about performance or anything for this particular case, since it runs exactly once at the start of the app just to initiate the Disruptor.
shouldn't it be
var actualSize = 1 << Integer.highestOneBit(approxSize - 1);
?
Nope. I don’t know why the Java folks decided not to use the fairly standard verb “isolate” for this method, but that’s what it is[1]:
> public static int highestOneBit(int i)
> Returns an int value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit in the specified int value. Returns zero if the specified value has no one-bits in its two's complement binary representation, that is, if it is equal to zero.
There isn’t a straight floor(log2(·)) as far as I can tell, only Integer.numberOfLeadingZeros, and turning the former into the latter is annoying enough[2] that I wouldn’t prefer it here.
[1] https://docs.oracle.com/javase/8/docs/api/java/lang/Integer....
[2] https://docs.oracle.com/javase/8/docs/api/java/lang/Integer....
Thanks. What a weird API.
Just shift the size to the right 1 bit and count the shifts until the value turns to zero, and you'll get your number 2 exponent for the size :)
Yeah love this angle - I made a video in a similar vein: https://www.youtube.com/watch?v=OjIwCOevUew
I can strongly recommend memorising some logarithms for use in mental maths. It's given me powers I did not expect to have! Here's what I wrote about it when I started: https://entropicthoughts.com/learning-some-logarithms
What reflections do you have putting this into action over the year since that post?
BTW, your blog is one of my absolute favorites!
It's been about as useful as one would expect. I don't need it daily, but when I need it, I can usually estimate a good enough answer in the time it takes someone else to do it on a calculator.
It has also helped a little with getting a geometric appreciation for numbers, but I suspect that could be improved significantly with more active practice.
Great blog!
Interesting fact that memory decay also is inherently logarithmic/exponential.
Learning logs with SRS is so meta.
The Logarithmic derivative is also something that is surprisingly fundamental.
(ln(f))' = f'/f
In function theory you use it all the time. But people rarely notice, that it related to a logarithm.
Also the functions that have nice logarithmic derivative are a lot more interesting than expected. Nature is full of Gompertz functions. Once you're familiar with it, you see it everywhere.
There used to be practical value to be able to do some basic back of the envelope log calculations in your head (no calculators, this was how you did fast multiplications/divisions or exponents). There's a story in Feyman's Surely you're joking book about Los Alamos scientists doing speed competitions for mental log calculations
(I'm sure this is in the book) John Napier, the father of logarithms (the N in ln), basically had a sweatshop of human calculators making log tables over something like 20 years - critical for celestial navigation. There was a huge price attached to the person that developed a method to safely navigate across the oceans, also lead to the invention of the pocket watch
isn't the n in ln "natural" ("logarithm natural")?
yes i was taught that "ln" stood for "natural log"
would be interested to hear other definitions!
I learned the multiplication using addition and a lookup table in a class taught by Huffman (of Huffman compression fame). You weren't allowed to use a calculator on the test.
But my absolute favorite trick is base conversions, https://www.khanacademy.org/math/algebra2/x2ec2f6f830c9fb89:... with some practice you can do approximate base conversions (power to 2 to power of 10 or e) in your head
A 300 year old log table! What an opportunity to confirm Benford’s Law!
https://en.m.wikipedia.org/wiki/Benford's_law
“The discovery of Benford's law goes back to 1881, when the Canadian-American astronomer Simon Newcomb noticed that in logarithm tables the earlier pages (that started with 1) were much more worn than the other pages.”
One of my favorite tricks in elementary school was to convince people I can calculate any logarithm for any number of their choosing.
> Me: Pick any number.
> Friend: Ok, 149,135,151
> Me: The log is 8.2
Of course I'm simply counting the number of digits, using 10 as the base, and guessing the last decimal point, but it certainly impressed everyone.
You can do even better if you memorize three numbers: 301, 477, 845. These are the values of 1000log10(n) for n = 2, 3, 7. From these you can quickly get the values for 4 (= 22), 5 (=10/2), 6 (=23), 8 (=222) and 9 (=33).
For your example 1.49 is close to 3 / 2 so the log will be very close 0.477 - 0.301 = 0.176.
This means that your answer is near 8.176 (actual value is 8.173).
This tiny table of logs can also let you answer parlor trick questions like what is the first digit of 2^1000 (the result is very nearly 10^301 but a bit above, so 1 is the leading digit).
> 149,135,151
This is 8-point-something as you say.
1.49 is in between 1.2 and 1.6 and I have memorised log(1.2)=0.1 and log(1.6)=0.2, so I would think log(1.5) is close to 0.17, using sloppy linear interpolation.
That would make log(149,135,151) approximately 8.17. My calculator also says 8.17. Your guess was good!
I have found linear interpolation such an intuitive approximation method that the tradeoff of having to memorise more logarithms is worth it.
Logging the World - Oliver Johnson (Oxford Mathematics): https://youtu.be/UsK52iZMsxo
There was an interesting text, by Isaac Asimov, where he explained in a very clear way the historical importance of logarithms -- they allowed Kepler to finalize his work by replacing tables of multiplications (which were difficult and error-prone) with sums.
Realm of Algebra by Isaac Asimov: https://archive.org/stream/RealmOfAlgebra-English-IsaacAsimo...
The traditional explanations of logarithms I've encountered are far too math and terminology heavy for most people to grasp.
Think of a number line.... show example..... 1..2..3..4..5.. etc
Any given move to the right, makes the value go up by 1.
But... What if we did a special number line where each time it doubled instead of adding one? 1..2..4..8..16, etc...
That line would go up way to fast to see numbers like 10, so we can expand it out a bit...show that... and start to fill in the numbers... 2^10 (1024) is almost 1000... so you can divide that distance by 3 to get 10 on the line, then move one unit left for 5... and build out a slide ruler.
Computing logarithms with a 4 function calculator isn't hard by the way, I used to do it for fun on my lunch breaks.
Wow, I thought it was just some random guy, but was then quite surprised to see this was being authored by none other than the legendary Charles Petzold. I'd buy this book - just to put it next to my copy of "Programming Windows 95" (who remembers?) :)
I have a few old math manuals at home, from late 19th / early 20th century. Many of them have a logarithm table as an appendix. It looked like the type of things that if you had a few extra sheets to print to make a booklet, you'd just add because it was bound to be very useful to someone.
Charles Petzold was one of my favorite tech authors from the way begone era. Written in a style very similar in vein to the Lost of Art of Logarithms he made me fall in love with the various mundane tech concepts that would never jump out as a anything of interest, otherwise. What a treat!
Programming Windows 95 was invaluable.
I wish there was a mailing list I could subscribe to so I could know when the book os complete.
Or a pre-order on Amazon?
I recommend the classic Introduction to Logarithms, by Cormen, Rivest, Leiserson et al.
> Charles Petzold
Haven't heard that name in a while. For me he's the WinApi guy - learned a lot from him when I first started programming.
PC Magazine contributor, for me.
Still can! His classic book Code is fantastic and has a recent second addition.
Code is a masterpiece.
Anyone here who hasn’t read it should do so - you might think it’s ’below you’, but it’s so well written it’s a joy to read, and I suspect you’ll come out thinking of some things differently.
It reminded me why I love computing.
^edition.
Notation for writing log has always bugged me. Like I feel like it should be more like <10>^<527> which would be the log base 10 of 527. That's not it, but something. The current notation just doesn't feel quite right.
https://mathcenter.oxford.emory.edu/site/math108/logs/
Some people have suggested the "triangle of power".
I never understand why anyone thinks its good notation. The layout means nothing and lets you infer nothing because exponentiation isn't a 2d planar geometric operation. All the information and rules are contained in the idea "exponentials map the additive reals to the multiplicative reals".
The notation conveys no information at all, and provides no means of proving anything, and even the notation for function composition is worse.
Given the operator pow : R^2->R there are 2 possible inverses. root and log
root isn't even interesting. its just pow with the 2nd argument precomposed with reciprocal. root x b = pow x 1/b
https://www.youtube.com/watch?v=sULa9Lc4pck
Yea; this owns. I used it for my own stuff.
I've never seen this before, and I LOVE it! I'm a new advocate!
I think it's good for explanation purposes, but not actually great as notation, especially for operations that are so common, too much room for ambiguity, especially when writing quickly.
The Triangle of power explanation of logarithms is what really got me across logs.
It wasn't until seeing the triangle and having the relationships explained that I had any clue about logarithms, up until then logs had been some archaic number that meant nothing to me.
Because of the triangle of power, I now rock up to B and B+ Trees and calculate the number of disc accesses each will require in the worst case, depending on the number of values in each block (eg, log2(n), log50(n) and log100(n))
Ironically, that notation, which I just discovered, confuses me more than anything else. Logs clicked for me when someone online said "amongst all the definitions we have for logs, the most useful and less taught is that log() is just a power". At that exact instant, it's like if years of arcane and foreign language just disappeared in front of my eyes to leave only obviousness and poetry.
That is not without humour :)
I don't understand the comment about it just being a power, but, for me, knowing that it's filling in the third vertice on the triangle with exponents at the top, and n on the other is what makes it work for me - I now know in my head when I am looking for the log of n, I am looking for the exponent that would turn the log into n.
I don't go looking for the exact log, I only look for whole numbers when I am calculating the value in my mind.
But it makes sense when I am looking for the log2 of 8 to know that the answer is "what exponent will make 2 into 8"? and that's "3"
Well, currently exponentiation has a superscript exponent to the right of the base, and logs have a subscript base to the left of the exponent. They're already very similar to your example, but they also include the word "log".
One of the best uses of logarithms is how they can be used to quickly calculate db (as in decibel) gains and losses mentally. See this older comment for more details
https://news.ycombinator.com/item?id=32550539
Is this the same author who wrote Win32 API books?
Yes. https://www.lostartoflogarithms.com/author/
Yes the office door stop as it was known as at our place. Top book though just faded in utility and no one had the heart to dispose of it because of the good memories.
Good book indeed, just that I wouldn't use a book to look up Win32 API functions.
Oh, the hours I'd spend browsing through tech books back in the day... good times.
Yeah, a good tech bookstore was a golden way to spend an hour.
It used to be the only way!
Well written and fun to read! (For nerds)
I feel frustrated that we cannot conceive of numbers like 10^80 (atoms in the universe) or 10^4000 (number configurations for a system with 4000 variables having 10 states each). Maybe there are superbrains out there in the universe that can do so.
I guess you have to define what you mean by "conceive".
I'm not sure you can even conceive a number like 1,000, if you're talking about holding an intuitive visual understanding in your mind at once.
Like, I can easily see 100 in my mind's eye as a 10x10 grid of circles. Even if I don't see each one clearly, I have a good sense of the 10 on each edge and the way it fills in. But ask me to imagine 10 of those side-by-side to make 1,000, and I don't think I can. Once I imagine the 10 groups, each one is just a square simplification, rather than any individual pieces within.
But I'm totally familiar with 1,000 as a concept I can multiply and divide with, and I can do math with 10^80 as well. And I can do so fairly "intuitively" as well -- it's just all the numbers up to 80 digits long. Even 4,000 digits fits on a single page of a book.
My first cut at conceiving is to answer "how long would it take a really fast computer to count to that number". The answer for 10^4000 is still something like 10^3978 years. So, a still inconceivable time.
(100 tera-ops computer) [edited to correct calculation)
But the length of time it takes a modern computer to count to 10 or 1,000 is perhaps inconceivably small by your metric, no? Your idea arbitrarily selects numbers around 2 billion as being conceivable, at least for a single core on my MacBook.
But my question isn't what makes 10^4000 inconceivable -- my question is what makes 10^4000 any less conceivable than 1000. To me, they're both firmly in the realm of abstractions we can reason about using the same types of mathematical methods. They're both qualitatively different from numbers like 5 or 10 which are undoubtedly "conceivable".
the length of time it takes a modern computer to count to 10 or 1,000 is perhaps inconceivably small by your metric
But I'd just call it "instantaneous" and something I experience frequently. Whereas 10^3978 years is beyond experience and even imagination.
> But I'd just call it "instantaneous" and something I experience frequently.
Then since you're OK with all smaller numbers being equally "instantaneous", then 1/10^4000 seconds is instantaneous too. Add up enough of those to make a second, and you can conceive of your previously inconceivable number! :)
Of course, that will seem silly. I'm just illustrating I don't think there are any grounds for claiming exponentially large numbers are inconceivable, but exponentially small numbers are somehow conceivable. They're just as far from 1, multiplicatively, no matter which direction you go in.
All right! I cannot count to any fractional number, even conceivable ones, so using the counting time to assess conceivability fails for all fractions.
For small numbers, groping for any experience in the macro world fails once you get below the Planck scale.
I'm afraid you might have broken the fabric of the universe by even typing such a small number.
Read http://mrob.com/pub/math/largenum.html . After that you'll probably look easier to those numbers.
I feel like I have a much better grasp of those numbers since I started using logarithms for mental maths: https://entropicthoughts.com/learning-some-logarithms
To me it's hard because we don't come across these magnitudes on a daily basis. Grains of sand on a beach is an off the top of my head way to visualize such quantities. But yeah, numbers that big, are so big that we have nothing to compare them with.
So interesting! The author doesn’t, I believe, yet cover how the first log tables were computed (by hand), so I asked ChatGPT. This may be of interest: https://chatgpt.com/share/67d3a64d-f8a8-8012-bde3-e80813b2b4...
If the author is in here, thank you. Been looking for a text for my daughter on the subject. This might just fit the bill. If you're just the linker, then thank you Ozanonay.
Notes from "How should logarithms be taught?" (2021) https://news.ycombinator.com/item?id=28519356 re: logarithms in the Python standard library, NumPy, SymPy, TensorFlow, PyTorch, Wikipedia
Charles Petzold wrote one of my favorite books - "Code: The Hidden Language of Computer Hardware and Software". Very excited to see how this turns out and thanks for giving some of this knowledge away for free!
I would also recommend the "NAND to Tetris" book. Covers much the same ground (as I remember things anyway) but is a hands on approach. I enjoyed Code also though and is worth a look for those interested.