【问题标题】:How to resolve the Error in f(x, ...) : unused argument (x)如何解决 f(x, ...) 中的错误:未使用的参数 (x)
【发布时间】:2020-04-24 21:27:13
【问题描述】:
f <- function(x) {((1/2)*((4*x)-1)*exp(-(1/2)*((3*x)+(2*x^2))))};
f   # order of arguments reversed 
h <- function(x) integrate(f, lower=0, upper=Inf, x=x)$value;
h 
g <- Vectorize(h);
g 
x <- seq(0,100)
plot(x,g(x), xlab="x", ylab="y", col="blue")

【问题讨论】:

    标签: r function variables plot integrate


    【解决方案1】:

    我认为你应该使用下面的代码

    h <- function(x) integrate(f, lower=0, upper=Inf)$value;
    

    【讨论】:

      猜你喜欢
      • 2019-01-12
      • 1970-01-01
      • 1970-01-01
      • 2019-12-05
      • 2021-07-18
      • 1970-01-01
      • 2021-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多