版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
变换规则和定义第一页,共十八页,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徽商集团招聘1人考试参考题库及答案解析
- 2026广西壮族自治区人民医院防城港医院防城港市第一人民医院补充招聘食堂面点师2人考试参考题库及答案解析
- 2026渤海银行南京分行招聘考试备考试题及答案解析
- 2026中国科学院地球环境研究所特别研究助理(博士后)人才招聘考试备考题库及答案解析
- 2026中石安环公司寒假实习生招募考试参考试题及答案解析
- 2026江苏盐城市阜宁县科技成果转化服务中心选调10人考试参考题库及答案解析
- 2026年临沧市住房和城乡建设局招聘公益性岗位工作人员(4人)考试参考试题及答案解析
- 2026吉安井冈农业生物科技有限公司招聘见习1人笔试备考题库及答案解析
- 2026四川成都市西南石油大学校医院(成都校区)招聘2人考试参考题库及答案解析
- 2026安徽消防中控员考试参考题库及答案解析
- 2026年四川单招单招考前冲刺测试题卷及答案
- 2026年全国公务员考试行测真题解析及答案
- (2025)70周岁以上老年人换长久驾照三力测试题库(附答案)
- 2026年泌尿护理知识培训课件
- 昆山钞票纸业有限公司2026年度招聘备考题库附答案详解
- GB/T 46793.1-2025突发事件应急预案编制导则第1部分:通则
- 2026元旦主题班会:马年猜猜乐马年成语教学课件
- 2025年中国工艺美术馆面向社会招聘工作人员2人笔试历年典型考题及考点剖析附带答案详解
- JJF 1147-2006消声室和半消声室声学特性校准规范
- GB/T 3630-2006铌板材、带材和箔材
- GB/T 2951.11-2008电缆和光缆绝缘和护套材料通用试验方法第11部分:通用试验方法-厚度和外形尺寸测量-机械性能试验
评论
0/150
提交评论