如何求解 R 和 uniroot 函数中的非线性方程

How can I solve non linear equation in R and uniroot function

如何使用 R 为方程

求出 x 的值

a(x^b)+k*log(1+(x^c))+log(1-(u^(1/d)))=0 对于值

u=0.1,c=0.8,k=1.2,d=1.5,a=0.9,b=1 他们得到的答案是 0.0539。 但是我没有得到这个答案。

这是我的代码和我对解决方案的检查

f <- function(x, a, b, c, d, k, u) {
  a * (x^b) + k * log(1 + (x^c))+ log(1 - (u^(1/d)))
}

res <- uniroot(f, interval = c(0, 1), u=0.1,c=0.8,k=1.2,d=1.5,a=0.9,b=1)
res
#> $root
#> [1] 0.08930995
#> 
#> $f.root
#> [1] 1.234389e-06
#> 
#> $iter
#> [1] 5
#> 
#> $init.it
#> [1] NA
#> 
#> $estim.prec
#> [1] 6.103516e-05

# Check solution
f(res$root, u=0.1,c=0.8,k=1.2,d=1.5,a=0.9,b=1)
#> [1] 1.234389e-06

# Plot
x <- seq(0, .1, length.out = 100)
plot(x, f(x, u=0.1,c=0.8,k=1.2,d=1.5,a=0.9,b=1))

reprex package (v0.3.0)

于 2020-04-09 创建