Advertisement
MatsGranvik

Euler Maclaurin formula for Riemann zeta function

Jan 10th, 2017
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. (*start*)
  2. Clear[n, k, s, r, q];
  3. Print["choose a complex number to calculate for"]
  4. s = 1/2 - I*100
  5. Print["Increase these number for better precision"]
  6. k = 1000
  7. q = 100
  8. Print["The Euler Maclaurin formula compared to Mathematica 8 inbuilt \
  9. formula"]
  10. N[Sum[1/n^s, {n, 1, k}] + k^(1 - s)/(s - 1) - (k^(-s))/2 +
  11. Sum[BernoulliB[2*r]/((2*r)!)*Product[s + i, {i, 0, 2*r - 2}]*
  12. k^(-s - 2*r + 1), {r, 1, q - 1}], 20]
  13. N[Zeta[s], 20]
  14. %% - %
  15. Print["The difference above is zero"]
  16. (*end*)
  17.  
  18. (*start 28.1.2018*)
  19. Clear[n, k, s, r, q];
  20. Print["choose a complex number to calculate for"]
  21. s = 1/2 - I*100
  22. Print["Increase these number for better precision"]
  23. k = 100
  24. q = 100
  25. Print["The Euler Maclaurin formula compared to Mathematica 8 inbuilt \
  26. formula"]
  27. s = 1/2 + I*10;
  28. N[Sum[1/n^s, {n, 1, k}] + k^(1 - s)/(s - 1) +
  29. Sum[BernoulliB[r]/(r!)*Product[s + i, {i, 0, r - 2}]*
  30. k^(-s - r + 1), {r, 1, 2*(q - 1)}], 20]
  31. N[Zeta[s], 20]
  32. %% - %
  33. Print["The difference above is zero"]
  34. (*end*)
  35. (* In agreement with *)
  36. (*start*)
  37. nn = 12;
  38. TableForm[
  39. A = Table[
  40. Table[If[n >= k, BernoulliB[n - k], 0], {k, 1, nn}], {n, 1, nn}]]
  41. TableForm[
  42. K = Inverse[
  43. Table[Table[
  44. If[n >= k, Binomial[n, k]/(n - k + 1), 0], {k, 1, nn}], {n, 1,
  45. nn}]]];
  46. TableForm[
  47. B = Table[
  48. Table[If[n >= k, K[[n, k]]/Binomial[n, k], 0], {k, 1, nn}], {n, 1,
  49. nn}]]
  50. TableForm[B - A]
  51. (*end*)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement