找回密码
 立即注册
查看: 2985|回复: 2

关于R行列式det()的问题

[复制链接]
发表于 2016-11-7 18:35:28 | 显示全部楼层 |阅读模式
a <- 1:4
b <- cbind(a, a+1, a+2, a+3) ^ 2
det(b)为什么会求不到整数 det(b)应当是0
求指点

回复

使用道具 举报

发表于 2016-11-8 11:37:42 | 显示全部楼层
可能跟数组的大小有关。。你看看这个链接有没有帮助 我还是没太理解
http://stackoverflow.com/questio ... t-of-a-matrix-in-r#
For large matrices the determinant can be too large or too small and overflow the double precision. The determinant is the product of the eigenvalues: for instance, if they are all .0001, your matrix is invertible, but the determinant is 1e-400, which is too small, and can only be represented as 0.

You can look at the logarithm of the determinant instead,

determinant(R, logarithm=TRUE)
or, directly, the eigenvalues

eigen(R, only.values=TRUE)
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|R语言中文网

GMT+8, 2024-11-23 01:52 , Processed in 0.021461 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表