MuPAD部分命令学习.docx

上传人:b****1 文档编号:20186833 上传时间:2023-04-25 格式:DOCX 页数:35 大小:538.44KB
下载 相关 举报
MuPAD部分命令学习.docx_第1页
第1页 / 共35页
MuPAD部分命令学习.docx_第2页
第2页 / 共35页
MuPAD部分命令学习.docx_第3页
第3页 / 共35页
MuPAD部分命令学习.docx_第4页
第4页 / 共35页
MuPAD部分命令学习.docx_第5页
第5页 / 共35页
点击查看更多>>
下载资源
资源描述

MuPAD部分命令学习.docx

《MuPAD部分命令学习.docx》由会员分享,可在线阅读,更多相关《MuPAD部分命令学习.docx(35页珍藏版)》请在冰豆网上搜索。

MuPAD部分命令学习.docx

MuPAD部分命令学习

GettingStartedwithMuPAD

ThisguideisintendedtoquicklygetyoufamiliarwiththewaythatMuPADworks.MuPADhasmanyfeaturesthatwecannotcoverinashortguide,buttheguideshouldbeenoughtogetyoustarted.Theprogramhasaveryniceon-linehelpfacilityformoredetailedinformation.YoushouldworkthroughthisguidebycopyingthecommandsintoMuPAD.Youcouldretype,orjustusecopyandpaste.

Contents:

MuPADasacalculator

GettingHelp

SymbolicCalculations

SavingYourWork

Variables

Functions

PlottingGraphsofFunctions

Differentiation

Integration

SolvingEquations

SolvingInequalities

Limits

ComplexNumbers

Sums(orSeries(级数))

PowerSeries(幂级数)

MatricesandVectors

Sequences,ListsandSets

Libraries

MoreonMatricesandVectors

Exportthelinearalgebralibrary

MoreGraphics

DifferentialEquations

NumericalSolutionofODEs

ElementsofProgramming

MuPADignorescomments

MuPADasacalculator

Enterthefollowing.Youcouldcopyandpasteintomupad,orretype.

354/36

MuPADlikestodoexactcalculations.Youcangetapproximateresultsbyusingfloat:

float(%) 

Thesymbol%referstotheresultofthelastcalculation.Similarly%2,%3,etc.refertothesecond-to-last,third-to-lastandsoon.

sqrt(%2)

Thiscan'tbeevaluatedexactlysomupadjustrationalises(合理的说明)thedenominator(分母).Youcanfurthersimplifyexpressionsusingmupad'ssimplify:

simplify(%) 

Ifthere'sadecimalpointinanexpressionthenmupadtreatsitasbeingapproximateandgivesananswerintermsof(依据)decimals:

sqrt(118.0/69),sqrt(118/69)

MuPADhasallthemathematicalfunctionsandoperationsthatyoufindonacalculator,andmanymore:

3!

exp

(1),ln(2.3),sin(PI/4),log(2,16),cos(PI/3),arctan

(1)

Someotherusefulfunctionsarefloor,ceil,frac.

floor(x)isthegreatestintegerlessthanorequaltox.

ceil(x)istheleastintegergreaterthanorequaltox.

frac(x)isthefractionalpart(小数部分)ofx.

Simicolons(分号)betweenexpressionsyieldoutputondifferentlinesbutcommas(逗号)keeptheoutputonthesameline.Infact,commasareusedtoputthingsinasequence,so3^(1/2),4isregardedasonepieceofoutput(asequence)inthefollowing.

3;sqrt(3),4;2^3 

Acolonsuppresses(抑制,禁止)theprecedingoutput,Quiteusefulfordoingabunchofcalculationsinonestep:

4:

2^3

GettingHelp

TherearetwowaystouseMuPAD'sHelpfeature.TofindoutmoreaboutaMuPADfunctionjustenter?

followedbythefunctionname.

Trythis:

?

log

Theotherwaytogethelpisthroughthehelpmenu.ThisstartsahelpbrowserthatletsyousearchforinformationaboutMuPAD.

SymbolicCalculations

Thefunctionsexpand,simplify,normalandfactorareveryusefulformanipulating(

处理,化简)expressions:

expand((2+x)^3-(5+2*x)^2+17)

factor(%)

simplify((2*x^2+3*x+1)/(x+1)^2)

Thefunctionnormalrewritesarationalexpression(有理表达式)asasinglefraction(分数):

normal(2/x+3*(x+1)/(x^2+1))

simplify(sin(x)^2+cos(x)^2)

SavingYourWork

