solve.default(A, B, fractions = TRUE) 中的错误:'a' (3 x 2) 必须是正方形
Error in solve.default(A, B, fractions = TRUE) : 'a' (3 x 2) must be square
我目前正在学习矩阵和向量的基础知识。我在使用这段代码时遇到了这个问题:
A <- matrix(c(1, -1, 2, 2, 3, 1),
nrow = 3,
ncol = 2,
byrow = T)
B <- c(2, 1, 3)
solve(A, B, fractions = TRUE)
Error in solve.default(A, B, fractions = TRUE) : 'a' (3 x 2) must be square
Google 搜索了一下,您似乎正尝试使用 matlib
包做一些事情。如果您还没有安装该软件包,则需要安装该软件包,并使用 Solve()
而不是 solve()
(R 是 case-sensitive):
library(matlib)
Solve(A,B, fractions=TRUE)
我目前正在学习矩阵和向量的基础知识。我在使用这段代码时遇到了这个问题:
A <- matrix(c(1, -1, 2, 2, 3, 1),
nrow = 3,
ncol = 2,
byrow = T)
B <- c(2, 1, 3)
solve(A, B, fractions = TRUE)
Error in solve.default(A, B, fractions = TRUE) : 'a' (3 x 2) must be square
Google 搜索了一下,您似乎正尝试使用 matlib
包做一些事情。如果您还没有安装该软件包,则需要安装该软件包,并使用 Solve()
而不是 solve()
(R 是 case-sensitive):
library(matlib)
Solve(A,B, fractions=TRUE)