4
$\begingroup$

I have an impulse train given by

(1 + Csc[(π x)/(1 + R)] Sin[(π (1 + 2 R) x)/(1 + R)])/(2 + 2 R)

Because of the Csc, evaluating this expression gives an indeterminate result for all integer multiples of R + 1, as you can see from this table:

TableForm[
  Table[
   Evaluate[(1 + Csc[(π x)/(1 + R)] Sin[(π (1 + 2 R) x)/(1 + R)])/(2 + 2 R)],
   {x, 0, 10}, {R, 1, 5}]]

(Apologies if my formatting is off; total newbie...)

Fair enough: the expression is defined in the limit, but not absolutely.

So, following advice from a previous similar question (here), I replace Sin with Sinc:

((1 + Csc[(π x)/(1 + R)] Sin[(π (1 + 2 R) x)/(1 + R)])/(2 + 2 R) // FullSimplify) 
  /. {Sin[z_] :> z*Sinc[z], Csc[z_] :> 1/(z*Sinc[z])} // Simplify

This gives me

(1 + ((1 + 2 R) Sinc[(π (1 + 2 R) x)/(1 + R)])/Sinc[(π x)/(1 + R)])/(2 + 2 R)

And this is where I get confused. The substitution should remove all indeterminate results, but it doesn't. Instead, it only removes the first indeterminate result:

TableForm[
  Table[
    Evaluate[{(1 + ((1 + 2 R) Sinc[(π (1 + 2 R) x)/(1 + R)])/Sinc[(π x)/(1 + R)]) / 
               (2 + 2 R)}],
    {x, 0, 10}, {R, 1, 5}]]

This is baffling, since the function now contains nothing but Sinc.

How do I fix this? Or am I doing something wrong mathematically?

$\endgroup$

1 Answer 1

10
$\begingroup$

You've avoided Sin[0]/0 problems, but your numerator and denominator in your more complicated expression are still both zero in some cases. One way is to take a limit in those cases:

f[xx_, RR_] := Module[{expr, trial, x, R},
  expr = (1 + ((1 + 2 R) Sinc[(\[Pi] (1 + 2 R) x)/(1 + R)])/
         Sinc[(\[Pi] x)/(1 + R)])/(2 + 2 R);
  trial = Quiet[expr /. x -> xx /. R -> RR];
  If[trial === Indeterminate, Limit[expr /. R -> RR, x -> xx], trial]]

Table[f[x, R], {x, 0, 10}, {R, 1, 5}]
(*
{{1, 1, 1, 1, 1}, {0, 0, 0, 0, 0}, {1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, 
 {1, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {1, 1, 0, 0, 1}, {0, 0, 0, 0, 0}, 
 {1, 0, 1, 0, 0}, {0, 1, 0, 0, 0}, {1, 0, 0, 1, 0}}
*)

Edit to answer questions in comments:

You can take the limit for all cases if you like.

g[xx_, R_] := 
   Module[{x}, 
      Limit[(1 + ((1 + 2 R) Sinc[(\[Pi] (1 + 2 R) x)/(1 + R)])/
         Sinc[(\[Pi] x)/(1 + R)])/(2 + 2 R), x -> xx]]

This is, however, a bit slower than the previous definition.

I call the argument pattern xx to distinguish it from the free variable x. After all, Limit[...,x->x] makes no sense. GG isn't necessary in the final code, but I was experimenting with which variable Limit preferred. Note that I localized x with Module to insure that it wouldn't conflict with either a potential global value nor a local value created by Table or something. Mathematica is an expression rewriting language: x needs to stay undefined through all the rewriting to allow Limit to use it properly.

$\endgroup$
3
  • $\begingroup$ Thanks. Could you please just confirm that I've understood this correctly? The essence of your response is that the expression is only true in the limit (in some circumstances), regardless of how I express it. I can use techniques to make Mathematica take the limit, but from a purely formulaic point of view, I might as well simply define the formula in terms of its limits from the outset, much as Sinc does for 1/Sin? $\endgroup$ Commented Aug 12, 2018 at 15:14
  • $\begingroup$ By which I mean, I'll totally use your fix (much appreciated, though I don't fully understand it, but I'll learn).But I do I want to make sure I'm standing on mathematically solid ground... $\endgroup$ Commented Aug 12, 2018 at 15:28
  • $\begingroup$ I'd also appreciate a pointer as to why the double xx and RR work as they do. The results are awesome though. Appreciated. $\endgroup$ Commented Aug 12, 2018 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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