options(scipen=999)
options(digits=9)
cat("\014") # clear screen
rm(list=ls(all=TRUE))



x=c(0,1,2,3,4,5)
f=function(x) (factorial(5)/(factorial(x)*factorial(5-x)))/32
fx=f(x)
f(0)
f(1)
table=data.frame(x,fx)
table


x=c(0,1,2,3,4,5)
f=function(x) (factorial(5)/(factorial(x)*factorial(5-x)))/32
fx=f(x)
f(0)
f(1)
table=data.frame(x,fx)
table

F<-function(t) {s<-0 
  for(i in 0:t) {
    s<-s+f(i)
  }
print(s)
}

F(0)
F(1)
F(2)
F(3)
F(4)
F(5)


new.function<-function(a) {
  for(i in 1:a) {
    b<-i^2
    print(b)
  }
}
new.function(4)



f=function(x) (1/18)*(3+2*x)
integrate(f,2,3)








ncr=function(n,r) (factorial(n)/(factorial(r)*factorial(n-r)))
x=c(0,1,2,3,4,5)
f=function(x) ncr(5,x)/32
fx=f(x)
table=data.frame(x,fx)
table


#g=function(x) 2*x
#integrate(integrate(g,0,y),0,1)



#integrate(f,0,1,abs.tol = 0.001,stop.on.error = TRUE)

#integrate(f,0,1,abs.tol = 0.000000000000000001)