[6.64] Calculate through undef and get correct results
In some cases you can calculate with undef values and still get the correct result. Suppose we want to
find the reciprocal of the sum of reciprocals of numeric list elements, like this:
1/sum(1/list)
where list is the list of elements. This calculation is used to find the equivalent resistance of a set of
parallel resistors, where the list elements are the individual resistance values. Suppose list = {2,4,6,12},
then the expression returns 1 as expected. But if list = {2,4,6,12,0}, then the expression above returns
the correct result of zero, even though manually performing the individual calculations results in undef:
1/list returns {1/2, 1/4, 1/6, 1/12, undef}
sum({1/2, 1/4, 1/6, 1/12, undef}) returns undef
1/undef returns undef
Evidently, the calculator reorganizes the expression to avoid the division by zero.
6 - 131