Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double RowFunction(double x) {
- double sum = 0;
- int i = 1;
- while (fabs(sum - log(x)) > 0.1) {
- sum += pow(x - 1, i) / (i*pow(x, i));
- i++;
- }
- return sum;
- }
- int RecursionFunction(int i, int n, double xs[], double array[]) {
- if (i < n)
- array[i] = log(xs[i]);
- if (i + 1 < n)
- RecursionFunction(i + 1, n, xs, array);
- return 0;
- }
- double recurLog(double x, int n)
- {
- if (n == 1) return (x-1)/x;
- double n_term = 1;
- for(int i = 0; i < n; ++i)
- n_term *= (x-1)/x;
- n_term /= n;
- return recurLog(x,n-1) + n_term;
- }
- double serialLog(double x, int n)
- {
- x = (x-1)/x;
- double term = x, sum = x;
- for(int i = 2; i <=n; ++i)
- sum += term *= x*(i-1)/i;
- return sum;
- }
Add Comment
Please, Sign In to add comment