版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
变换规则和定义第一页,共十八页,2022年,8月28日2November18,2004StartLearningStepbyStep1.应用变换规则expr/.rules 在表达式上应用一次规则expr//.rules 在表达式上重复应用规则直道结果不再改变应用变换规则expr/.lhs->rhs 在表达式上应用某个变换规则expr/.{lhs1->rhs1,lhs2->rhs,...} 在表达式上依次应用一系列规则应用一组变换规则expr/.{rules1,rules2,...} 应用一组规则得到一个数组一次或重复应用规则第二页,共十八页,2022年,8月28日3November18,2004StartLearningStepbyStep1.应用变换规则(续)Applyingrulestowholeexpressionsexpr/.rules applyrulestoallsubpartsofexprReplace[expr,rules] applyrulestothewholeofexpronlyReplace[expr,rules,levspec] applyrulestopartsofexpronlevelsspecifiedbylevspecApplyingrulesinonewayorallpossiblewaysReplace[expr,rules] applyrulesinonewayonlyReplaceList[expr,rules] applyrulesinallpossibleways第三页,共十八页,2022年,8月28日4November18,2004StartLearningStepbyStep2.对规则的操作CreatingandusingdispatchtablesDispatch[rules] createarepresentationofalistofrulesthatincludesdispatchtablesexpr/.drules applyrulesthatincludedispatchtables第四页,共十八页,2022年,8月28日5November18,2004StartLearningStepbyStep3.定义Manualandautomaticapplicationoftransformationrulesexpr/.lhs->rhs applyatransformationruletoaspecificexpressionlhs=rhs assignavaluewhichdefinesatransformationruletobeusedwheneverpossibleRemovingassignmentsx=. removethevalueassignedtotheobjectxClear[x,y,...] clearallthevaluesofx,y,...第五页,共十八页,2022年,8月28日6November18,2004StartLearningStepbyStep4.赋值的一些特殊形式Modifyingvaluesofvariablesi++ incrementthevalueofiby1i-- decrementi++i pre-incrementi--i pre-decrementii+=di addditothevalueofii-=di subtractdifromix*=c multiplyxbycx/=c dividexbyc第六页,共十八页,2022年,8月28日7November18,2004StartLearningStepbyStep4.赋值的一些特殊形式(续)Assigningvaluestoseveralvariablesatatimex=y=value assignthesamevaluetobothxandy{x,y}={value1,value2} assigndifferentvaluestoxandy{x,y}={y,x} interchangethevaluesofxandyAssignmentsformodifyinglistsPrependTo[v,elem] prependelemtothevalueofvAppendTo[v,elem] appendelemv={v,elem} makeanestedlistcontaningelem第七页,共十八页,2022年,8月28日8November18,2004StartLearningStepbyStep5.索引的定义Manipulatingindexedvariablesa[i]=value addoroverwriteavaluea[i] accessavaluea[i]=. removeavalue?a showalldefinedvaluesClear[a] clearalldefinedvaluesTable[a[i],{i,1,n}]orArray[a,n] converttoanexplicitList第八页,共十八页,2022年,8月28日9November18,2004StartLearningStepbyStep6.函数的定义f[x]=value definitionforaspecificexpressionxf[x_]=value definitionforanyexpression,referredtoasxThedifferencebetween
defininganindexedvariableandafunction第九页,共十八页,2022年,8月28日10November18,2004StartLearningStepbyStep7.定义的次序TreatmentofdefinitionsinMathematicaMathematicatriestoputspecificdefinitionsbeforemoregeneraldefinitions第十页,共十八页,2022年,8月28日11November18,2004StartLearningStepbyStep8.即时和延时的定义lhs=rhs(immediateassignment) rhsisevaluatedwhentheassignmentismadelhs:=rhs(delayedassignment) rhsisevaluatedeachtimethevalueoflhsisrequestedThetwotypesofassignmentsinMathematicaInterpretationsofassignmentswiththe=and:=operatorslhs=rhs rhsisintendedtobethe"finalvalue"oflhs(e.g.,f[x_]=1-x^2)lhs:=rhs rhsgivesa"command"or"program"tobeexecutedwheneveryouaskforthevalueoflhs(e.g.,f[x_]:=Expand[1-x^2])Definingfunctionsforevaluatingexpressionsf[x_]=expr defineafunctionwhichgivesthevalueexprforanyparticularvalueofx第十一页,共十八页,2022年,8月28日12November18,2004StartLearningStepbyStep8.即时和延时的定义(续)lhs->rhs rhsisevaluatedwhentheruleisgivenlhs:>rhs rhsisevaluatedwhentheruleisusedTwotypesoftransformationrulesinMathematica第十二页,共十八页,2022年,8月28日13November18,2004StartLearningStepbyStep9.记住已知值的函数f[x_]:=f[x]=rhs defineafunctionwhichremembersvaluesthatitfindsDefiningafunctionthatremembersvaluesitfinds第十三页,共十八页,2022年,8月28日14November18,2004StartLearningStepbyStep10.定义联系不同的符号Associatingdefinitionswithdifferentsymbolsf[args]:=rhs defineadownvalueforff[g[args],...]^:=rhs defineanupvalueforgShorterwaystodefineupvaluesf[g]^=valueorf[g[args]]^=value makeassignmentstobeassociatedwithg,ratherthanff[g]^:=valueorf[g[args]]^:=value makedelayedassignmentsassociatedwithgf[arg1,arg2,...]^=value makeassignmentsassociatedwiththeheadsofalltheargi第十四页,共十八页,2022年,8月28日15November18,2004StartLearningStepbyStep10.定义联系不同的符号(续)Possiblepositionsforsymbolsindefinitionsf[...]:=rhs downvalueforff/:f[g[...]][...]:=rhs downvalueforfg/:f[...,g,...]:=rhs upvalueforgg/:f[...,g[...],...]:=rhs upvalueforg第十五页,共十八页,2022年,8月28日16November18,2004StartLearningStepbyStep11.定义数值值Definingordinaryandnumericalvaluesexpr=value defineavaluetobeusedwheneverpossibleN[expr]=value defineavaluetobeusedfornumericalapproximationDefiningnumericalvalues
thatdependonnumericalprecisionN[expr]=value defineanumericalvaluetobeusedwhendefalutnumericalprecisionisrequestedN[expr,n]=value defineanumericalvaluetobeusedwhenn-digitprecisionisrequested第十六页,共十八页,2022年,8月28日17November18,2004StartLearningStepbyStep12.修改内置函数ProtectionforfunctionsUnprotect[f] removeprotectionProtect[f] addprotection第十七页,共十八页,2022年,8月28日18N
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年冲床租赁协议(餐厅设备)
- 长春金融高等专科学校《公司金融》2025-2026学年期末试卷
- 江西理工大学《计量经济学实验课》2025-2026学年期末试卷
- 阳泉职业技术学院《工程管理概论》2025-2026学年期末试卷
- 安徽粮食工程职业学院《放射治疗学》2025-2026学年期末试卷
- 2026年重庆市渝高中学中考英语二诊试卷
- 2026年人教版小学一年级语文下册识字方法综合运用卷含答案
- 2026年人教版小学三年级数学下册描述简单路线图卷含答案
- 2026年人教版小学六年级数学上册分数应用题综合训练卷含答案
- 深度解析(2026)《GBT 3785.3-2018电声学 声级计 第3部分:周期试验》
- 国家机关事务管理局所属事业单位2025年度公开招聘应届毕业生笔试模拟试题
- 【喀什】2025下半年新疆喀什技师学院面向社会公开引进急需紧缺人才23人笔试历年典型考题及考点剖析附带答案详解
- 初中地理七年级下册《热力巴西-自然基底与人文脉动探究》教案
- 发电厂设备预防性试验作业指导书
- 2026年及未来5年市场数据中国IC封装载板行业发展全景监测及投资前景展望报告
- 2026年高考地理高分冲刺学习指南
- 第二单元 辽宋夏金元时期:民族关系发展和社会变化 单元总结 - 学生版
- 国开2026年《公共政策概论》形成性考核任务1-4答案
- 2026年3月版-安全环境职业健康法律法规、规章、标准文件清单
- 2026贵州贵阳经济开发区招聘工作人员20名考试参考题库及答案解析
- 收入预测工作制度
评论
0/150
提交评论