[General boards] [Winter 2023 courses] [Fall 2022 courses] [Summer 2022 courses] [Older or newer terms]

Relative/absolute error formula

Hello,
I am having some confusion regarding the formulae for relative and absolute errros. In the course notes, we treat them as
abs error = (x - x’)
rel error = (x - x’) / x

But in the textbook, we do
abs error = (x’ - x)
rel error = (x’ - x) /x

Where x’ is the approx and x is the actual. Does it matter which formula I use?
Similarly,
In the notes, total error = f(x) - f’(x’) where f’ is the computational approximation of the function f
But in the tb, we do f’(x’) - f(x)

Also the formula x’ = x(1 + delta) uses the textbook formula where delta is the relative error.

So does the order matter in these cases?
Thanks!

You are right. Some people define (abs) error as correct - approximation,
and some as approximation - correct.
And in fl(x) = x(1+delta), the second def fits (that’s what everybody uses.)
In most cases, it does not matter, since the absolute value
of the error (abs or rel) matters most.
In cases it matters, it will be given explicitly.
Also, to be safe, you just define it the way you prefer, and be consistent after.
In A1, q2c, I use ff-f, so I use correct - approximation, assuming the formula you propose is correct! I would suggest not to change it,
so that the output looks consistent to mine.
But for the plot, it does not matter (you are supposed to take abs()).

Note also that, whichever def you take, the relative error is always
with respect to the correct (denominator is consistent in tb, notes, etc).
Only the sign may change.

  [General boards] [Winter 2023 courses] [Fall 2022 courses] [Summer 2022 courses] [Older or newer terms]