Approximations rules of a function

The integrand is f(x), but the trapezoid rule is based on the average of the values of f(x) at the endpoints of each subinterval.
  • #1
Ocasta
40
0

Homework Statement



Given the following integral and value of n, approximate the integral using the methods indicated (round your answers to six decimal places):

[itex]
\int_0^1 e^{-3x^2} dx
[/itex]

[itex]
n = 4
[/itex]


(a) Trapezoidal Rule

(b) Midpoint Rule
This is the only one I'm having trouble with.

(c) Simpson's Rule


Homework Equations


[itex]
\Delta x = \frac{b-a}{n}
[/itex]

Trapezoid Rule
[itex]
\Delta X \cdot \frac{1}{2} \cdot [ f(0) + 2f(\frac{1}{4}) + 2f(\frac{1}{2}) + 2f(\frac{3}{4}) + f(1) ]
[/itex]

Midpoint Rule <- incorrect
[itex]
\Delta X \cdot [ f(\frac{0 + \frac{1}{4}}{2}) + f(\frac{ \frac{1}{4} + \frac{1}{2} }{2}) + f(\frac{\frac{1}{3} + \frac{3}{4}}{2}) +f(\frac{\frac{3}{4} + 1}{2})]
[/itex]

Simpson's Rule
[itex]
\Delta X \cdot \frac{1}{3} \cdot [ f(0) + 4f(\frac{1}{4}) + 2f(\frac{1}{2}) + 4f(\frac{3}{4}) + f(1) ]
[/itex]

The Attempt at a Solution


I set variable for my f-values.
[itex]
a = f(0) = 1
[/itex]

[itex]
b = f(\frac{1}{4}) \approx 0.82903
[/itex]

[itex]
c = f(\frac{1}{2}) \approx 0.47237
[/itex]

[itex]
d = f(\frac{3}{4}) \approx 0.18498
[/itex]

[itex]
e = f(1) \approx 0.04979
[/itex]

So I plugged everything in and I get

Midpoint Rule
[itex]
\Delta X \cdot [ f(\frac{0 + \frac{1}{4}}{2}) + f(\frac{ \frac{1}{4} + \frac{1}{2} }{2}) + f(\frac{\frac{1}{3} + \frac{3}{4}}{2}) +f(\frac{\frac{3}{4} + 1}{2})]
[/itex]

(a) Trapezoidal Rule
0.5028176513

(b) Midpoint Rule
0.5028176513

(c) Simpson's Rule
0.5042135205

However, my midpoint rule answer is wrong. I do think it's strange that I'm getting exactly the same answer for B as I am for A, but I can't seem to see what I'm doing wrong.
 
Last edited:
Physics news on Phys.org
  • #2
Ocasta said:

Homework Statement



Given the following integral and value of n, approximate the integral using the methods indicated (round your answers to six decimal places):

[itex]
\int_0^1 x^{-3x^2} dx
[/itex]

[itex]
n = 4
[/itex]


(a) Trapezoidal Rule

(b) Midpoint Rule
This is the only one I'm having trouble with.

(c) Simpson's Rule


Homework Equations


[itex]
\Delta x = \frac{b-a}{n}
[/itex]

Trapezoid Rule
[itex]
\Delta X \cdot \frac{1}{2} \cdot [ f(0) + f(\frac{1}{4}) + f(\frac{1}{2}) + f(\frac{3}{4}) + f(1) ]
[/itex]

Midpoint Rule
[itex]
\Delta X \cdot [ \frac{f(0) + f(\frac{1}{4})}{2} + \frac{ f(\frac{1}{4}) + f(\frac{1}{2}) }{2} + \frac{f(\frac{1}{3}) + f(\frac{3}{4})}{2} +\frac{f(\frac{3}{4}) + f(1)}{2}]
[/itex]

Simpson's Rule
[itex]
\Delta X \cdot \frac{1}{3} \cdot [ f(0) + 4f(\frac{1}{4}) + 2f(\frac{1}{2}) + 4f(\frac{3}{4}) + f(1) ]
[/itex]

The Attempt at a Solution


I set variable for my f-values.
[itex]
a = f(0) = 1
[/itex]

[itex]
b = f(\frac{1}{4}) \approx 0.82903
[/itex]

[itex]
c = f(\frac{1}{2}) \approx 0.47237
[/itex]

[itex]
d = f(\frac{3}{4}) \approx 0.18498
[/itex]