TheFilemenuofMuPADLightallowsyoutosaveyoursessionasatextfile.Thiscanbeopenedwithatexteditor(suchasTextPadifyouuseaPC),orawordprocessingprogram(suchasMSWord).Youcouldalsojustcopyandpasteeverythingintoawordprocessingprogram(文字处理程序).IfyouneedtouseyourMuPADstatementsagain,justcopyandpastebackintoMuPAD.MuPADLightusesaprogramVCAMLighttodisplaygraphics.YoucancopyandpastegraphicsintoaMSWorddocumentaswell.MuPADProuserscandothesethingsaswellbutthisprogramallowsuserstosavetheirworkandgraphicsinnotebooks.

Variables

Avariablecanbeassignedavaluebyusingthesymbol:

=

x:

=2

2*x^2+y

y:

=5

IfyouaskMuPADforthesecond-to-lastoutput,itwon'tevaluateitwiththenewvalueofy

%2

butyoucanaskittoevaluateitwiththeevalcommand.

eval(%)

VariablesneednotjusthavenumericalvaluesinMuPAD.TheycanbeequatedtoanyMuPADexpression.

B:

=z^2+5*z+1

Wecouldsubstitute(代替,替换)thevaluez=5intothisexpressionusingMuPAD'ssubscommand:

subs(B,z=5)

Youlistallofthevariablesthatyouareusingwiththefunctionanames.

anames(All,User)

Variablescanbedeletedfrommemoryandyou'llneedtodothisfromtimetotime(不时的)whenyouusevariablesfordifferentthings.

deleteB,y:

NowifweenterthesevariablesthenMuPADjustdisplaystheirsymbolsbecausetheydon'thavevalues.

B,y

Functions

WehavealradyseenthatMuPADhaslotsofbuilt-infunctions.Wecanalsobuildourownfunctions.

e.g.Thefunctionf(x)=x^2+1canbethoughtofasanoperationthatmapsanumberxtoanumberx^2+1,i.e.x->x^2+1.

f:

=x->x^2+1

f

(2) ,f(a)

CompositionoffunctionsishandledwithMuPAD's@operator.Asanexample,tocompute

with

g:

=x->2*x:

justdothis:

h:

=f@g

h(3)

Alternatively,youcoulddefinehmoreexplicitly(明确地,明白地):

h:

=x->f(g(x))

Functionsoftwoormorevariablescanbewrittenlikethis:

g:

=(x,y)->x*y 

g(2,5)

It'seasytowritepiece-wisedefinedfunctions(分段函数)inMuPAD.Forexample,let'senterthefollowingfunctionintoMuPAD:

f:

=x->piecewise([x<-1,x+2],[x>=-1andx<3,1],[x>=3,x^2]) 

PlottingGraphsofFunctions

Functionsareeasilyplottedwithplotfunc2d.

plotfunc2d(sin(x),cos(x),x=-PI..PI)

Wecanalsospecifytheplotrangeinthey-directionandthenumberofpointsusedtocreatethegraph:

plotfunc2d((x+1)/(x^2-5),x=-8..8,y=-10..10)

Thedefaulttitleofagraphisjustthemathematicalexpressionforwhatisbeinggraphed.ButyoucanchangethiswiththeTitleoption:

f:

=x->piecewise([x<-1,x+2],[x>=-1andx<3,1],[x>=3,x^2-8]):

plotfunc2d(f(x),x=-3..4,Title="Graphoff(x)")

Youcanalsochangetheaxislabels.Forexample,toplottherelationw=t^2,withfancyaxislabels,dosomethinglikethis:

plotfunc2d(t^2,t=-2..2,AxesTitles=["timet(hours)","distancew(metres)"])

Youcanplot functionsoftwovariableswithplotfunc3d:

plotfunc3d(1-x^2-y^2,x=-2..2,y=-2..2)

Youcanevenplotanumberoffunctions,aswellasspecifyingthenumberofgridpointsfortheplot,andthepointfromwheretheplotisviewed:

plotfunc3d(1-x^2-y^2,3-2*x-2*y,x=-2..2,y=-2..2,Mesh=[20,30],CameraDirection=[-20,5,0])

Differentiation

Thefunctiondiffdifferentiates:

diff(x^3,x) 

Higherorderderivatives(高阶微分)arecomputedlikethis4thderivative:

diff(exp(a*x),x$4)

ButMuPADalsounderstandsprimenotationforderivatives.

sin'(x)

g:

=x->3*cos(x^2+1):

g''(x)

