Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #R version 3.3.2
- u1000 <- runif(1000, 0, 1)
- f <- function (n) {
- sum(u1000[1:n])
- }
- f2 <- function (n) {
- sum(u1000[1:n]) / n
- }
- f3 <- function (n) {
- sum(u1000[1:n]) - n/2
- }
- numbers <- (1:1000)
- sums <- lapply(numbers, f3)
- plot(numbers, sums, type="l")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement