The Lost Art of Logarithms(lostartoflogarithms.com) |
The Lost Art of Logarithms(lostartoflogarithms.com) |
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.
(100 tera-ops computer) [edited to correct calculation)
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. Whereas 10^3978 years is beyond experience and even imagination.
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.
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.
Plus, unit record equipment was cool.
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.
Although the math in the book is relatively basic I enjoyed it tremendously because it gives the historical development for everything and even describes the characters of different mathematicians, etc. The historical context helps so much with understanding.
This approach was to align with the Soviet philosophy of dialectical materialism, which claims that all things arise from a material need. Not sure I'm fully onboard with the philosophy as a whole, but Kolmogorov's book was really eye opening.
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.)
For other people, you need to swim in the original problem for a while to see the light.
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.
Take logs, add 2 + 3 = 5 and then raise it back to get 10^5.
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.
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.
So we were taught logarithms as a tool first.
It gives the history / motivation behind logarithms and suddenly it became so much clearer to me. Pretty much multipling huge numbers by adding exponents , well I think I've understood that correctly?
I think why I'm so interested in programming and computing is because I fascinated by the history of it all. It somehow acts as a motivation to understand it.
He covers the inverse of the exponential, Henry Briggs' log tables and goes on to e^ix = cos x + i sin x
The audio is also available https://www.feynmanlectures.caltech.edu/flptapes.html
a * b = f(a + b) - (f(a) + f(b))
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.
> 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.
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?
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.
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. 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.)
var actualSize = Integer.MIN_VALUE >>> Integer.numberOfLeadingZeros(approxSize - 1) - 1;
Or, if you want 0 to map to 0 instead of to 1: var actualSize = Integer.signum(approxSize) * Integer.MIN_VALUE >>> Integer.numberOfLeadingZeros(approxSize - 1) - 1;
Of course, you could also use a variation of: var actualSize = Math.min(1, Math.Integer.highestOneBit(approxSize - 1) << 1);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.
var actualSize = 1 << Integer.highestOneBit(approxSize - 1);
?
Interesting fact that memory decay also is inherently logarithmic/exponential.
Learning logs with SRS is so meta.
BTW, your blog is one of my absolute favorites!
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.
(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.
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
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.”
> 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.
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).
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.
I think it is a really nice idea that should be spread more widely. It might be Pi day, and while I traditionally complain that Tau is better for contrarian reasons (hey at least I'm honest), we might as well co-opt the extra attention maths gets for other mathematical causes.
There's a reason we use scientific notation, and it's actually partly because in the era of slide-rules, it was INCREDIBLY helpful notation that makes it trivial to estimate things like order of magnitude. People performed all manner of operations and kept the magnitude part in their head. It MADE people more magnitude aware.
This magnitude-only based notation is the one that's actually more needlessly complex and error prone. There's no sensible way to manage significant figures or rounding error in simple operations like addition and subtraction. And simple operations, like adding/subtracting two numbers are really non-trivial. If you have to start each operation by converting to a useful format and then converting back, what have you gained exactly by using the notation?
It's not being put forward as a recommended tool for scientists when reasoning about precise values. It's put forward for laypeople when trying to understand the vastness of the universe.
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.
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.
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.
Some people have suggested the "triangle of power".
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
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))
Or a pre-order on Amazon?
I'm honestly surprised they are not standard issue in kitchens.
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!"
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.
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.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....
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.)
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!
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 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.
any stats class would be enough to understand what they said
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.
Normally, a sliderule at distance x has the value of log(x) written on it, which allows doing multiplications by moving along the sliderule, since log(ab) = log(a) + log(b).
Now imagine a sliderule onto which values of x^2/2 are written. This also allows you to multiply two numbers, because ab = (a+b)^2/2 - (a^2/2 + b^2/2).
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.
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.
> 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....
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 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!
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.
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.
Magnitude is an existing and important concept in maths - it would be extremely confusing to just overload it to mean something else.
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"
[1] eg the Beaufort scale for wind force
And logs are frankly more confusing than the other operations because more than anything else they feel like an algebraic expression in the form of an operation. Other operations intuitively feel like a process, whereas logs feel like more like a question.
Maybe that's just because I never learned them super well though, maybe they're not actually that inherently different ¯\_(ツ)_/¯
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.
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.
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.
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 think this is already enough context to root the mental effort deeper.
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.
Mathematics: From the Birth of Numbers, by Jan Gullberg
and
Mathematics: A Cultural Approach, by Morris Klein
https://bogart.openmathbooks.org/ctgd/ctgd.html
And more directly, a quick browse showed up a book called:
"Mathematical Notation: A Guide for Engineers and Scientists" which looks like it addresses your issue directly.
Starting in elementary school you slowly build up topics, mathematical intuition and notation more or less in unity. E.g. starting with whole numbers, plus and minus signs before multiplication, then fractions and decimal notation. By the end of high school you may have reached integrals and matrices to work with concepts from calculus and linear algebra…
It makes little sense to confront people with notation before the corresponding concepts are being taught. So it feels like you may have a different perspective on notation as a layperson that are no longer obvious to more advanced learners.