楼主: 子衿1219
12992 11

[问答] R中如何解二元四次方程组 [推广有奖]

11
Waterloo19 发表于 2015-9-21 09:20:52
install.packages("rootSolve")
library("rootSolve")
model <- function(x) {
    F1 <- x[1]^4 + x[2]^4 + 2*x[1]^2*x[2]^2 - 5*x[1]*x[2] -15
    F2 <- 2*x[1]^4 + 5*x[2]^4 + x[1]^3*x[2] - 6*x[1]*x[2]^3 - 36
    c(F1 = F1, F2 = F2)
   }
(ss <- multiroot(f = model, start = c(1, 1)))
已有 1 人评分论坛币 收起 理由
admin_kefu + 25 热心帮助其他会员

总评分: 论坛币 + 25   查看全部评分

12
Waterloo19 发表于 2015-9-21 09:23:45
rootSolve三角函数方程组, for example,

fun <- function (x) cos(2*x)^3
curve(fun(x), 0, 8)
abline(h = 0, lty = 3)
uni <- uniroot(fun, c(0, 8))$root
points(uni, 0, pch = 16, cex = 2)


curve(fun(x), 0, 8)
abline(h = 0, lty = 3)
All <- uniroot.all(fun, c(0, 8))
points(All, y = rep(0, length(All)), pch = 16, cex = 2)
All

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-28 19:19