科学计算科学计算 (41).pdf
《科学计算科学计算 (41).pdf》由会员分享,可在线阅读,更多相关《科学计算科学计算 (41).pdf(19页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Chapter 7 MATLABChapter 7 MATLAB SymbolicSymbolic ComputationsComputations7.1 Symbolic Objects7.2 Symbolic Calculus7.3 Series7.4 Solving Symbolic Equations7.1 7.1 Symbolic ObjectsSymbolic ObjectsThe establishment of symbolic objectsThe operations of symbolic objectsSymbolic matrix1.The establishment
2、 of symbolic objects1.The establishment of symbolic objects(1)The sym functionThe sym function is used to create singular symbolic object.Its syntax is as follows.symbolic object name=sym(A)The symbolic object is created by A,where Acan be a numeric constant,a numeric matrix ora numeric expression(w
3、ithout single quotes),and the symbolic object is a symbolicconstant;A can also be a variable name(with single quotes),and the symbolic object is asymbolic variable.t=sym(2);t+1/2ans=5/2 sin(sym(pi/3)ans=3(1/2)/2 sin(pi/3)ans=0.8660 a=5;b=-8;x=sym(a);y=sym(b);w=(a+b)*(a-b)w=-39 s=(x+y)*(x-y)s=(a+b)*(
4、a-b)eval(s)ans=-39Compare the following programs:From the above examples,we can see that:The result of symbolic computation is a precise mathematical expression.The result of numerical computation is a number.(2)The syms commandThe syms command can be used to create multiple symbolic variables at th
5、e same time.Thegeneral syntax of this command is as follows.syms symbolic variable 1 symbolic variable 2 symbolic variable nThe name of variable cant be quoted with single quotation marks.We should use blank toseparate them.For instance,if we need to create 4 symbolic variables a,b,c,d meantime,weca
6、n input the command as follows.syms a b c d syms x f=2*x2+3*x-5;g=x2-x+7;f+gans=3*x2+2*x+22.T2.The operationhe operations s of symbolic objectsof symbolic objects(1)The four arithmetic operationsThe four arithmetic operations of symbolic objects are the same as those of numericalcomputation,which ca
7、n be performed with operators of+,-,*,/and.The operating resultis still a symbolic expression.For example:(2)Relational operationsSix relational operators:,=,=and=.Corresponding six functions:lt(),le(),gt(),ge(),eq()and ne().If a symbolic expression is involved in a relational operation,the result w
8、ill be asymbolic relational expression.If a symbolic matrix is involved in the operation,theresult will be a matrix composed of symbolic relational expressions.syms x assume(x abs(x)=xans=-x=x assume(x,positive);abs(x)=xans=x=xBecause x syms x y=x0&x10y=0 x&x y=and(x0,x10)y=0 x&x syms a b s=a3-b3;fa
9、ctor(s)ans=a-b,a2+a*b+b2 factor(12)ans=2 2 3(4)Factorization and expansionMATLAB provides the functions for factorization and expansion of symbolic expression.Thesyntax of these functions is:factor(s):Factor the symbolic expression s.expand(s):Expand the symbolic expression s.collect(s):Merges items
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 科学计算科学计算 41 科学 计算 41
限制150内