2
$\begingroup$

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!

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$ Commented Jun 11, 2013 at 22:57

1 Answer 1

5
$\begingroup$

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

b=1/10; 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)}, WorkingPrecision->20]; u[r_]:=b Sinc[a alpha[r]]; Plot[b-u[r],{r,10^9,10^10}]//Quiet 

enter image description here

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

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.