setwd('/home/Hornik/tmp/')
state.name
grep(" ", state.name)
state.name[grep(" ", state.name)]
grepv(" ", state.name)
gsub("[^aeiou]", "", state.name, ignore.case = TRUE)
nchar(gsub("[^aeiou]", "", state.name, ignore.case = TRUE))
nov <- nchar(gsub("[^aeiou]", "", state.name, ignore.case = TRUE))
nov
nchar(state.name) - nov
nchar(state.name) < nov
noc <- nchar(state.name) - nov
noc
noc <- nov
noc <- nchar(state.name) - nov
noc < nov
nos <- nchar(gsub("[^ ]", "", state.name, ignore.case = TRUE))
nos
noc <- nchar(state.name) - nov - nos
noc < nov
sum(noc < nov)
state.name[noc < nov]
gsub("[^s]", "", state.name, ignore.case = TRUE)

gsub("[^s]", "", state.name, ignore.case = TRUE)
nchar(gsub("[^s]", "", state.name, ignore.case = TRUE)) >= 4
sum(nchar(gsub("[^s]", "", state.name, ignore.case = TRUE)) >= 4)
state.name[nchar(gsub("[^s]", "", state.name, ignore.case = TRUE)) >= 4]
grep("s.*s.*s.*s", state.name)
grep("s(.*s){3,}", state.name)
grep("aa|ee|ii|oo|uu", state.name, ignore.case = TRUE)
grepv("aa|ee|ii|oo|uu", state.name, ignore.case = TRUE)
colors()
reds <- grepv("red", colors())
reds
pie(1:27, col = reds)
pie(rep(1, 27), col = reds)
col2rgb(reds)
unique(col2rgb(reds), MARGIN = 2)
duplicated(col2rgb(reds), MARGIN = 2)
which(duplicated(col2rgb(reds), MARGIN = 2))
reds[duplicated(col2rgb(reds), MARGIN = 2)]
reds
pie(rep(1, 27), col = reds)
Erato1 <- function(n) {

Erato1(30)
newton1 <- function(x, f, fprime, tol = 1e-6) {

f <- function(x) x^3 + 2 * x^2 - 7
curve(f, from = -5, to = 5)
abline(h = 0)
polyroot(c(-7, 0, 2, 1))
fprime <- function(x) 3 * x^2 + 4 * x
newton1(10, f, fprime)
newton1a <- function(x, f, fprime, tol = 1e-6, verbose = FALSE) {

newton1a(10, f, fprime)
newton1a(10, f, fprime, verbose = TRUE)

newton1b <- function(x, f, fprime, tol = 1e-6, verbose = FALSE) {

newton1b(10, f, fprime, verbose = TRUE)
newton1b(10, f, fprime)
newton1c <- function(x, f, fprime, tol = 1e-6, verbose = FALSE, maxiter = 100) {

newton1c(10, f, fprime, maxiter = 4)
digisum <- function(n)
digisum(12345)
n <- 10
x <- runif(n)
x
n <- 10
x <- runif(n)
x
x
y1 <- numeric()
y1
n <- 10000
   user  system elapsed 
system.time({
system.time({
   user  system elapsed 
n <- 100000

system.time({
system.time({
   user  system elapsed 
system.time({
   user  system elapsed 
system("pdflatex unit5a.tex")
system("open unit5a.pdf")

system("pdflatex unit5a.tex")

system("pdflatex unit5a.tex")
system("pdflatex unit5a.tex")
system("pdflatex unit5a.tex")
q()
