Hacker's Guide to Numerical Analysis
bollu.github.io
bollu.github.io
Because if I have a six digit meter and I measure 5.0000 volts I know that it is 5.0000 volts. I don't see why that is confusing at all.
"Here, yyy has correct one and three significant digits relative to xxx, but incorrect 2 significant digits, since the truncation at x2x_2x2 and y2y_2y2 do not agree even to the first significant digit. "
This doesn't make sense. Y has the correct one?
I think you might be confused about the purpose of significant digits. SD are intended to be paired with a tolerance. If there is no tolerence quote with the number, it is meaningless to talk about significant digits. You arbitrarily defined the tolerance as +/0.5 (half a unit). That is not always true, almost never true. Consider test equipment, not every multimeter is going to be +/0.5mV, some might be +/-.3uV. It varies.
When a number is given without any further information,
it is generally interpreted so that the last digit is
rounded with a rounding range equal to 1 in the last digit
(see Annex B). Thus, for example, the number 401 008 is
generally assumed to represent a value between 401 007,5
and 401 008,5. In this case, the maximum magnitude of the
error in the number 401 008 is 0,5.
This is consistent with the author’s “less than half a unit.”[1] JCGM 100:2008, Evaluation of measurement data — Guide to the expression of uncertainty in measurement, https://www.iso.org/sites/JCGM/GUM-JCGM100.htm
[2] ISO 80000-1:2009, Quantities and units — Part 1: General
But of course it isn't a big deal to lose that dgiti because a trailing digit is 0.1 as much error fraction when the leading digit is 9 vs 1.
But the measurement was done with a number of significant figures, this is independent of how you write it. Nothing is "lost", if measurement had 2 sig figs it is 0.99, if it had 3 it was 0.990. Or 0.991 or whatever.
Am I missing something?
They said if your device measures 1.00, it is three significant digits. If it measures 0.01, it is one significant digit. From the same measuring device.
So it is counter intuitive that the measurement just going down below 1 somehow causes it to "lose" significant digits. It didn't lost precision, though. Just the number of digits that are significant.
Consider you have a 10 meter stick with centimeter meetings. This can give 0.01 as the smallest measure. A number with 1 significant digit. It can also give up to 10.00, a number with 4 significant digits. In both, the precision of the measurement is to a centimeter.
The trailing zero was part of the measurement and, hence, is included in the significant digit count.
That also means you can't just measure 1.7320, and report 1.73200 instead (or 1.732). You have to report only, and exactly, what you measured.
(I'm ignoring rounding in what I said).
This is almost completely wrong: the number of significant digits is something given by metadata, you cannot look at a number and know that it has been properly rounded to the correct number of significant digits. You always need to be told this special circumstance because most numbers you encounter have in fact not been properly rounded.
.000300 you have 3 significant figures.
But in this case: 300000 you could have 1 to 6 significant figures.
The convention to deal with this is always to use scientific notation: 3.00x10^5 has three significant figures.There is the odd case of trailing zeroes in non decimal numbers, but otherwise if a number is written, when is that not assumed to be significant?
That is, there are fairly standard rules for conveying significant digits, I thought?
For example, the number you are viewing could have been produced with finite precision floating point math and then just rounded to an arbitrary chosen (small) number of digits.
IOW, the final significant figure has continuously variable significance (but discretely intervalled numerically) depending on the absolute value of what is it supposed to be significant to.
This is a feature of granularity.
And rounding error has a variable influence on the intervals and how "discreet" or blatant any error may appear.
Then you've got error propagation and pretty soon you're going to need something like Gustafson's UNUM's:
> This doesn't make sense. Y has the correct one?
I think that's a language issue, like "that x̂ agress to x upto p" in the next section. I think what they're trying to say is the following. If you round x = 0.9949 to 1, 2, or 3 significant digits, you get 1, 0.99, or 0.995 respectively. If you round y = 0.9951 to 1, 2, or 3 significant digits, you get 1, 1.0, or 0.995 respectively. So x and y look equal if you round to 1 or 3 significant digits, but not if you round to 2 significant digits.
The first point explains something as basic as absolute and relative errors. Great.
1 page down (s)he's casually thrown in function notation with R representing the real numbers with no explanation. Anyone who isn't familiar with this notation is immediately intimidated. But I'd wager almost anyone who is familiar with it didn't need to read the page before it. But also, I think it's just unnecessary to be this specific in the first place, if you're trying to quickly explain concepts.
It's actually a huge problem in maths and even Wikipedia (I feel) is pretty guilty of this.
If you take a (relatively) key mathematical concept, such as the Taylor series, then the opening gambit is completely incomprehensible to anyone who isn't already knowledgeable in maths: https://en.wikipedia.org/wiki/Taylor_series
This, to me, seems in huge contrast with other scientific fields. Medicine wikipedia, for example, caters towards the "average reader" first, and doctors later. This is entirely appropriate for an encyclopedia. For example: https://en.wikipedia.org/wiki/AV_nodal_reentrant_tachycardia...
I wanted a regex one recently. First off, they all presumed mastery of the concept of a string, but more seriously, none of them had a really good definition of a regex! I still can't think of one myself, but I know it's probably not "pattern to match specific strings", because it uses an uncommon meaning of "pattern" and a jargon meaning of "match". And of course they all immediately used terms like "formal languages".
The perldoc page 'perlretut' did pretty well with "a template that is used to determine if a string has certain characteristics" - ok, a bit abstract for my taste, but let's keep going - then a bit further down they use "modifier" (flag) with no definition. But I really had to look hard for flaws in that one. I guess the only way to actually nail this is to supervise successive groups of students as they try to learn using your tutorial-in-progress...
And then an example like "Look, you have your Word document and you are looking for ..."
In the Wikipedia page you linked, I immediately encounter several terms that I do not know the meaning of. I must either click through or search separately to fill in my own gaps.
Your criticism is not totally disagreeable, but we have to wonder where to draw the line. Is a "Hacker's Guide to Numerical Analysis" obligated to hold your hand all the way through basic notation? The notation that you mention in your comment are the "Hello world" of mathematics.
In saying that, in general I've found it's not too bad. Mostly greeks and the occasional symbol like sigma along with some set notation.
I'm not sure if it is really possible to learn/teach math (like actual math, not just some loose intuitions, because those don't really help you with anything) without going through notation and prior knowledge. Notation exists for a reason.
#include <cmath>
#include <stdio.h>
The code looks almost like pure C, but that little `c`...I suppose one other specific example of a similar concept would be that when training deep learning models models you're doing a ton of matrix multiplication and tweaking the weights constantly. Especially when using lower-precision numbers, you can hit issues where your coefficient gets too close to 0, and the next thing you know it IS 0, and everything it gets multiplied by also comes out to 0, which messes everything up. So you have to avoid getting too close to 0: https://pytorch.org/docs/stable/amp.html#gradient-scaling.
The inability to represent very big values as well as very small values might need to be worked around.
I needed to overcome this back in 1982 (before 16-bit portable PC's, and PC's were not yet popular at all) to do equivalent calculations on an 8-bit TRS-80 in 0.5K of BASIC program memory, to what was officially developed by 1980 in many pages of 32-bit FORTRAN.
The algorithms had been well established for decades but always implemented using the equivalent of trig tables until the mainframe was capable of substituting (or even automatically printing the official tables!) after 1980.
One volume of the published tables was bigger and weighed more than the TRS-80 portable.
Ended up using something like the 21st century Gustafson approach for my little problem back then, now he is a mathematician pursuing a brilliant more universal solution.
By 1982 it didn't bother me that my integer algorithms were dramatically different than the official floating-point FORTRAN. I had gotten accustomed to morphing fundamental equations by computerizing much less onerous tables where the simple near-linear equation was useless because the published tables contained official rounding errors from the original slide-rule calculations. To match the official calculations that time, the convergence of manual and automatic rounding errors took major precedence over the underlying equation which actually was defined by physical properties.
> Since the relative error is invariant under scaling (x↦αx)(x \mapsto \alpha x)(x↦αx), we will mostly be interested in relative error.
No, No, No, No. This is very much dependent on what you are measuring/modelling, what is the tolerance you are willing to accept, the consequences and so on.
A 1% of error in the change the cashier gave you back maybe is not a big deal. That same error in the national budget is equivalent to 2X the NASA's budget.
Well then you're missing the whole point completely.
> My rule of thumb is that anything title "...for Hackers" is crap
Remind me what site you're on again?
Although I do think that kind of rule of thumb is dumb. I've read plenty of materials with titles like that that have been informative and well written.