![](/img/trans.png)
[英]How can I solve a linear equation in R when I already know all the coefficients?
[英]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))
由代表 package (v0.3.0) 于 2020 年 4 月 9 日创建
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.