- Timestamp:
- 12/13/13 19:00:06 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Scantable.cpp
r2869 r2880 3365 3365 return x; 3366 3366 } else { 3367 double res = 0.0; 3368 for (int m = 0; m <= n/2; ++m) { 3369 double c = 1.0; 3370 if (m > 0) { 3371 for (int i = 1; i <= m; ++i) { 3372 c *= (double)(n-2*m+i)/(double)i; 3373 } 3374 } 3375 res += (m%2 == 0 ? 1.0 : -1.0)*(double)n/(double)(n-m)*pow(2.0*x, (double)(n-2*m))/2.0*c; 3376 } 3377 return res; 3367 double res[n+1]; 3368 for (int i = 0; i < n+1; ++i) { 3369 double res0 = 0.0; 3370 if (i == 0) { 3371 res0 = 1.0; 3372 } else if (i == 1) { 3373 res0 = x; 3374 } else { 3375 res0 = 2.0 * x * res[i-1] - res[i-2]; 3376 } 3377 res[i] = res0; 3378 } 3379 return res[n]; 3378 3380 } 3379 3381 }
Note:
See TracChangeset
for help on using the changeset viewer.