f(x) - f(1) = (1-x)sum(1 / k*(k+1)*(k+x)
当k较大时,k+1和k+x可以近似于k
由于sum(1 / k^r) < ∫n-1(1 / x ^ r)dx
则有(1-x)sum(1 / k*(k+1)*(k+x) < |1-x| / k^3 < |1-x| / 2x ^ 2
#include <string>
#include <stdio.h>
#include <stdlib.h>
#define MAX 20000
int main(){
double sum, k;
double x = 0.0;
int i;
for(i = 0; i < 2001; i++){
sum = 0.0;
for(k = 1.0; k < MAX; k++){
sum += (1.0 - x) / (k * (k+1) *(k+x));
}
sum += (1.0 - x) / (2.0 * (MAX - 1.0) * (MAX - 1.0)) + 1.0;
printf("%5.3lf %16.12lf\n", x, sum);
x += 0.001;
}
return 0;
}