一. R
1.1 R下载和安装
R软件是免费的,在网站
The Comprehensive R Archive Network









1.2 R简单使用
1.2.1 创建矩阵
创建矩阵:
a = matrix(c(1,2,3,4),ncol=2,byrow=T)
b = matrix(c(5,6,7,8),ncol=2,byrow=T)
c = matrix(c(1,2,3,4),ncol=2,byrow=F)
d = matrix(c(5,6,7,8),ncol=2)

1.2.2 矩阵计算
矩阵线性运算:
a+b
a-b
2a
4b
a*b

取方阵的对角线元素
diag(a)
求方阵的迹
sum(diag(a))
构造对角矩阵
c=diag(c(1,2,3,4))
矩阵求逆
solve(a)
矩阵的行列式
det(a)
det(b)
det(c)

二. Excel

首先输入两个矩阵A和B
然后选中 A+B下面的三行三列区域
- 输入=
- 选中第一个矩阵区域
- 输入+
- 选中第二个矩阵区域
- ctrl+shift+enter

三 matlab
此处略过
网友评论