1
$\begingroup$

I am given two functions: $ fl(fl(x+y)+z) $ and $ fl(x+fl(y+z)) $ and asked to derive their relative error. Then, given a set of conditions:

a) $ x < y < x $

b) $ x > 0, y < 0, z > 0 $

c) $ x < 0, y > 0, z < 0 $

determine which parenthesization has less relative error.

After some algebra I determined the following relative errors where

$ \epsilon_1 = RE(fl(x+y)),\ \epsilon_2 = RE(fl(fl(x+y)+z) $

$ \epsilon_3 = RE(fl(y+z)),\ \epsilon_4 = RE(fl(x+fl(y+z)) $

$$ \left| \epsilon_2 + \frac{(x+y)}{(x + y + z)}\epsilon_1 \right| \ \text{and}\ \ \left| \epsilon_4 + \frac{(y+z)}{(x + y + z)}\epsilon_3 \right| $$

I determined that for the case $ x < y < z,\ fl(fl(x + y) + z $ has less relative error. With the largest variable, $ z $ in the denominator alone, as $ z \rightarrow \infty $ the coefficient of $ \epsilon_1 $ would approach $ 0 $.

But for $ x > 0, y < 0, z > 0 $ I'm struggling to generalize anything. I don't see how a conclusion can be drawn without an ordering between $z$ and $x$. And what about when $ y = x + z $? Although this case is independent of the relative parenthesizations. And similarly for the case $ x < 0, y > 0, z < 0 $.

$\endgroup$
0
$\begingroup$

With nothing but an upper bound for the relative error: Consider that the final sums are almost the same, so bounds for relative error will be almost the same. What’s significantly different is the absolute error of the first addition, and that will be smallest if the first sum has the smallest possible absolute value.

In the first case 0 < x+y < y+z, so the first function has the smaller error.

In the second case it depends whether x+y or y+z is closer to zero, which we don’t know. And exactly the same in the third case.

$\endgroup$
1
  • $\begingroup$ That's what I thought, but being asked about case b, and c made me think I was missing some way to make a concrete conclusion beyond "depends on the other variable." Thank you. $\endgroup$ – Alex Launi May 27 '20 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.