摘要:在Mathematica里,可以用IdentityMatrix[n]生成一个n×n的单位矩阵。如果想让结果排版成标准的矩阵形式,可以加上//MatrixForm。
分享兴趣,传播快乐,
增长见闻,留下美好。
亲爱的您,这里是LearningYard学苑!
今天小编为大家带来
“慧学(43):Mathematica入门学习之多项式运算”
欢迎您的访问!
Share interest, spread happiness,
increase knowledge, and leave beautiful.
Dear, this is the LearningYard Academy!
Today, the editor brings the
"Hui Xue (43): Mathematica introduction to polynomial operations"
Welcome to visit!
本期推文,小编将从思维导图和学习内容两个方面来介绍Mathematica常用矩阵命令的入门学习。
In this post, the editor will introduce the introductory learning of commonly used matrix commands in Mathematica from two aspects: mind mapping and learning content.
一、思维导图(Mind mapping)
二、学习内容(Learning content)
1、单位矩阵(Identity matrix)
在Mathematica里,可以用IdentityMatrix[n]生成一个n×n的单位矩阵。如果想让结果排版成标准的矩阵形式,可以加上//MatrixForm。
In Mathematica, you can use IdentityMatrix[n] to generate an n×n identity matrix. If you want the result to be typeset in standard matrix form, you can add //MatrixForm.
2、指定对角线的对角矩阵(Diagonal matrix specifying the diagonal)
在Mathematica中,可以用DiagonalMatrix[{a,b,c,…}]生成指定元素构成的对角矩阵,默认放在主对角线上。
In Mathematica, you can use DiagonalMatrix[{a,b,c,…}] to generate a diagonal matrix consisting of specified elements, which are placed on the main diagonal by default.
如果想把元素放在其他对角线上,可以使用第二个参数x:当x=0时是主对角线,x>0表示在主对角线上方第x条对角线,x
If you want to put elements on other diagonals, you can use the second parameter x: when x=0, it is the main diagonal, x>0 means the xth diagonal above the main diagonal, and x
3、计算矩阵行列式的值(Calculate the value of the matrix determinant)
在Mathematica中,行列式的计算命令是Det[m],其中m必须是方阵。
In Mathematica, the command for calculating the determinant is Det[m], where m must be a square matrix.
4、计算矩阵特征值(Calculate matrix eigenvalues)
在Mathematica中,可以用Eigenvalues[m]计算矩阵的特征值。
In Mathematica, you can use Eigenvalues[m] to calculate the eigenvalues of a matrix.
5、计算矩阵的迹(Compute the trace of a matrix)
在Mathematica中,矩阵的迹可以用Tr[m]计算,它表示主对角线上所有元素的和。
In Mathematica, the trace of a matrix can be computed using Tr[m], which represents the sum of all elements on the main diagonal.
6、海塞矩阵(Hessian matrix)
在Mathematica中,如果想表示函数的海塞矩阵,可以使用M=D[f(x,y),{{x,y},2}],这里{{x,y},2}表示对变量x和y同时求二阶偏导,生成一个方阵,其中每个元素都是函数关于变量的二阶偏导数。这个矩阵在数学中称为海塞矩阵,常用于判断多元函数的极值或分析曲率。
In Mathematica, to represent the Hessian matrix of a function, use M=D[f(x,y),{{x,y},2}], where {{x,y},2} represents the simultaneous calculation of the second-order partial derivatives of the variables x and y, resulting in a square matrix where each element is the second-order partial derivative of the function with respect to the variables. This matrix, known as a Hessian matrix in mathematics, is often used to determine the extreme values of multivariate functions or analyze curvature.
7、雅可比矩阵(Jacobian matrix)
在Mathematica中,可以用D[f[x,y],{{x,y}}]表示向量函数的雅可比矩阵,即每个分量对每个变量的一阶偏导数组成的矩阵。
In Mathematica, the Jacobian matrix of a vector function can be expressed as D[f[x,y],{{x,y}}], which is the matrix consisting of the first-order partial derivatives of each component with respect to each variable.
8、提取矩阵元素(extracting matrix elements)
在Mathematica中,可以用a1=M[[i,j]]提取矩阵M中第i行第j列的元素。需要注意的是,如果矩阵使用了MatrixForm美化输出,必须另起一行单独使用MatrixForm[M],否则无法正确提取元素。
In Mathematica, you can use a1=M[[i,j]] to extract the element in the i-th row and j-th column of the matrix M. It should be noted that if the matrix is beautified using MatrixForm, you must use MatrixForm[M] on a separate line; otherwise, the element cannot be extracted correctly.
今天的分享就到这里了,
如果您对文章有独特的想法,
欢迎给我们留言,
让我们相约明天。
祝您今天过得开心快乐!
That's all for today's sharing.
If you have a unique idea about the article,
please leave us a message,
and let us meet tomorrow.
I wish you a nice day!
翻译:Google翻译
本文由LearningYard学苑整理发出,如有侵权请在后台留言!
文案|chen
排版|chen
审核|hzy
来源:LearningYard学苑