5.4.4.1

> x <- seq(0.01, 1, 0.005)
> z1 <- data.frame(x = x, y = 0)
> n <- 1
> for (n in 1:1000) {
+     condition <- x < 1/sqrt(n) & x > 1/sqrt(n + 1)
+     z1[condition, 2] <- z1[condition, 1] * (n^(0.49) * ((-1)^(n +
+         1)))
+ }
> z2 <- data.frame(x = x, y = 0)
> n <- 1
> for (n in 1:1000) {
+     condition <- x < 1/sqrt(n) & x > 1/sqrt(n + 1)
+     z2[condition, 2] <- z2[condition, 1] * (n^(0.5) * ((-1)^(n +
+         1)))
+ }
> par(mfrow = c(1, 1))
> plot(z1[, 1], z1[, 2], type = "l", col = "blue", lwd = 1.2, main = "",
+     xlim = c(0, 1), ylim = c(-1, 1), xlab = "", ylab = "")
> par(new = T)
> plot(z2[, 1], z2[, 2], type = "l", col = "red", , lwd = 1.2,
+     main = "Lebesgue Integrable(f1)   Vs  Not Lebesgue Integrable(f2)",
+     xlim = c(0, 1), ylim = c(-1, 1), xlab = "X", ylab = "Y")
> legend("bottomright", legend = c("f1", "f2"), fill = c("blue",
+     "red"))

Exer_5_4_4-001.jpg

Absolute value of function

> x <- seq(0.001, 1, 1e-04)
> z1 <- data.frame(x = x, y = 0)
> n <- 1
> for (n in 1:1000) {
+     condition <- x < 1/sqrt(n) & x > 1/sqrt(n + 1)
+     z1[condition, 2] <- z1[condition, 1] * (n^(0.49))
+ }
> z2 <- data.frame(x = x, y = 0)
> n <- 1
> for (n in 1:1000) {
+     condition <- x < 1/sqrt(n) & x > 1/sqrt(n + 1)
+     z2[condition, 2] <- z2[condition, 1] * (n^(0.5))
+ }
> par(mfrow = c(1, 1))
> plot(z1[, 1], z1[, 2], type = "l", col = "blue", lwd = 1.2, main = "",
+     xlim = c(0, 1), ylim = c(0, 1), xlab = "", ylab = "")
> par(new = T)
> plot(z2[, 1], z2[, 2], type = "l", col = "red", , lwd = 1.2,
+     main = "Lebesgue Integrable(f1)   Vs  Not Lebesgue Integrable(f2)",
+     xlim = c(0, 1), ylim = c(0, 1), xlab = "X", ylab = "Y")
> legend("bottomright", legend = c("f1", "f2"), fill = c("blue",
+     "red"))

Exer_5_4_4-002.jpg

The red function is not lebesgue integrable while blue one is lebesgue integrable

Exploring blue function as a sequence of functions

> x <- seq(0.001, 1, 1e-04)
> z1 <- data.frame(matrix(data = NA, ncol = 21, nrow = length(x)))
> z1[, 1] <- x
> n <- 20
> for (n in 1:20) {
+     condition <- x < 1/sqrt(n) & x > 1/sqrt(n + 1)
+     z1[condition, (n + 1)] <- z1[condition, 1] * (n^(0.49))
+ }
> par(mfrow = c(1, 1))
> plot.new()
> cols <- rainbow(21)
> for (n in 2:20) {
+     par(new = T)
+     plot(z1[, 1], z1[, n], type = "l", col = cols[n], lwd = 1.2,
+         main = "", xlim = c(0, 1), ylim = c(0.6, 1), xlab = "",
+         ylab = "")
+ }
> legend("bottomleft", legend = 1:20, fill = cols, cex = 0.6)

Exer_5_4_4-003.jpg

Hence write the function as sequence of summands Flip the integral and sum sign and use MCT..