The following made me curious. Suppose you want to sum the if statement If[x[i] < 1., x[i]^2, 0.] over i=1,2, i.e.
Sum[If[x[i] < 1., x[i]^2, 0.], {i, 1, 2}].
Mathematica returns
If[x[1] < 1., x[i]^2, 0.] + If[x[2] < 1., x[i]^2, 0.].
Notice the i's if the statement is true. However, I thought a more "natural" representation of the sum should look like
If[x[1] < 1., x[1]^2, 0.] + If[x[2] < 1., x[2]^2, 0.].
Does anybody can enlighten me on this one? Thanks in advance.
Sum[If[x[i] < 1., 1/0, 0^0], {i, 1, 2}]. – b.gates.you.know.what Feb 14 '13 at 10:11