DavidB
04-26-2008, 09:36 PM
Here’s a topic about which I’d like a little more information: properly handling round-off errors.
For example, simply calculating the norm of a vector. It seems like one of the more common tasks students come across in their studies; however, at the same time, they are not versed in how to properly do the task. It is not as simple as taking the square root of the squares of all the vector’s entries.
Say we have the vector v, which is composed of the scalar values = (2 3 4).
To compute the norm of this vector, we would
(i) square the three entries: 4 + 9 + 16 = 29
(ii) take the square root of the total: sqrt(29) = 5.3851648...
However, when the vector is composed of many more entries, and some of those entries differ by several orders of magnitude, different techniques are necessary.
Another example: computing roots of cubic and quartic equations.
Although textbook formulae are available, by themselves they are insufficient when coefficients differ by several orders of magnitude; round-off errors must be properly dealt with.
I would be interested in learning more about how to properly handle machine errors, either in this forum or future editions of NR (perhaps just a short chapter). For example, would quantities have to be compared to the machine epsilon, machine epsilon times the smallest entry, DBL_MIN, DBL_MAX, etc.? Is pseudo-code available somewhere (I don’t know about)?
For example, simply calculating the norm of a vector. It seems like one of the more common tasks students come across in their studies; however, at the same time, they are not versed in how to properly do the task. It is not as simple as taking the square root of the squares of all the vector’s entries.
Say we have the vector v, which is composed of the scalar values = (2 3 4).
To compute the norm of this vector, we would
(i) square the three entries: 4 + 9 + 16 = 29
(ii) take the square root of the total: sqrt(29) = 5.3851648...
However, when the vector is composed of many more entries, and some of those entries differ by several orders of magnitude, different techniques are necessary.
Another example: computing roots of cubic and quartic equations.
Although textbook formulae are available, by themselves they are insufficient when coefficients differ by several orders of magnitude; round-off errors must be properly dealt with.
I would be interested in learning more about how to properly handle machine errors, either in this forum or future editions of NR (perhaps just a short chapter). For example, would quantities have to be compared to the machine epsilon, machine epsilon times the smallest entry, DBL_MIN, DBL_MAX, etc.? Is pseudo-code available somewhere (I don’t know about)?