Embed
Email

Rectangle_method

Document Sample

Shared by: roy ashbrook
Categories
Tags
Stats
views:
0
posted:
11/16/2011
language:
English
pages:
3
From Wikipedia, the free encyclopedia Rectangle method









Rectangle method

In mathematics, specifically in integral calculus, the rec-

tangle method (also called the midpoint or mid-ordinate

rule) computes an approximation to a definite integral,

made by finding the area of a collection of rectangles

whose heights are determined by the values of the func-

tion.

Specifically, the interval (a,b) over which the function

is to be integrated is divided into N equal subintervals of

length h = (b − a) / N. The rectangles are then drawn so

that either their left or right corners, or the middle of

their top line lies on the graph of the function, with bases

running along the x-axis. The approximation to the inte- Midpoint approximation

gral is then calculated by adding up the areas (base mul-

tiplied by height) of the N rectangles, giving the formula:









where h = (b − a) / N and xn = a + nh.



The formula for xn above gives xn for the Top-left corner

approximation.

As N gets larger, this approximation gets more accu-

rate. In fact, this computation is the spirit of the defini- Top-right corner approximation

tion of the Riemann integral and the limit of this approx-

imation as is defined and equal to the inte-

gral of f on (a,b) if this Riemann integral is defined. Note Error

that this is true regardless of which i’ is used, however

the midpoint approximation tends to be more accurate For a function f which is twice differentiable, the approx-

for finite n. imation error in each section (a,a + Δ) of the midpoint

rule decays as the cube of the width of the rectangle. (For

The different rectangle approximations

a derivation based on a Taylor approximation, see Mid-

point method)









for some ξ in (a,a + Δ). Summing this, the approximation

error for n intervals with width Δ is less than or equal to

n = 1,2,3,...



where n + 1 is the number of nodes





Top-left corner approximation



in terms of the total interval, we know that nΔ = b − a so

we can rewrite the expression:









1

From Wikipedia, the free encyclopedia Rectangle method





for some ξ in (a,b). int i;





Matlab Example Program interval=(b-a)/subintervals;

result=0;



for(i=1;i

Do J=a,b,-.00000001

2

#include

c1=J

Y=F(((c1+c2)/2))

double f(double x){

Mult=Y*.00000001

return sin(x);

Sum=sum+mult

}

c2=c1

End Do

double rectangle_integrate(double a, double b, int subintervals, double (*function)(double

double result;

Print*,Sum

double interval;



2

From Wikipedia, the free encyclopedia Rectangle method





3 Format (F20.5) Return

End End



Double Precision Function f(x)

Double Precision x

See also

• Midpoint method for solving ordinary differential

F=(4)/((x**2)+1) equations

• Trapezoidal rule

• Simpson’s rule









Retrieved from "http://en.wikipedia.org/wiki/Rectangle_method"



Categories: Integral calculus, Numerical integration (quadrature)





This page was last modified on 21 May 2011 at 17:57. Text is available under the Creative Commons Attribution-

ShareAlike License; additional terms may apply. See Terms of use for details. Wikipedia® is a registered trademark of

the Wikimedia Foundation, Inc., a non-profit organization.Contact us

Privacy policy About Wikipedia Disclaimers Mobile view



3



Related docs
Other docs by roy ashbrook
Philip_Taaffe
Views: 35  |  Downloads: 0
Philip_Dodd__broadcaster_
Views: 25  |  Downloads: 0
Philippa_of_Champagne
Views: 21  |  Downloads: 0
Philadelphians
Views: 19  |  Downloads: 0
Phaansi
Views: 12  |  Downloads: 0
Peykasa
Views: 14  |  Downloads: 0
Pet_door
Views: 20  |  Downloads: 0
Peter_Rice__Chairman_of_Fox_Broadcasting_
Views: 25  |  Downloads: 0
Perittia_farinella
Views: 12  |  Downloads: 0
Perissoza_scripta
Views: 12  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!