版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、变换规则和定义第1页,共18页,2022年,5月20日,5点27分,星期二2November 18, 2004Start Learning Step by Step1. 应用变换规则expr /. rules在表达式上应用一次规则expr /. rules在表达式上重复应用规则直道结果不再改变应用变换规则expr /. lhs - rhs在表达式上应用某个变换规则expr /. lhs1 - rhs1, lhs2-rhs, .在表达式上依次应用一系列规则应用一组变换规则expr /. rules1, rules2, .应用一组规则得到一个数组一次或重复应用规则第2页,共18页,2022年,5月
2、20日,5点27分,星期二3November 18, 2004Start Learning Step by Step1. 应用变换规则(续)Applying rules to whole expressionsexpr /. rulesapply rules to all subparts of exprReplace expr, rulesapply rules to the whole of expr onlyReplace expr, rules, levspecapply rules to parts of expr on levels specified by levspecAppl
3、ying rules in one way or all possible waysReplace expr, rulesapply rules in one way onlyReplaceList expr, rulesapply rules in all possible ways第3页,共18页,2022年,5月20日,5点27分,星期二4November 18, 2004Start Learning Step by Step2. 对规则的操作Creating and using dispatch tablesDispatch rulescreate a representation o
4、f a list of rules that includes dispatch tablesexpr /. drulesapply rules that include dispatch tables第4页,共18页,2022年,5月20日,5点27分,星期二5November 18, 2004Start Learning Step by Step3. 定义Manual and automatic application of transformation rulesexpr /. lhs - rhsapply a transformation rule to a specific expr
5、essionlhs = rhsassign a value which defines a transformation rule to be used whenever possibleRemoving assignmentsx =.remove the value assigned to the object xClear x, y, .clear all the values of x, y, .第5页,共18页,2022年,5月20日,5点27分,星期二6November 18, 2004Start Learning Step by Step4. 赋值的一些特殊形式Modifying
6、values of variablesi+increment the value of i by 1i-decrement i+ipre-increment i-ipre-decrement ii += diadd di to the value of ii -= disubtract di from ix *= cmultiply x by cx /= cdivide x by c第6页,共18页,2022年,5月20日,5点27分,星期二7November 18, 2004Start Learning Step by Step4. 赋值的一些特殊形式( 续 )Assigning value
7、s to several variables at a timex = y = valueassign the same value to both x and yx, y = value1, value2assign different values to x and y x, y = y, xinterchange the values of x and yAssignments for modifying listsPrependTo v, elemprepend elem to the value of vAppendTo v, elemappend elemv = v, elemma
8、ke a nested list contaning elem第7页,共18页,2022年,5月20日,5点27分,星期二8November 18, 2004Start Learning Step by Step5. 索引的定义Manipulating indexed variablesai = valueadd or overwrite a valueaiaccess a valueai =.remove a value?ashow all defined valuesClearaclear all defined valuesTableai,i,1,n or Arraya, nconver
9、t to an explicit List第8页,共18页,2022年,5月20日,5点27分,星期二9November 18, 2004Start Learning Step by Step6. 函数的定义fx = valuedefinition for a specific expression xfx_ = valuedefinition for any expression, referred to as xThe difference between defining an indexed variable and a function第9页,共18页,2022年,5月20日,5点2
10、7分,星期二10November 18, 2004Start Learning Step by Step7. 定义的次序Treatment of definitions in MathematicaMathematica tries to put specific definitions before more general definitions第10页,共18页,2022年,5月20日,5点27分,星期二11November 18, 2004Start Learning Step by Step8. 即时和延时的定义lhs = rhs(immediate assignment)rhs i
11、s evaluated when the assignment is madelhs := rhs(delayed assignment)rhs is evaluated each time the value of lhs is requestedThe two types of assignments in MathematicaInterpretations of assignments with the = and := operatorslhs = rhsrhs is intended to be the final value of lhs( e.g., fx_=1-x2)lhs
12、:= rhsrhs gives a command or program to be executed whenever you ask for the value of lhs( e.g., fx_:=Expand1-x2)Defining functions for evaluating expressionsfx_ = exprdefine a function which gives the value expr for any particular value of x第11页,共18页,2022年,5月20日,5点27分,星期二12November 18, 2004Start Le
13、arning Step by Step8. 即时和延时的定义( 续 )lhs - rhsrhs is evaluated when the rule is givenlhs : rhsrhs is evaluated when the rule is usedTwo types of transformation rules in Mathematica第12页,共18页,2022年,5月20日,5点27分,星期二13November 18, 2004Start Learning Step by Step9. 记住已知值的函数fx_ := fx = rhsdefine a function w
14、hich remembers values that it findsDefining a function that remembers values it finds第13页,共18页,2022年,5月20日,5点27分,星期二14November 18, 2004Start Learning Step by Step10. 定义联系不同的符号Associating definitions with different symbolsfargs := rhsdefine a downvalue for ffgargs, . := rhsdefine an upvalue for gShor
15、ter ways to define upvaluesfg = value or fgargs = valuemake assignments to be associated with g, rather than ffg:=value or fgargs := valuemake delayed assignments associated with gfarg1, arg2, . = valuemake assignments associated with the heads of all the argi第14页,共18页,2022年,5月20日,5点27分,星期二15Novembe
16、r 18, 2004Start Learning Step by Step10. 定义联系不同的符号( 续 )Possible positions for symbols in definitionsf. := rhsdownvalue for ff/:fg.:=rhsdownvalue for fg/:f.,g,.:=rhsupvalue for gg/:f.,g.,.:=rhsupvalue for g第15页,共18页,2022年,5月20日,5点27分,星期二16November 18, 2004Start Learning Step by Step11. 定义数值值Defining
17、ordinary and numerical valuesexpr = valuedefine a value to be used whenever possibleNexpr = valuedefine a value to be used for numerical approximationDefining numerical valuesthat depend on numerical precisionNexpr = valuedefine a numerical value to be used when defalut numerical precision is requestedNexpr,n=valuedefine a numerical value to be used when n-digit precision is requested第16页,共18页,2022年,5月20日,5点27分,星期二17November 18, 2004Start Learning Step by Step12. 修改内置函数Protection for functionsUnprotectfremove protectionProtectfadd protection第17页,共18页,2022年,5月20日,5点27分,星期二18N
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 老年认知症非药物干预技师考试试卷及答案
- 2025年3月福建漳州台商投资区资产运营集团有限公司招聘人力资源服务外包人员13人笔试历年参考题库附带答案详解
- 2025山东石油化工学院招聘100人查看职位笔试历年参考题库附带答案详解
- 2025山东威海桃威铁路有限公司招聘24人笔试历年参考题库附带答案详解
- 2025安徽安庆同安控股有限责任公司选聘中层管理人员1人笔试历年参考题库附带答案详解
- 2025天津和平联通10010招聘50人笔试历年参考题库附带答案详解
- 2025国家电投集团中国电力招聘7人笔试历年参考题库附带答案详解
- 2025四川成都九洲迪飞科技有限责任公司招聘射频工程师等岗位81人笔试历年参考题库附带答案详解
- 2025呼伦贝尔五九煤炭集团招聘26人笔试历年参考题库附带答案详解
- 2025内蒙古锡林郭勒盟锡林浩特市机场招聘18人笔试历年参考题库附带答案详解
- 厨房用具购销合同样本
- 国开作业《公共关系学》实训项目1:公关三要素分析(六选一)参考552
- 中心传动浓缩机安装方案
- 西医三基-基础医学综合-诊断学-实验诊断
- 城市道路桥梁工程施工质量验收规范 DG-TJ08-2152-2014
- 结构的弹性稳定计算演示文稿
- 岗位经验萃取与案例
- 2023学年完整公开课版剪切计算
- 海天味业产品(按产品分类)
- GB/T 13871.1-2022密封元件为弹性体材料的旋转轴唇形密封圈第1部分:尺寸和公差
- GB/T 4798.6-2012环境条件分类环境参数组分类及其严酷程度分级船用
评论
0/150
提交评论