// C++Exercise.cpp : 定义控制台应用程序的入口点。
//
#include<iostream>
#include<string>
#include<stack>
#include<map>
#include<vector>
#include<stdio.h>
using namespace std;
int main(){
double sum, x=0;
while (x <= 2.0){
sum = 0;
for (int k = 1; k <= 10000; k++){
sum += 1.0 /( k*(k + 1)*(k + x));
}
sum = (1 - x)*(sum + 1.0 / (20000 * 10000)) + 1.0;
printf("%5.3f %16.12f\n", x, sum);
x += 0.001;
}
return 0;
}
1.0/(20000*10000)这一项推导过程如下:1.0/(k*(k+1)(k+x)) < 1.0/k^3(k的范围是从10001到无穷)
再按照题目中已经给出的求和和积分之间的关系公式,求出1.0/k^3的上界即为1.0/(20000*10000)