MatsGranvik

Generalization of Luschny's Alternating Harmonic numbers

Jul 9th, 2019
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Table[Log[2] + (1/2)*
  2. Cos[Pi*n]*(PolyGamma[n/2 + 1/2] - PolyGamma[n/2 + 1]), {n, 1, 12}]
  3. N[%]
  4. N[Accumulate[
  5. Flatten[Table[{1/(2*n - 1), -1/(2*n - 0)}, {n, 1, 12/2}]]]]
  6. Chop[%% - %]
  7.  
  8. nn = 12;
  9. Table[N[Log[3] + (1/3)*
  10. Cos[Pi*n*2]*(PolyGamma[n/3 + (Mod[2*n, 3] + 1)/3] +
  11. PolyGamma[n/3 + (Mod[2*n + 1, 3] + 1)/3] -
  12. 2*PolyGamma[n/3 + (Mod[2*n + 2, 3] + 1)/3])], {n, 1, nn}]
  13. N[Accumulate[
  14. Flatten[Table[{1/(3*n - 2), 1/(3*n - 1), -2/(3*n + 0)}, {n, 1,
  15. nn/3}]]]]
  16. Chop[%% - %]
  17.  
  18. nn = 12;
  19. Table[N[Log[4] +
  20. 1/4*Cos[Pi*n*2]*(PolyGamma[n/4 + (Mod[3*n, 4] + 1)/4] +
  21. PolyGamma[n/4 + (Mod[3*n + 1, 4] + 1)/4] +
  22. PolyGamma[n/4 + (Mod[3*n + 2, 4] + 1)/4] -
  23. 3 PolyGamma[n/4 + (Mod[3*n + 3, 4] + 1)/4])], {n, 1, nn}]
  24. N[Accumulate[
  25. Flatten[Table[{1/(4*n - 3), 1/(4*n - 2),
  26. 1/(4*n - 1), -3/(4*n + 0)}, {n, 1, nn/4}]]]]
  27. Chop[%% - %]
Advertisement
Add Comment
Please, Sign In to add comment