优题选
题目:怎么用R语言求矩阵的迹?如题

问题描述:

怎么用R语言求矩阵的迹?
如题

最佳答案:

a=matrix(1:9,nrow=3)
tr = 0
for(i in 1:nrow(a))
tr = tr + a[i, i]
tr

关键字:
返回顶部