You can use the following code to do a numerical estimate of the definate integral (which is really what you want):
Code:
double y(double x);
double integrate(double lowerBound, double upperBound, int numRects);
double y(double x){
return sqrt(pow(cos(x),2) + 1.0);
}
double integrate(double lowerBound, double upperBound, int numRects){
//computes area by left hand rectangle approximation.
double rectWidth;
double area;
int i;
area = 0;
rectWidth = (upperBound - lowerBound)/(double)numrects;
for (i = 0; i < numRects; i++){
area += y(lowerBound + rectWidth * (double) i) *rectWidth;
}
return area;
}
As numrects increases, this will better and better approximate the integral. In fact, for any integrable funtion, by definition this converges to the integral as numRects goes to infinity.