# 数値微分(Romberg1段公式) # 関数 f <- function(x) { return(x ^ 5 - 4 * x ^ 4) } # 中心差分 f2 <- function(x, h) { return((f(x + h) - f(x - h)) / (2 * h)) } # Romberg1段公式 fr <- function(x, h) { return((4 * f2(x, h) - f2(x, 2 * h)) / 3) } # Romberg1段公式のグラフ h <- 1e-1 curve(fr(x, h), xlim = c(-1, 3), ylab = "y")