Calculus programming help..

Hello everyone, I'm having a difficult time making a calculus equation for my programming assignment. This is a intermediate programming class and I currently am in college algebra. Apparently this class uses calculus that wasn't in the pre req, the instructor said that this is college algebra yet I'm struggling with it. Here is the question.

You are the game warden in your town and are responsible for stocking the local lake
(see Figure 1) prior to the opening of the fishing season. The average depth of the lake is
20 feet. Your plan is to stock the lake with 1 fish per 1000 cubic feet, and have
approximately 25% of the original fish population remaining at the end of the season.
What is the maximum number of fishing licenses that can be sold if the average catch is
20 fish per license?

Figure 1
http://i995.photobucket.com/albums/af77/mrboggies/figure1_zpsbfb3e5fc.png
-from learning simpsons rule by myself I noticed that it must be even yet there are 9 points in figure 1, does this pose a problem?

Hint
You will have to compute the volume of the lake, since the criterion for stocking is 1 fish
per 1000 ft3
. Volume can be computed as Area × Depth. The area can be computed
using calculus. In particular, use Simpson’s Rule to compute the area. Recall we can
compute the area under a curve using Simpson’s Rule as follows.
http://www.mathwords.com/s/simpsons_rule.htm
(example from the web as the equation wouldnt copy and paste correctly)

where h=(b-a)/n = 200 ft, n is an even number (8 in our problem), and the yi (i=0, 1, …)
are data elements read from a file.


I understand the coding as it must retrieve data from a txt file and then run through the equation by function and once the function outputs the value,
-it needs to be multiplied by 25%
-then have that added to the current value
-then divided by 20 as in 20 fish per license.
-then output to the screen as in maximum number of licenses allowed,
Can anyone help me figure the equation out? It would be greatly appreciated. I only got so far from youtube videos and online tutorials as I dont fully understand Simpson’s Rule. Thank you.
What input will you be getting from the file? The volume of the lake?
Your professor is being a jerk to use this kind of calculus in his prerequisite:algebra course. It takes a little weird thinking to get it.

The idea is that you can approximate the area under a curve by calculating approximations of sections under the curve. For example, the image on Wikipedia here is good: http://en.wikipedia.org/wiki/Rectangle_method

The curve is divided up, the area of the rectangle under each part of the curve is taken, and the sum of the rectangles' areas is taken as an approximation of the area under the curve.

─────


Simpson's rule is the same kind of thing, except instead of using rectangles, it uses paraboloids, or curves.

Given the figure in your notes, the Simpson rule works fine. You take three points at a time, so:

    1st curve is through p0, p1, p2
    
2nd curve is through p2, p3, p4
    
etc

For each of those segments, all you need to do is solve the following equation:

    h/3.0 * (yn+0 + 4*yn+1 + yn+2)

n is the index into the points: 0, 2, 4, ...
Notice that each n is an even number. This means that there must be an even number of sections -- which is an odd number of points.

h is the distance between the points (200 feet)

All you need are values for the y component of each point, and you can calculate each of the four segments using the above equation. Sum the results to get the surface area of the lake. (Presumably there is a straight road or something that abuts it along one side.)

As it is, it looks like he wants a very exacting estimate of the area (via Simpson's Rule) , and a very crude estimate of the volume (area * depth). Go figure.

─────


In any case, once you get the volume of the lake, you want 1/4 of the original population to be unfished. That means that 3/4 of the maximum capacity of the lake can be fished. (So make sure you rethink your math on that.)

Hope this helps.
@Smac89 Apparently we will not get any of the data, he will use his own "data.txt" input file that he will create. So I suppose that I will make a test file for the input.
@Duoas Thank you so much. That answered a lot of questions I had. I'll continue to work on this equation.
Topic archived. No new replies allowed.