setwd('/home/Hornik/tmp/')
ex5a <- function(n) sum(1 / (1 : n)) - log(n)
ex5a(500)

ex5a(1000)
x <- c(500, 1000, 2000, 4000, 8000)
ex5a(x[1])
ex5a(x[5])
x
ex5a(x)
plot(ex5a, 1, 100)
vapply(x, ex5a, 0)
ex11a <- function(x) {

ex11a(0)
ex11a(1)
ex11a(2)
plot(ex11a, 0, 6)
ex11a(1 : 2)
ex11b <- function(x) vapply(x, ex11a, 0)
ex11b(1:2)
plot(ex11b, 0, 6)
ex11c <- Vectorize(ex11a)
plot(ex11c, 0, 6)
ex11d <- function(x) {

plot(ex11d, 0, 6)
ex11e <- function(x) {

plot(ex11e, 0, 6)
logstar <- function(x) {

logstar(123)
gcd <- function(a, b) {

gcd(4, 2)
gcd(5, 2)
gcd(12, 8)
gcd2 <- function(a, b) {

gcd2(12, 8)
n_of_ways <- function(a, d) {

n_of_ways(100, c(50, 25, 10, 5, 1))
1i
(1i)^2
z <- (1i)^2
Re(z)
Im(z)
complex(10)
z
typeof(z)
sqrt(-1)
sqrt(as.complex(-1))
"Kurt"
s <- "Kurt"
s
typeof(s)
length(s)
s
rep(s, 3)
character(5)
as.character(12345)
s
nchar(s)
"a\"b"
s <- "a\"b"
s
nchar(s)
s <- "a\nb"
s
writeLines(s)
writeLines("a\tb")
2 ^ 16
Sys.getlocale()
ula <- "ä"
ula
nchar(ula)
utf8ToInt(ula)
nchar(ula, type = "bytes")
charToRaw(ula)
1
"1"
"\u00e4"
s <- "Kurt"
s
nchar(s)
s[1]
substring(s, 1, 1)
substring(rep(s, 2), 1, 2:3)
substring(s, 1:4, 1:4)
g <- "Kurt"
f <- "Hornik"
c(g, f)
typeof(c(g, f))
length(c(g, f))
paste(f, g)
paste(g, f)
paste(g, f, sep = " | ")
paste(g, f, sep = "+")
sprintf("%s %s", g, f)
sprintf("%s %d", g, 123)
s
paste(g, f)
s <- paste(g, f)
s
n <- nchar(s)
n
substring(s, 1:n, 1:n)
sum(substring(s, 1:n, 1:n) == "r")
q()
