Notation for writing log has always bugged me. Like I feel like it should be more like ^ 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".
The Lost Art of Logarithms
21–30 of 204 posts
Re: The Lost Art of Logarithms
#22I 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…
This is perfectly usable, of course, but I’d write var actualSize = Integer.highestOneBit(approxSize - 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 u…
var actualSize = 1 ?
Re: The Lost Art of Logarithms
#23Earlier quoted context omitted.
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.
Re: The Lost Art of Logarithms
#24Here'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.
Re: The Lost Art of Logarithms
#25Earlier quoted context omitted.
This is perfectly usable, of course, but I’d write var actualSize = Integer.highestOneBit(approxSize - 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 u…
shouldn't it be var actualSize = 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....
Re: The Lost Art of Logarithms
#26Here'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.
How long do I have to study math to understand this?
any stats class would be enough to understand what they said
Re: The Lost Art of Logarithms
#27Here'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.
How long do I have to study math to understand this?
Re: The Lost Art of Logarithms
#28Re: The Lost Art of Logarithms
#29Here'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.
How long do I have to study math to understand this?
Re: The Lost Art of Logarithms
#30Here'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.
How long do I have to study math to understand this?
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!