Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I seem to be having some trouble with the Sinc[x] function, and I think it's due to rounding, but I'm not sure.

The code is below, with relevant constants:

b = 0.1;
a = 8.7106181548*^-18;
alpha$of$r[r_] := alpha /. FindRoot[alpha - b * alpha + (b/a) * Sin[a * alpha] ==
                                    r (1 - 2 * b),  {alpha, r (1 - 2 *b)}];

u[r_] := b * Sinc[a * alpha$of$r[r]];
Plot[b - u[r], {r, 10^9, 10^10}]

When we plot the function u[r] in the range specified, it does not seem to return a continuous curve as expected. Here's a picture of the plot:

wacky-looking plot

Could anyone offer insight as to why this happens and how I could fix it? I apologize in advance if I'm missing any information, as I'm new here. Thanks!

share|improve this question
You are running into machine precision rounding issues here. Try the option WorkingPrecision or look up the function SetPrecision in the docs. It should give you some ideas how to avoid the problem. – Thies Heidecke Jun 11 '13 at 22:57
up vote 4 down vote accepted

The problem in your question is not about accuracy of $\text{sinc}(x)$ function itself but with the precision of FindRoot. When you increase working precision of the calculations (by using WorkingPrecision option) then the result is smooth

a=87106181548 10^-28;
alpha[r_]:=alpha/.FindRoot[alpha-b alpha+(b/a) Sin[a alpha]==r (1-2 b), {alpha,r (1-2 b)},
u[r_]:=b Sinc[a alpha[r]];

enter image description here

Please note that I also increased precision of the a and b parameters by removing the decimal point.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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