[itex]
e = f(1) \approx 0.04979
[/itex]

So I plugged everything in and I get

Midpoint Rule
[itex]
\Delta X \cdot [ \frac{f(0) + f(\frac{1}{4})}{2} + \frac{ f(\frac{1}{4}) + f(\frac{1}{2}) }{2} + \frac{f(\frac{1}{3}) + f(\frac{3}{4})}{2} +\frac{f(\frac{3}{4}) + f(1)}{2}]
[/itex]

(a) Trapezoidal Rule
0.5028176513

(b) Midpoint Rule
0.5028176513

(c) Simpson's Rule
0.5042135205

However, my midpoint rule answer is wrong. I do think it's strange that I'm getting exactly the same answer for B as I am for A, but I can't seem to see what I'm doing wrong.

I think you should be getting different values for the trapezoid and midpoint approximations. Your formula for the midpoint rule is wrong, I'm pretty sure. Instead of averaging the function values at the left and right ends of the subinterval (which is what the trapezoid rule does), it should evaluate the function at the midpoint of the subinterval. For your work, you want to evaluate [itex][f(1/8) + f(3/8) + f(5/8) + f(7/8)]\cdot \Delta x[/itex].
 
  • #3
Also, your formula for the Trapezoid Rule is wrong. This is what it should be:

[tex]\Delta X \cdot \frac{1}{2} \cdot [ f(0) + 2f(\frac{1}{4}) + 2f(\frac{1}{2}) + 2f(\frac{3}{4}) + f(1) ][/tex]
 
  • #4
Thanks, Mark44. I must have transcribed my trapezoid rule incorrectly.

Thanks for the clarification on my midpoint rule. I'm going to give that a try!
 
  • #5
Mark44 said:
I think you should be getting different values for the trapezoid and midpoint approximations. Your formula for the midpoint rule is wrong, I'm pretty sure. Instead of averaging the function values at the left and right ends of the subinterval (which is what the trapezoid rule does), it should evaluate the function at the midpoint of the subinterval. For your work, you want to evaluate [itex][f(1/8) + f(3/8) + f(5/8) + f(7/8)]\cdot \Delta x[/itex].

I think you were absolutely right, Mark but I plugged this in but I'm getting something just above 0.3, which is way too low.
 
  • #6
I think you made an error. I'm getting something right around .5.
 
  • #7
It took some mathematical gymnastics, but I eventually got the right number. I'm running into a strange problem with these rules. I don't seem to need to multiply by dx for some reason I can't fathom.
 
  • #8
Then I think you're making another mistake. You have to multiply by [itex]\Delta x[/itex], the width of each subinterval.
 

1. What are approximation rules of a function?

Approximation rules of a function are mathematical methods used to estimate the values of a function without having to calculate the exact value. They are useful for simplifying complex functions and making them easier to work with.

2. Why are approximation rules important?

Approximation rules are important because they allow for quick and efficient calculations, especially when dealing with complex functions. They also help to reduce the margin of error in calculations and make it easier to understand the behavior of a function.

3. What are some common approximation rules used in mathematics?

Some common approximation rules used in mathematics include the linear approximation rule, the tangent line approximation rule, and the midpoint rule. These rules are often used in calculus and numerical analysis to estimate the values of functions.

4. How accurate are approximation rules?

The accuracy of approximation rules depends on the complexity of the function and the method used for approximation. Generally, the more terms used in the approximation, the more accurate the result will be. However, there is always a margin of error associated with any approximation rule.

5. Can approximation rules be used for any type of function?

Approximation rules can be used for a wide range of functions, including polynomial, exponential, trigonometric, and logarithmic functions. However, the accuracy of the approximation may vary depending on the type of function and the specific rule used.

Similar threads

  • Calculus and Beyond Homework Help
Replies
17
Views
594
  • Calculus and Beyond Homework Help
Replies
4
Views
681
  • Calculus and Beyond Homework Help
Replies
21
Views
826
  • Calculus and Beyond Homework Help
Replies
5
Views
612
  • Calculus and Beyond Homework Help
Replies
1
Views
827
  • Calculus and Beyond Homework Help
Replies
1
Views
133
  • Calculus and Beyond Homework Help
Replies
6
Views
839
  • Calculus and Beyond Homework Help
Replies
2
Views
531
  • Calculus and Beyond Homework Help
Replies
5
Views
754
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
Back
Top