- f(x)の値を2乗したい
- y=f(x), y^2
- 二乗をg(x) = x^2とすると
- g(f(x))
- g,fを使って組合せやら順序を尽くせば
- f(f(x)):
- g(f(x)):,慣例で
- f(g(x)):
- g(g(x)):
- がそもそも書き方の慣例
- もfunction(x){sin(x)^2 + cos(x)^2}という引数xが1個の関数
- もそもそも書き方の慣例
f <- function(x)sin(x)
nijyo <- function(x)x^2
f_shite_nijyo <- function(x){
y <- f(x)
nijyo(y)
}
f_shite_f <- function(x){
y <- f(x)
f(y)
}
nijyo_shite_f <- funtion(x){
y <- nijyo(f)
f(y)
}
nijyo_shite_nijyo <- function(x){
y <- nijyo(x)
nijyo(f)
}
x <- seq(from=0,to=10,length=100)
plot(f_shite_nijyo(x))
plot(f_shite_f(x))
plot(nijyo_shite_f(x))
plot(nijyo_shite_nijyo(x))