Purpose
To work out exercise from 5.3

> xs <- c(pi/6, pi/4, pi/2)
> n <- 1:1000
> x <- xs[1]
> z1 <- cumsum(x^2 * sin(x)/((1 + n * x * x) * (1 + x * x * (n -
+     1))))
> x <- xs[2]
> z2 <- cumsum(x^2 * sin(x)/((1 + n * x * x) * (1 + x * x * (n -
+     1))))
> x <- xs[3]
> z3 <- cumsum(x^2 * sin(x)/((1 + n * x * x) * (1 + x * x * (n -
+     1))))
> par(mfrow = c(2, 2))
> plot(n, z1, col = "blue")
> plot(n, z2, col = "blue")
> plot(n, z3, col = "blue")

DP_Mar_5_2011-001.jpg

Converges at all the points

> xs <- seq(-pi, pi, 0.01)
> n <- 3
> z1 <- cumsum(n * xs^2 * sin(xs)/(1 + n * xs * xs))
> n <- 6
> z2 <- cumsum(n * xs^2 * sin(xs)/(1 + n * xs * xs))
> n <- 9
> z3 <- cumsum(n * xs^2 * sin(xs)/(1 + n * xs * xs))
> n <- 12
> z4 <- cumsum(n * xs^2 * sin(xs)/(1 + n * xs * xs))
> par(mfrow = c(2, 2))
> plot(xs, z1, col = "blue")
> plot(xs, z2, col = "blue")
> plot(xs, z3, col = "blue")
> plot(xs, z4, col = "blue")

DP_Mar_5_2011-002.jpg

> par(mfrow = c(1, 1))
> cols <- rainbow(4)
> plot(xs, z1, col = cols[1], ylim = c(-200, 0))
> par(new = T)
> plot(xs, z2, col = cols[2], ylim = c(-200, 0))
> par(new = T)
> plot(xs, z3, col = cols[3], ylim = c(-200, 0))
> par(new = T)
> plot(xs, z4, col = cols[4], ylim = c(-200, 0))

DP_Mar_5_2011-003.jpg

> xs <- seq(-pi, pi, 0.01)
> n <- 3
> z1 <- cumsum(n * xs^2 * sin(xs)/(1 + n * xs * xs))
> n <- 60
> z2 <- cumsum(n * xs^2 * sin(xs)/(1 + n * xs * xs))
> n <- 900
> z3 <- cumsum(n * xs^2 * sin(xs)/(1 + n * xs * xs))
> n <- 1200
> z4 <- cumsum(n * xs^2 * sin(xs)/(1 + n * xs * xs))
> n <- 12000
> z4 <- (n * xs^2 * sin(xs)/(1 + n * xs * xs))

DP_Mar_5_2011-004.jpg

> par(mfrow = c(1, 1))
> cols <- rainbow(4)
> plot(xs, z1, col = cols[1], ylim = c(-200, 0))
> par(new = T)
> plot(xs, z2, col = cols[2], ylim = c(-200, 0))
> par(new = T)
> plot(xs, z3, col = cols[3], ylim = c(-200, 0))
> par(new = T)
> plot(xs, z4, col = cols[4])
> plot(xs, sin(xs), col = cols[4])
> plot(xs, sin(xs)/xs, col = cols[4])

DP_Mar_5_2011-005.jpg

> epsilon <- 0.5
> plot(xs, (1 - epsilon)/(epsilon * xs * xs))

DP_Mar_5_2011-006.jpg