# Python programming

posted by .

A standard problem in mathematics is to measure the area under a curve (or to integrate the function defining the curve). A simple way to do this is to approximate the area with a series of rectangles (whose areas are easy to compute).

For example, we could split the range into two parts, then fit a rectangle whose height is the value of the function at the start of the range to the left half, and fit a rectangle whose height is the value of the function at the middle of the range to the right half. If we decide this is not a sufficiently accurate estimate of the area under the curve, we could split each part in half and repeat the process.

Here is a function that estimates the area under a curve defined by a function f, between points a and b:

def integrate(f, a, b, parts):
spacing = float(b-a)/parts
current = 0
for i in range(parts):
current += spacing * f(a+ i*spacing)
return current

Your job is to fill in the following function definition:

def successiveApproxIntegrate(f, a, b, epsilon):

To do so, use successive refinement to find the area under a curve to within a specific level of accuracy. Complete the function definition so that the procedure successiveApproxIntegrate returns an estimate of the area under the curve f. Your final estimate, using N parts, must be less than epsilon away from the estimate using N/2 parts.

• Python programming -

sry broo , 600x

• Python programming -

i don't want the answer. just help me visualize the problem and how to go for the solution. i am in class 9th and i don't know anything about integrals, yet. coding is not the problem. i am able to do that

## Similar Questions

1. ### CALC - area under a curve

You have an unknown function that is monotone increasing for 1<x<5 and have the following information about the function values. With the clear understanding that there is no way to get an exact integral, how would you try and …
2. ### Maths 2U

how do you find the horizontal and vertical assymptotes of the curve y= x/ x+3 and also the intercepts. so that you can approximate the area under the curve from x=1 to x=5 using 5 function values?
3. ### Math

Estimate the are under the curve f(x)=x^2-4x+5 on [1,3]. Darw the graph and the midpoint rectangles using 8 partitions. Show how to calculate the estimated area by finding the sum of areas of the rectangles. Find the actual area under …
4. ### Math: Need Answer to study for a quizz. Help ASAP

Estimate the area under the curve f(x)=x^2-4x+5 on [1,3]. Darw the graph and the midpoint rectangles using 8 partitions. Show how to calculate the estimated area by finding the sum of areas of the rectangles. Find the actual area under …
5. ### calculus(Lab)

Well, first graph the graph of f(x)=-1/10x^2 + 3 2. We are going to approximate the area between f and the x-axis from x = 0 to x = 4 using rectangles (the method of Riemann sums). This is not the entire area in the first quadrant, …
6. ### Math help

We have no ideal on how to start this problem, we have look for it on the charts, did not see. Please help Consider the following. (Give your answers correct to two decimal places.) (a) Find the standard score (z) such that the area …
7. ### Math help

We have no ideal on how to start this problem, we have look for it on the charts, did not see. Please help Consider the following. (Give your answers correct to two decimal places.) (a) Find the standard score (z) such that the area …
8. ### cal

Approximate the area under the curve and above the x-axis using n rectangles. Let the height of each rectangle be given by the value of the function at the right side of the rectangle. f(x)=3/x from x=2 to x=6; n=4
9. ### Calculus

Find the area cut off by x+y=3 from xy=2. I have proceeded as under: y=x/2. Substituting this value we get x+x/2=3 Or x+x/2-3=0 Or x^2-3x+2=0 Or (x-1)(x-2)=0, hence x=1 and x=2 are the points of intersection of the curve xy=2 and the …
10. ### math

Estimate the area under the curve f(x) = 16 – x^2 from x = 0 to x = 3 by using three inscribed (under the curve) rectangles. Answer to the nearest integer.

More Similar Questions