欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    科学计算科学计算 (41).pdf

    • 资源ID:67732197       资源大小:640KB        全文页数:19页
    • 资源格式: PDF        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    科学计算科学计算 (41).pdf

    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 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(without 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)*(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 the 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,wecan 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 can 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 will 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;factor(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 of the same class for symbol expression s.collect(s,v):Merge items of the same class by variable v for symbol expression s.syms p m=2p-1;p=19;m19=eval(m)m19=524287 factor(m19)ans=524287 p=23;m23=eval(m)m23=8388607 factor(m23)ans=47 178481Verify Mersenne prime numberMersenne number is a kind of integer like 2p-1,among which index p is a prime number.Werecord Mersenne number as Mp.If the Mersenne number is a prime number,it is called aMersenne prime number.p=29;m29=eval(m)m29=536870911 factor(m29)ans=233 1103 2089 p=31;m31=eval(m)m31=2147483647 factor(m31)ans=2147483647(5)Other operationsn,d=numden(s):Extract the numerator and denominator from a rational fraction.c=coeffs(s,x):Extract the coefficients of a symbol expression.simplify(s):Simplify symbolic expression.Convert between symbolic polynomial and coefficient vector of polynomial:p=sym2poly(s):Transform symbolic polynomial into polynomial coefficient vector.s=poly2sym(p):Transform coefficient vector of polynomial into symbol polynomial.Example 1:Find the roots of equation ax2+bx+c=0.syms a b c x f=a*x2+b*x+cf=a*x2+b*x+c g=coeffs(f,x)g=c,b,a g=g(end:-1:1)g=a,b,c roots(g)ans=-(b+(b2-4*a*c)(1/2)/(2*a)-(b-(b2-4*a*c)(1/2)/(2*a)(6)Determination of master variables in symbolic operation If the master variable is not specified clearly,MATLAB will determine the mastervariable according to the following principles and perform corresponding operation on it:Look for the lowercase letter closest to x in alphabetical order except i and j.If two symbolic variables in the expression are the same distance from x,the one withlarger ASCII code takes precedence.The symvar function can be used to find symbolic variables in a symbolic expression.The syntax of the function is:symvar(s,n)The function returns n symbolic variables in the symbolic expression s.Therefore,we canuse symvar(s,1)to find the master variable of expression s.sincos33222mab15 xy3xx5 y78=+3 3.S Symbolicymbolic matrimatrix xA symbolic matrix is also an expression,so operations on symbolic expressionsmentioned here can also be performed on matrix.Note:The function will perform operations on every element of matrix.For instance,create symbolic matrix and simplify it.syms a b x y alp m=a3-b3,sin(alp)2+cos(alp)2;(15*x*y-3*x2)/(x-5*y),78m=a3-b3,cos(alp)2+sin(alp)2(-3*x2+15*y*x)/(x-5*y),78 simplify(m)ans=a3-b3,1 -3*x,78xxxxxxxxx123123123(1)2402(3)0(1)0+=+=+=For a system of homogeneous linearequations Ax=0,when the rank(A)n or|A|=0,the system of homogeneous linearequations has non-zero solution.syms lamdaA=1-lamda,-2,4;2,3-lamda,1;1,1,1-lamda;D=det(A);factor(D)The result of program operation is:ans=-1,lamda,lamda-2,lamda-3Therefore,when =0,=2 or =3,the original equations have non-zero solutions.Example 2:What is taken when the system of homogeneous linear equations has non-zero solution.

    注意事项

    本文(科学计算科学计算 (41).pdf)为本站会员(奉***)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开