Program 43
K.Dzwonkiewicz
C++

Consider
the graph of the function f(x)=5x3
This
graph increases as it moves right. We need to find the area under the curve
from the y-axis to x=2. This area is contained within a region that has 3 sides
that are straight lines, but the fourth side is a curve. We can cut the area up
into little rectangles whose sum approaches the exact area. The more rectangles
that are used the greater the accuracy. We will store the area in the cells of
apvector. When done finding the last area, add the individual areas to get the
approximate area.
Ask the
boundaries: start... 0 to end...2
Ask
how many rectangles: amt= 10
Width
of one rectangle: end/amt =
.2
Area
of first: L x H or (width) x f(x) .2 x 5(.2)3 = .008
Area
of second: .2
x 5(.4)3 =.064
Area
of third: .2
x 5(.6)3 = .216
“ “
“
“ “ “
Area
of tenth: .2
x 5(2)3 = 8.00
Sum of ten
rectangles: 24.2000
Run your
program for 10, 100, 1000, and 10000 rectangles
The actual
area is 20 square units from taking the integral.
Organized
crime in America takes in over forty billion dollars a year and spends very
little on office supplies. Love
is grand; divorce is a hundred grand. As long as
calculus is taught in school, there will be prayer in school. If
it's green, it's biology, If it stinks, it's chemistry, If it has numbers,
it's math, If it doesn't work, it's technology. The idea that
Bill Gates has appeared like a knight in shining armour to lead all his
customers out of a mire of technological chaos neatly ignores the fact that
it was he who by peddling second-hand, second-rate technology, led them all
into it in the first place.
--Woody Allen
--Unknown
--Cokie Roberts
--Unknown
--Douglas Adams