分享兴趣、传播快乐、增长见闻、留下美好,大家好,这里是LearningYard学苑,今天小编为大家带来系列文章: 一看就会的图文教程-Mathematica(1)。
Share interest, spread happiness, increase knowledge, and stay good. Hello, everyone. This is LearningYard Academy. Today, the editor brings you a series of articles: A picture-text tutorial-Mathematica (1).
今日内容一览表Today's content list
- l Mathematica多项式的计算polynomial calculation
- l Mathematica常用矩阵命令commonly used matrix commands
01 lMathematica多项式的计算polynomial calculation
加减乘除Add, subtract, multiply and divide
Mathematica中的普通数字的加减乘除计算可以直接输入,按下“shift+enter”即可输出结果,此处不做赘述。
需要特别说明的是:mathematica中不会对结果进行化简,所以在进行多项式的加减乘除计算的时候,可以调用以下函数对结果进行化简。
The calculation of addition, subtraction, multiplication, and division of ordinary numbers in Mathematica can be directly input, and the result can be output by pressing "shift+enter", which will not be repeated here.
It should be noted that the result is not simplified in mathematica, so when adding, subtracting, multiplying and dividing a polynomial, you can call the following function to simplify the result.
方式一:合并同类项-调用Collect[(需要化简的表达式),x(合并关于哪个同类项)]。Method 1: Combine similar items-call Collect[(the expression that needs to be simplified), x (which similar items are combined about)].
案例1
方式二:表达式的化简-调用表达式//FullSimplify。Method 2: Simplification of expression-call expression //FullSimplify.
案例2
函数求导Function derivation
案例三:求函数的一阶导Find the first derivative of a function.
调用格式Calling format:ans1=D[原函数,求关于谁的导数]。
案例3
案例四:求函数的二阶导Find the second derivative of a function.
调用格式Calling format:ans2=D[原函数,{求关于谁的二阶导,2}]。
案例4
案例五:多元函数中先对x求偏导,再对y求偏导In a multivariate function, first obtain the partial derivative of x, and then obtain the partial derivative of y.
调用格式Calling format:ans3=D[原函数,x,y]。
案例5
求解多项式方程(组)Solve polynomial equations (sets)
常用函数Commonly used functions:
案例展示:
案例6
案例7
案例8
02lMathematica常用矩阵命令commonly used matrix commands
矩阵的输入Matrix input
案例9:单位矩阵Identity Matrix.
使用格式Use format:Identitymatrix[a] // MatrixForm
a表示几阶单位矩阵,MatrixForm函数表示输出为矩阵格式。(a represents the order of the unit matrix, and the MatrixForm function represents the output as a matrix format.)
案例9
案例10-1:对角矩阵Diagonal matrix.
使用格式Use format:DiagonalMatrix[{a,b,c,d,e,f,...}]。
a,b,c,d,e,f,...为指定的对角线元素。(a,b,c,d,e,f,... are the specified diagonal elements.)
案例10-1
进阶练习10-2:调整对角线的位置Adjust the position of the diagonal.
使用格式Use format:DiagonalMatrix[{a,b,c,d,e,f,...},x]。
x为正,向右上方移动;x为负,向左下方移动。(If x is positive, it moves to the upper right; if x is negative, it moves to the lower left.)
案例10-2
矩阵的计算Matrix calculation
案例11:求矩阵的值Find the value of a matrix.
使用格式Use format:Det[矩阵的表达式]
案例11
案例12:求矩阵的特征值Find the eigenvaluesof a matrix.
使用格式Use format:Eigenvalues[矩阵的表达式]
案例12
案例13:求矩阵的迹Find the trace of a matrix.
使用格式Use format:Tr[矩阵的表达式]
案例13
特殊矩阵的调用Special matrix call
案例14:海塞矩阵Hessian Matrix
海塞矩阵是一个多元函数的二阶偏导数构成的方阵,一般利用海塞矩阵判定多元函数的极值问题。The Hessian matrix is a square matrix composed of the second-order partial derivatives of a multivariate function. The Hessian matrix is generally used to determine the extreme value of a multivariate function.
使用格式Use format:D[f(x,y),{{x,y},2}]
案例14
案例15:雅可比矩阵Jacobian Matrix
雅可比矩阵是一阶偏导数以一定方式排列成的矩阵。它体现了一个可微方程与给出点的最优线性逼近。The Jacobian matrix is a matrix in which the first-order partial derivatives are arranged in a certain way. It embodies the optimal linear approximation of a differentiable equation to a given point..
使用格式Use format:D[f(x,y),{{x,y}}]
案例15
提取矩阵的元素Extract elements of the matrix
使用格式Use format:M[[i,j]],提取第i行,第j列。
案例15-1 不正确输入命令Input the command incorrectly.
特别说明:不同于之前矩阵的输入,在进行提取矩阵中元素的操作时,一定要另起一行,单独使用一次MatricForm函数,先将矩阵表示出来,再输入提取命令。Special note: Different from the input of the previous matrix, when extracting elements in the matrix, you must start a new line and use the MatricForm function once to express the matrix first, and then enter the extraction command.
案例15-2 正确输入命令Enter the command correctly.
结尾
由于篇幅有限,今天的分享就到这里啦!
参考资料:网络。
翻译:Google翻译。
本文由LearningYard学苑整理并发出,部分资料来自网络,若有侵权请联系!
如果您对今天的文章有独特的想法,欢迎给我们留言,让我们相约明天,祝您今天过得开心快乐!