# Thread: Using Simpson's Rule For sin x / x

1. ## Using Simpson's Rule For sin x / x

Use Simpson's Rule with N=8 to estimate

π/2
∫ sin x / x dx
0

where we take the value of (sin x) / x at x=0 to be 1.

2. Originally Posted by johnley
Use Simpson's Rule with N=8 to estimate

π/2
∫ sin x / x dx
0

where we take the value of (sin x) / x at x=0 to be 1.
See the PlanetMath article, the method is quite simple, if you have problems with that tell us what they are and we will help you with those specific problems.

CB

3. The thing I am having trouble with are the different conditions. The limits are from 0 to pi/2, but then what does it mean by saying "x=0 to be 1"?

4. Ok, this is what I did and I'm pretty sure I did it right, but I am getting a different answer from what is in the solution's manual.

pi/48 * (f(0) + 4*f(pi/16) + 2*f(2*pi/16) + 4*f(3*pi/16) + 2*f(4*pi/16) + 4*f(5*pi/16) + 2*f(6*pi/16) + 4*f(7*pi/16) +f(8*pi/16) )

If I do all this, I get 0.026272 which is exactly what the answer would be if you integrated the problem, but the answer is supposed to be 1.37076. What am I doing wrong?

5. Originally Posted by johnley
Ok, this is what I did and I'm pretty sure I did it right, but I am getting a different answer from what is in the solution's manual.

pi/48 * (f(0) + 4*f(pi/16) + 2*f(2*pi/16) + 4*f(3*pi/16) + 2*f(4*pi/16) + 4*f(5*pi/16) + 2*f(6*pi/16) + 4*f(7*pi/16) +f(8*pi/16) )

If I do all this, I get 0.026272 which is exactly what the answer would be if you integrated the problem, but the answer is supposed to be 1.37076. What am I doing wrong?

CB

6. Sure, delta x is (pi/2)/8 * (1/3) = pi/48.

If I'm doing it wrong, please correct me as that very well could be where I went wrong.

7. Originally Posted by johnley
Sure, delta x is (pi/2)/8 * (1/3) = pi/48.

If I'm doing it wrong, please correct me as that very well could be where I went wrong.
When I evaluate the expression in your earler post I get the given answer of 1.37076, so there is something wrong with your arithmetic.

CB

8. Originally Posted by johnley
Sure, delta x is (pi/2)/8 * (1/3) = pi/48.

If I'm doing it wrong, please correct me as that very well could be where I went wrong.
I made a mistake. You did this part correctly.

9. Right. When I just calculated it with my values, I got an answer of 1.305314.

One thing that can be throwing off the answer is calculating the first term - f(0). Sin 0/0 is not possible, so is that where the "x=0 to be 1" condition comes in? (i.e plugging in 1 to the to the function instead of 0?) If that is the case, I get a closer number in 1.36038, but still not quite there.

10. Anyone?

11. Originally Posted by johnley
Anyone?
You are giving us nothing new to go on to help identify the reason you are not getting the given answer.

As I said earlier check you arithmetic, with f(0)=1 the rest of the world gets the given answer.

Also I will say it again, make sure your calculator is in radian mode.

Attached is a image of the calculation in Excel

CB

,

,

,

,

,

,

,

,

,

,

,

,

,

,

# 4 2 sin x limits 0 to Ï€ using simpson's 3/8 rule code

Click on a term to search for related topics.