Setup for Simpson's Rule from 0 to $\pi$ with n=6

  • MHB
  • Thread starter ineedhelpnow
  • Start date
In summary: You should be able to find in your book an explanation of why the rule is defined the way it is for a given $[a,b]$.sorry i just really want to understand this properlyI understand. Don't hesitate to ask specific questions.
  • #1
ineedhelpnow
651
0
Simpson's Rule-
what would the setup look like for something from 0 to $\pi$ if n=6 and $\Delta x=\pi/6$
 
Physics news on Phys.org
  • #2
What do you mean by setup?
 
  • #3
$\frac{\Delta x}{3} [f(x_0) +4f(x_1) +2f(x_2)+...+2f(x_{n-2}) +4f(x_{n-1})+f(x_n)]$

i thought it would be $\frac{\frac{\pi}{6}}{3} [f(0) +4f(\pi/6) +2f(\pi/3)+...$

i don't think i did it right though because arent the coefficients in front of f(x) supposed to be 1-4-2-4-2-4...1. the way I am doing it is 1-4-2-4 and it stops there. it doesn't go back to 1 the way I am setting it up.

if that makes any sense :confused:
 
  • #4
ineedhelpnow said:
what would the setup look like for something from 0 to $\pi$ if n=6 and $\Delta x=\pi/6$
From what you write later, I assume that you have to apply the Simpson's rule 3 times on 3 subintervals of $[0,\pi]$. The intervals are
\begin{array}{c|c|c|c}
\text{No} & 1 & 2 & 3\\
\hline
\text{Interval} & [0,\pi/3] & [\pi/3,2\pi/3] & [2\pi/3,\pi]\\
\hline
\text{Midpoint} & \pi/6 & \pi/2 & 5\pi/6\\
\end{array}
Applying the Simpson's rule to each interval we get
\begin{align*}
&\frac{\pi/3}{6}\big[f(0)+4f(\pi/6)+f(\pi/3)\big]\\
&\frac{\pi/3}{6}\big[f(\pi/3)+4f(\pi/2)+f(2\pi/3)\big]\\
&\frac{\pi/3}{6}\big[f(2\pi/3)+4f(5\pi/6)+f(\pi)\big]\\
\end{align*}
Summing this up we get
\[
\frac{\pi}{18}\big[f(0)+4f(\pi/6)+2f(\pi/3)+4f(\pi/2)+2f(2\pi/3)+4f(5\pi/6)+f(\pi)\big]\qquad(*)
\]

We can use the formula you gave
ineedhelpnow said:
$\frac{\Delta x}{3} [f(x_0) +4f(x_1) +2f(x_2)+...+2f(x_{n-2}) +4f(x_{n-1})+f(x_n)]$
(see also Wikipedia). Here $x_i=\frac{\pi}{6}i$, $i=0,\dots,6$ and the rule gives
\[
\frac{\pi/6}{3}\big[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+4f(x_5)+f(x_6)\big]
\]
which is the same thing as (*).
 
  • #5
how do i know to split it into 3 sub intervals
 
  • #6
ineedhelpnow said:
how do i know to split it into 3 sub intervals
This depends on the directions contained in the problem statement. It is your responsibility to interpret the problem statement:
ineedhelpnow said:
what would the setup look like for something from 0 to $\pi$ if n=6 and $\Delta x=\pi/6$
since the interpretations depends on what your course or book denotes by $n$ and $\Delta x$. The two most natural interpretations are to apply the rule to 3 subintervals (this agrees with Wikipedia's notations) or 6 subintervals. In the latter case the formulas are different from my last post.
 
  • #7
can i attach a link from photobucket onto here? i want to post a picture from my book but the file size is waaaay to big.
 
  • #8
i hope i don't get in trouble for referencing an external source but here it is: Mhb Photos by fouziad1 | Photobucket
it might be hard to see so sorry. i didnt have much light.
 
  • #9
Yes, your textbook is using the same notations as Wikipedia and as I did in post #4. The sum $S_n$ is the composite Simpson's rule. It simply means that you apply the original Simpson's rule on $n/2$ intervals. The original Simpson's rule applied to $[a,b]$ approximates $\int_a^b f(x)\,dx$ as $\frac{b-a}{6}\left[f(a)+4f\left(\frac{a+b}{2}\right)+f(b)\right]$. The composite rule for an even $n$ breaks $[a,b]$ into $n/2$ intervals, applies the original rule to each interval and then sums up the results. That's why the values of $f$ at the inner borders of subintervals are counted twice (once for the left subinterval and once for the right one), while the values of $f$ at the ends of the big interval are counted only once.
 
  • #10
i understand this problem now but if I am given another problem how can i be sure whether or not to break it into n/2 intervals because in the example in the book (i attached the link with the picture) they just use the equation exactly as it is. does it depend on what [a,b] is?

sorry i just really want to understand this properly
 
  • #11
actually i think I am starting to understand what your saying now. thanks for your help :)

yep makes so much sense now. awesome explanation.
 
  • #12
I am not sure I understand your difficulty.
ineedhelpnow said:
if I am given another problem how can i be sure whether or not to break it into n/2 intervals
Yes. That's how your book defines the Simpson's rule for a given $n$.

ineedhelpnow said:
because in the example in the book (i attached the link with the picture) they just use the equation exactly as it is.
How else are they supposed to use it?

ineedhelpnow said:
does it depend on what [a,b] is?
Yes. The rule uses $x_j$ where $j=0,\dots,n$, and $x_j=a+j(b-a)/n$. That's where $a$ and $b$ come in.
 

FAQ: Setup for Simpson's Rule from 0 to $\pi$ with n=6

What is Simpson's Rule?

Simpson's Rule is a numerical integration technique used to approximate the area under a curve by dividing it into smaller segments and applying a specific formula to each segment.

How does Simpson's Rule work?

Simpson's Rule works by approximating the area under a curve by using quadratic polynomials instead of straight lines. This allows for a more accurate estimation of the area compared to other numerical integration methods.

What is the setup for Simpson's Rule from 0 to $\pi$ with n=6?

The setup for Simpson's Rule from 0 to $\pi$ with n=6 involves dividing the interval [0,$\pi$] into 6 equal subintervals and using the formula:

$I=\frac{\pi}{3n}(f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+4f(x_5)+f(x_6))$

where $x_0=0$, $x_1=\frac{\pi}{6}$, $x_2=\frac{\pi}{3}$, $x_3=\frac{\pi}{2}$, $x_4=\frac{2\pi}{3}$, $x_5=\frac{5\pi}{6}$, and $x_6=\pi$.

What is the value of n in Simpson's Rule?

The value of n in Simpson's Rule represents the number of subintervals used to divide the interval of integration. The higher the value of n, the more accurate the approximation of the area under the curve will be.

What are the benefits of using Simpson's Rule compared to other numerical integration methods?

One of the main benefits of using Simpson's Rule is its accuracy. It is known to provide more precise estimations of the area under a curve compared to other numerical integration methods, especially when the curve is not a straight line. Additionally, Simpson's Rule is relatively easy to set up and can be applied to a wide range of functions.

Similar threads

Replies
4
Views
2K
Replies
1
Views
2K
Replies
5
Views
2K
Replies
2
Views
1K
Replies
4
Views
2K
Replies
13
Views
3K
Replies
1
Views
2K
Back
Top