I have a question about a task I am trying to complete. I have created a code to produce a determinant of a $100\times 100$ matrix. Now I want to compute the relative error between my solution and the solution obtained using
numpy.linalg.det.
So I know that the relative error is calculated by
$$\left| \left| \frac{x-x_0}{x} \right| \right|$$
where $x$ is the absolute value and $x_0$ is the approximation. My question is what is the absolute value and what is the approximation, my code I have generated or using numpy.linalg.det
Both my answer and using numpy.linalg.det are almost equal.
The definition of relative error you quoted is (apparently) meant to represent the relative error between an exact value $x$ and an approximation $x_0.$
More generally, the formula still works for other kinds of relative errors; just set $x$ to the value that you want the error to be relative to.
I think the usual practice is, if one of the numbers is somehow considered to be more accurate or reliable, you set $x$ to that number. In your case, since one of the numbers comes from a well-known numeric programming software package that (presumably) has been vetted by many people, and the other number is something you just came up with yourself, I would use numpy's value as $x$ and your value as $x_0.$ If the numbers are really very close, however, it does not make much difference which one you put in the denominator.