Approximations rules of a function

  • Thread starter Thread starter Ocasta
  • Start date Start date
  • Tags Tags
    Function Rules
Click For Summary

Homework Help Overview

The discussion revolves around approximating integrals using numerical methods, specifically the Trapezoidal Rule, Midpoint Rule, and Simpson's Rule. The integrals in question are \(\int_0^1 e^{-3x^2} dx\) and \(\int_0^1 x^{-3x^2} dx\), both with \(n = 4\). Participants are attempting to apply these methods and are encountering issues with their calculations.

Discussion Character

  • Mixed

Approaches and Questions Raised

  • Participants discuss their attempts to apply the Trapezoidal Rule, Midpoint Rule, and Simpson's Rule, noting specific values for function evaluations. There is confusion regarding the Midpoint Rule's formula and its application, with some participants questioning the correctness of their results and the formulas used.

Discussion Status

Some participants have provided guidance on correcting the formulas for the Midpoint and Trapezoidal Rules. There is an ongoing exploration of the discrepancies in the results obtained, with multiple interpretations of the rules being discussed. Participants are actively seeking clarification and attempting to resolve their misunderstandings.

Contextual Notes

Participants express uncertainty about the need to multiply by \(\Delta x\) in their calculations, indicating a potential misunderstanding of the numerical methods involved. There are also mentions of specific values obtained that seem inconsistent with expectations, prompting further inquiry into the calculations.

Ocasta
Messages
40
Reaction score
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):

<br /> \int_0^1 e^{-3x^2} dx<br />

<br /> n = 4<br />


(a) Trapezoidal Rule

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

(c) Simpson's Rule


Homework Equations


<br /> \Delta x = \frac{b-a}{n}<br />

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

Midpoint Rule <- incorrect
<br /> \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})]<br />

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

The Attempt at a Solution


I set variable for my f-values.
<br /> a = f(0) = 1<br />

<br /> b = f(\frac{1}{4}) \approx 0.82903<br />

<br /> c = f(\frac{1}{2}) \approx 0.47237<br />

<br /> d = f(\frac{3}{4}) \approx 0.18498<br />

<br /> e = f(1) \approx 0.04979<br />

So I plugged everything in and I get

Midpoint Rule
<br /> \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})]<br />

(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
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):

<br /> \int_0^1 x^{-3x^2} dx<br />

<br /> n = 4<br />


(a) Trapezoidal Rule

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

(c) Simpson's Rule


Homework Equations


<br /> \Delta x = \frac{b-a}{n}<br />

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

Midpoint Rule
<br /> \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}]<br />

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

The Attempt at a Solution


I set variable for my f-values.
<br /> a = f(0) = 1<br />

<br /> b = f(\frac{1}{4}) \approx 0.82903<br />

<br /> c = f(\frac{1}{2}) \approx 0.47237<br />

<br /> d = f(\frac{3}{4}) \approx 0.18498<br />

<br /> e = f(1) \approx 0.04979<br />

So I plugged everything in and I get

Midpoint Rule
<br /> \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}]<br />

(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 [f(1/8) + f(3/8) + f(5/8) + f(7/8)]\cdot \Delta x.
 
Also, your formula for the Trapezoid Rule is wrong. This is what it should be:

\Delta X \cdot \frac{1}{2} \cdot [ f(0) + 2f(\frac{1}{4}) + 2f(\frac{1}{2}) + 2f(\frac{3}{4}) + f(1) ]
 
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!
 
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 [f(1/8) + f(3/8) + f(5/8) + f(7/8)]\cdot \Delta x.

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.
 
I think you made an error. I'm getting something right around .5.
 
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.
 
Then I think you're making another mistake. You have to multiply by \Delta x, the width of each subinterval.
 

Similar threads

Replies
17
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 21 ·
Replies
21
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 14 ·
Replies
14
Views
2K