# Why is this function indeterminate?

Consider an impulse train

1/(R + 1) + (Sum[Cos[(2 k π x)/(R + 1)], {k, R}])/(R + 1)


For x=0 it's clear that this function should return 1, because Cos[0]==1, which gives 1/(R+1)+R/(R+1)==1.

However, if I evaluate

1/(R + 1) + (Sum[Cos[(2 k π x)/(R + 1)], {k, R}])/(R + 1)/. x -> 0


I get an indeterminate result. (And this still happens if I assign a specific value to R.)

I'd like to know the reason. On a different thread, people have very helpfully given me a workaround using Sinc. But I just want to figure out the cause of the issue. What's the logic behind the error?

• How is this different from this previous question of yours? – AccidentalFourierTransform Jul 22 '18 at 22:50
• The previous question (as noted) was how to solve the issue. This question is, why does the issue arise? – Richard Burke-Ward Jul 22 '18 at 23:04
• The answers to the other question told you why. Sin[x]/x for x=0 only exists in the limit. Sinc[x] avoids the issue by defining the function at x=0 to equal the limit. Or make the replacement prior to evaluating the Sum: 1/(R + 1) + (Sum[Cos[(2 k \[Pi] x)/(R + 1)] /. x -> 0, {k, R}])/(R + 1) // Simplify – Bob Hanlon Jul 22 '18 at 23:28
• I think you're assuming I'm smarter than I am! I understand about Sin[x]/x, but that's not the point. This is a Cos function. There is no division by x involved. And, again, I'm not after a fix, I'm trying to figure out the why. – Richard Burke-Ward Jul 22 '18 at 23:39
• A slightly more interesting question is, "Why doesn't Sum[x^2/(1 + x^2)^n, {n, 1, Infinity}] /. x -> 0 return zero?" I suppose both it and yours could be comprised under the heading "Algebraic expressions tend to be only generically valid" (generic meaning they are possibly invalid on a set that is much smaller than the domain, such as a finite number of exceptions or a set of one dimension less). In your case, you have an expression that contains something like Sin[(1+2R) u] Csc[u], which is undefined but has limit at u == 0 as @Bob says. My unfortunate example has a discontinuity. – Michael E2 Jul 22 '18 at 23:47

You can see exactly where and why the indeterminate arises if you look through the output of this

Trace[1/(R+1) + (Sum[Cos[(2 k Pi x)/(R+1)], {k, R}])/(R+1) /. x->0]


The output of that may seem confusing if you haven't looked at this before, but what it does is show you step by step the evaluation process and what the result was for each tiny step.

For example, the very first step shows {R+1,1+R} which shows it is trying to determine the value of your very first (R+1) and it concludes that is 1+R because Mathematica displays polynomials in a different order.

You can look at the step by step process of the evaluation. After some steps you can see that it thinks it needs to turn one of your Cos into Csc. Then further on you can see it finds this is Csc[0] and that is where your indeterminate or ComplexInfinity comes from.

Now we come to a little more guesswork. From your previous question I am tending to think that you believe that 0*anything==0, no matter what anything is, but that is just me guessing what you are thinking. Does this correctly represent your thinking? Please correct me if I am wrong.

Mathematica doesn't think 0*anything==0 in some cases. You can see that Mathematica believes 0*3==0 and 0*a==0, even when mathematica does not yet know what the value of a is, but it does not think that0*Infinity==0.

Might this explain your questioning Mathematica's result?

From the output of Trace you might be able to try to guess parts of the process and the rules that Mathematica is using to evaluate expressions like yours.

• It's the turning Cos into Csc that is messing with me. I do realise that 0*anything==0 is only true when anything is both clearly defined and !=0. You've all been really helpful. I appreciate it. I'll mark this as answered. – Richard Burke-Ward Jul 23 '18 at 0:02
• The Csc factor arises from an identity for the sum of cosines, not from Cos turning into Csc per se. – Michael E2 Jul 23 '18 at 0:19