So I want to approximate the area of the integral using the trapezoidal method. The function has limits from 1 to 2 and the function is sqrt(x^3-1)dx. So the number of rectangles this function has is 10 with the width of 1/10. This is what I have so far in my code. I have calculated from 1 to 2 with this formula and used the while loop.
width/2[f(x)+2f(x1)+2f(x2)+2f(x3)...+f(n) and so on)
so since the width is 1/10, It's just increasing by .1 so it's going from 1,1.1,1.2,1.3 all the way to 2
Now that I have those values calculated. All I have to do is add all those values and divide it by width/2 which in this case is 1/20. How would I do that?
using namespace std;
number = 2.0;
for(x = 1 ; x < number ; x=x+0.1)
cout<< "\n\n\tThe value is" << 2*sqrt(x*x*x-1);