Inverse of matrix in R

前端 未结 3 626
执念已碎
执念已碎 2021-01-30 03:46

I was wondering what is your recommended way to compute the inverse of a matrix?

The ways I found seem not satisfactory. For example,

> c=rbind(c(1,          


        
3条回答
  •  情书的邮戳
    2021-01-30 04:30

    solve(c) does give the correct inverse. The issue with your code is that you are using the wrong operator for matrix multiplication. You should use solve(c) %*% c to invoke matrix multiplication in R.

    R performs element by element multiplication when you invoke solve(c) * c.

提交回复
热议问题