Partialderivatives(偏微分)arehandledwithdiff.Forexample,tocalculate

enterthefollowing:

diff(h(x,y),x$2,y$3)

Theoutputshowsanotherwaytoenterpartialderivatives.

diff(h(x,y),x,x,y,y,y)

Integration

Useintforindefiniteordefiniteintegrals(定积分):

int(1/sqrt(1-x^2),x)

Thisistheantiderivative(原函数,反导数).

Don'tforgettoincludeanarbitraryconstant(任意常数)!

Tocalculate

justdothis:

int(1/sqrt(1-x^2),x=0..1)

Infinityisrepresentedbyinfinity:

int(1/(1+x^2),x=-infinity..infinity) 

Sometimesthereisnoniceexpressionforanintegral.Inthiscase,MuPADjustreturnstheformulathatyougaveit.Butyoucouldstillgetanumericalapproximation(近似值)toadefiniteintegral.

int(exp(-x^3),x=0..3)

float(%)

Ifyou'recalculatingintegralsusingpartialfractions(部分分式,),you'llfindthepartfracfunctionhandy(很方便的):

partfrac((2*x^3+3*x+1)/((x+1)*(x+2)^2),x) 

SolvingEquations

z:

=solve((x^2+2*x+2)/(x+3))

Therearetwosolutions.Topickoutthefirstsolution,trythis:

z[1]

solve(tan(y)=1,y)

Thisexampleinvolvesanarbitraryconstantthatbelongstothesetofintegers(整数集)(Z_inMuPAD).MuPADdenotes(表示)arbitraryconstantswithsymbolsX1,X2,X3,etc.

Tosolveasystemofequations,enclosetheequationsandthevariableswithcurlybraces(大括号):

solve({2*x^2+y=5,x+3*y=10},{x,y})

solve(a*x^2+b*x+c=0,x) 

NoticethatMuPADlistsallpossiblecases:

Thesetofallcomplexnumbersifa,bandcareallzero;theemptysetifaandbarezeroandcisnotzero;-c/bifa=0andbisnotzero;andtheusualsolutiontothequadraticequation(二次方程式)ifaisnon-zero.IfwetellMuPADthataisnotzerothenthesolutionsimplifies:

assume(a<>0):

solve(a*x^2+b*x+c=0,x),unassume(a)

SolvingInequalities

Thefunctionsolvealsosolvesinequalities.

solve(2*x^2-5*x+3>=0,x)

Oneuseforthisistofindoutwhereafunctionisincreasing.

f:

=x->(2*x+1)/(3*x+5)

solve(f'(x)>0,x),simplify(%);/*此应该用simplifyp化简命令化简,MATLAB中还有一个simple也可以化简。

*/

Anotherexample:

solve({3*x+1<0,2*x+5>0},x)

Limits

limit(sin(x)/x,x=0)

limit((3*x^2+6)/(2*x^2+sin(x)),x=infinity)

limit(x/abs(x),x=0)

Leftorrightlimitsmayexisteveniftheactuallimitdoesnot,andtheyareeasytocompute:

limit(x/abs(x),x=0,Left),limit(x/abs(x),x=0,Right)

ComplexNumbers

MuPADdenotesi=sqrt(-1)withthesymbolI.

solve(x^2+x+1=0,x) 

Thefunctionrectformexpressesacomplexnumberintheformx+Iy.

rectform(z):

computestherectangularformofthecomplexexpression,itsplits(分裂)into

.将复数转化成直角坐标的形式,即

的形式.

rectform(ln(1+I))

Realandimaginaryparts(实部与虚部)ofcomplexnumbers(复数)arefoundwithReandImandtheconjugate(共轭复数)withconjugate.

Re(%),Im(3+2*I),conjugate(4+7*I)

Theabsolutevalueofacomplexnumberisfoundwithabsandtheargument(辐角)witharg:

abs(1+5*I),arg(2+I)

Sums(orSeries(级数))

Tocompute

useMuPAD'ssumfunction:

sum(1/n^2,n=1..infinity) 

sum(k,k=1..n)

sum(n*exp(-n),n=1..5)

sum(sin(n)/n,n=1..infinity)

Althoughtheanswerisreal,it'swrittenintermsofcomplexnumbers.Userectformtogetanexpressionwhichdoesn'tinvolvecomplexnumbers.

rectform(%)//将一个复数化为x+iy形式,若没用y,也就说明这个数是实数;

SometimesMuPADcan'tgiveaniceexpre

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 教学研究 > 教学反思汇报

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1