User Tools

Site Tools


You may have noticed that in the original, mathematical equation at the top of the page, there were bounds on the summation, <latex>$\sum_{k=1}^{i-1}$</latex>. In the Alphabets program we wrote, we did not include these bounds. In this equation, this is safe, for a rather subtle reason (which will be clearer when you know more about Alpha). In general, it is always safe to include these bounds explicitly in your program by making the reduction body a RestrictExpression to explicitly specify the range of indices where the expression inside the reduction is defined, as shown below.

U[i,j] = case
   {|1==i} : A[i,j];
   {|1<i} : A[i,j] - reduce(+, [k], {|1<=k<i} : L[i,k]*U[k,j]);

caveat.txt · Last modified: 2014/05/30 11:49 (external edit)