in R programming, concerning on inverse matrix and its multiplication

前端 未结 2 629
梦谈多话
梦谈多话 2021-01-15 00:14

this is my solving process from the exercise of [a beginner\'s guide to R]

> Q
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    4    2    1
[3,]    2             


        
2条回答
  •  -上瘾入骨i
    2021-01-15 01:07

    This is not a programming error, this is the result of what's called "floating point arithmetic." rounded to a reasonable length, you will get the identity matrix:

    Q2 <- solve(Q)%*%Q
    round(Q2, 4)
    

    To learn more on floating point arithmetic go here.

提交回复
热议问题