6 ms·
Logarithmic Scales
- breck 2y agoNice read. (Any chance you could add an RSS feed or similar?)
- darkest_ruby 2y agowould have been a great article if used metric. I cant imaine what 100 inches is, let alone 1000 inches
- deleted 2y ago[deleted]
- KineticLensman 2y ago> Notice how we're not using the ruler for measuring anymore. Instead, we're using it to represent the sizes of different objects. Viewed like this, the fact that it uses inches vs m isn't significant, because 'inches' translates as 'units'. Even as a Brit, I can't imagine 1000 inches either, but I can tell something about two objects that are respectively 1000 vs 1200 inches/units.
- HarHarVeryFunny 2y agoWell, for mental math 1000 inches ~ 1200 inches (100 ft). Or converting to meters: 100 ft / 3 = 33 yards ~ 33 meters. Since we added 20% in the first place (1200 vs 1000), 33 - 20% = 27m is better estimate (actual = 25m).
- nerdponx 2y agoIf you replaced the '"' with 'cm', the analysis and visualizations would be identical.
- leeoniya 2y agoanother nice one is Inverse Hyperbolic Sine scale, which can reach 0 and plot negative values, whereas log scales cannot. imo it's nicer than a cube root scale, too. https://leeoniya.github.io/uPlot/demos/arcsinh-scales.html https://leeoniya.github.io/uPlot/demos/arcsinh-scales.html cube root: https://en.wikipedia.org/wiki/Cube_root#/media/File:Cube-root_function.svg https://en.wikipedia.org/wiki/Cube_root#/media/File:Cube-roo... vs arcsinh: https://upload.wikimedia.org/wikipedia/commons/9/92/Inverse_Hyperbolic_Sine.svg https://upload.wikimedia.org/wikipedia/commons/9/92/Inverse_... some interactive log scale demos: https://leeoniya.github.io/uPlot/demos/log-scales.html https://leeoniya.github.io/uPlot/demos/log-scales.html https://leeoniya.github.io/uPlot/demos/log-scales2.html https://leeoniya.github.io/uPlot/demos/log-scales2.html
- kccqzy 2y agoWow. This is the first time in hearing about the inverse hyperbolic sine scale. I wonder if it's lesser known simply because many kinds of real-world underlying data that needs logarithmic scales simply don't have zeroes or negative values? For example we might be plotting some data that actually comes from an underlying exponential distribution?
- leeoniya 2y agoi think sometimes it's called symlog, though i'm not sure if that's just a convenient re-naming of arcsinh. i don't see how any kind of "log" scale can do <= 0. you can always y-flip the result of log(abs(value)) and show neg ticks on the axis, but it will not be a nicely-continuous, single scale that can cross 0. https://stackoverflow.com/questions/3305865/what-is-the-difference-between-log-and-symlog https://stackoverflow.com/questions/3305865/what-is-the-diff...
- eaglefield 2y agoSymlog is symmetric log. It's not arcsinh, instead it's a normal logarithmic scale, that turns into a linear scale around zero (for example in the range [-1,1]) and then it turns into a negative logarithm on the other side of zero. So similar but slightly different. https://matplotlib.org/stable/gallery/scales/symlog_demo.html#symlog-demo https://matplotlib.org/stable/gallery/scales/symlog_demo.htm... for an example.
- leeoniya 2y ago> that turns into a linear scale around zero how does this actually work? afaik, there is no log() fn that you can run which "becomes linear". i guess you can wrap a call to log() in another fn that simply does linear scaling below the defined threshold, but it's not a smooth transition without a bunch of extra [possibly slow] smoothing code. what you're describing is exactly how a straight call to Math.asinh() behaves, and what i have implemented in the above demo.
- JKCalhoun 2y agoI tried to create a logarithmic widget for the web for anyone to grab. I like logarithmic interfaces — think there are probably a lot of uses for them. I don't exactly know what I am doing when I venture into Javascript and web stuff but here you go: https://github.com/EngineersNeedArt/SlideRule https://github.com/EngineersNeedArt/SlideRule There's a demo page off the link above. It's a janky Ohm's Law calculator. (The top slider & text field are read-only, BTW.)
- jesuslop 2y agoVery natural also in money/investing applications. Passing to log scale asset prices follow random walks in several finance applications and behave much better in this scale. Options price formulas by rote memory are a bit of a mess because one does a log-calculate-exp kind of thing that distorts the streamlined rationale of the inner simpler calculations. Geometric means (used in CAGR, compound aggregate growth rates, for yearly returns) become just means (=arithmetic means) in log scale.
- kccqzy 2y agoAgreed. Any stock app that doesn't plot stock prices in log scale is considered by me to be an amateur app. My favorite litmus test for stock apps is to view the ten-year price history for UVXY. If it doesn't look roughly like a straight line the app is for amateurs. The iOS built in stock app fails this test. The Schwab app passes this test.
- tunesmith 2y agoI've heard of people who have basically converted all their financial or investment spreadsheets to use log scale, but I've never seen an example or a demo.
- kkoncevicius 2y agoSince it is on topic - sharing useful link I have in my bookmarks about transformations in general: http://fmwww.bc.edu/repec/bocode/t/transint.html http://fmwww.bc.edu/repec/bocode/t/transint.html
- barrenko 2y agoNeat!
- mif 2y agoThe graph named “non-linear growth”, is actually showing linear growth. I know, it’s confusing, but as long as the factor is constant (10), growth is linear. A quick way to check if something grows linearly is to put it on a log-scale and to see whether it’s a straight line. Nice explanation, though. We should talk about logs more often.
- kccqzy 2y agoI think you and the author are using terminology differently. That graph is absolutely a logarithmic axis to me. The five ticks on the axis are equidistant but each represents a number 10x of the previous. That's nonlinear to me. My definition of linear growth is that it is bounded above by a linear function. Its first derivative would therefore be bounded above by a constant. If something is a straight line when you plot it in log scale, you are plotting exponential growth.
- nerdponx 2y ago"Linear" here doesn't mean "a linear transformation is applied at each time step", it means "a constant rate of change over all time". Multiplicative growth by a constant factor is an increasing rate of change over time.
- Bimos 2y agoGood point. Also "linear convergence" means the residual reduces "linearly", or |r_{k+1}| = \lambda |r_k| with \lambda \in (0, 1). So it is somehow exponentially converging, and an algorithm with linear convergence is neat and fast.
- levocardia 2y agoIt doesn't really matter what log base you use, visually speaking. All log bases are just multiplicative differences from one another: it's like asking whether it matters if you plot height using feet or meters. It just affects where your ticks go.
- leeoniya 2y agoyep, this was a fun aspect i discovered when doing the implementation as well. the log base just affects the tick/grid selection and where you might want to "nicely" snap the min and max to.
- Tollen 2y agoNo one will see this because I'm shadowbanned but I've always been confused about exponential vs logarithmic. In the authors example about the ruler i'd have thought this was an example of exponential scale in play.
- dhosek 2y agoThe note at the end about different log bases was confused and borderline nonsensical. It doesn’t matter what the log base is. 0 on the scale will correspond to 1, and 1 will correspond to the base. The shape of the curves will be identical regardless of what you choose as a base, only the labels on the scale will change and generally what you really care about with a log scale is less the values that come out than the shape of the curve.
- atombender 2y agoAs a developer I rarely find the need for log scale, but I was recently analyzing performance data, specifically finding patterns where one operation deviated from the normal. For example, if an operation usually takes around 20ms, I would want to know if that operation suddenly took 200ms (a factor of 10). But I wouldn't be interested in small deviations; 40ms, even if it's twice the original number, is this within the natural variance seen due to varying levels of load and so on. Conversely, if an operation normally takes 5,000ms, if it took 10s that would actually be terrible, and I really want to know if it exceeded, say, 6,000ms. In other words, the acceptable deviation is dependent on the scale of the original number. So I ended up choosing a hand-tuned logarithmic function which multiplies the average with a constant divided by the logarithm of the average, the output being the upper bounds on how much deviation from the average we can tolerate. So the larger the number, the lower the tolerance in absolute (linear terms).