zeta(2:10)
if (FALSE) {
curve(zeta, -13, 0.8, xlim = c(-12, 10), ylim = c(-1, 4), col = "orange",
las = 1, main = expression({zeta}(x)))
curve(zeta, 1.2, 12, add = TRUE, col = "orange")
abline(v = 0, h = c(0, 1), lty = "dashed", col = "gray")
curve(zeta, -14, -0.4, col = "orange", main = expression({zeta}(x)))
abline(v = 0, h = 0, lty = "dashed", col = "gray") # Close up plot
x <- seq(0.04, 0.8, len = 100) # Plot of the first derivative
plot(x, zeta(x, deriv = 1), type = "l", las = 1, col = "blue",
xlim = c(0.04, 3), ylim = c(-6, 0), main = "zeta'(x)")
x <- seq(1.2, 3, len = 100)
lines(x, zeta(x, deriv = 1), col = "blue")
abline(v = 0, h = 0, lty = "dashed", col = "gray") }
zeta(2) - pi^2 / 6 # Should be 0
zeta(4) - pi^4 / 90 # Should be 0
zeta(6) - pi^6 / 945 # Should be 0
zeta(8) - pi^8 / 9450 # Should be 0
zeta(0, deriv = 1) + 0.5 * log(2*pi) # Should be 0
gamma0 <- 0.5772156649
gamma1 <- -0.07281584548
zeta(0, deriv = 2) -
gamma1 + 0.5 * (log(2*pi))^2 + pi^2/24 - gamma0^2 / 2 # Should be 0
zeta(0.5, deriv = 1) + 3.92264613 # Should be 0
zeta(2.0, deriv = 1) + 0.93754825431 # Should be 0
Run the code above in your browser using DataLab