| 17 | | If [[latex($\hat{z}$)]] is your approximate solution, and z is the exact solution, then the absolute error is just given by [[latex($E(h)=|\hat {z}-z|$)]] |
| | 17 | If [[latex($\hat{z}$)]] is your approximate solution, and z is the exact solution, then the absolute error is just given by [[latex($E(h)=|\hat {z}-z|$)]]. This is an okay measure when z is in units scaled to a magnitude order of 1. (If not, then the error will may appear unexpectedly large or small due to scaling). |
| | 18 | |
| | 19 | == Relative error == |
| | 20 | |
| | 21 | [[latex($E(h) = |\frac{\hat{z}-z}{z}|$)]] |
| | 22 | |
| | 23 | This measure always gives the same error, regardless of units working in. The error is often [[latex($\propto 10^{-k}$)]], where k is roughly the number of digits the approximation is correct to. |
| | 24 | |
| | 25 | == Note on choice == |
| | 26 | |
| | 27 | It is often just best to scale the problem so that the measured quantities scale roughly to magnitude order of 1 (so the absolute error is a fine measure), and that the quantities are not many orders different than each other for unphysical reasons. This will help prevent bugs in numerical codes. |