/
1IntroductionToinvokeMaximainaconsole,typemaximante;&#xr000;Thecom 1IntroductionToinvokeMaximainaconsole,typemaximante;&#xr000;Thecom

1IntroductionToinvokeMaximainaconsole,typemaximante;&#xr000;Thecom - PDF document

pamella-moone
pamella-moone . @pamella-moone
Follow
364 views
Uploaded On 2015-09-01

1IntroductionToinvokeMaximainaconsole,typemaximante;&#xr000;Thecom - PPT Presentation

HoweveritisoftenusefultoexpressaresultindecimalnotationThismaybeaccomplishedbyfollowingtheexpressionyouwantexpandedbynumeri4numero48201219330881977Notetheusehereoftorefertothepreviou ID: 120290

However itisoftenusefultoexpressaresultindecimalnotation.Thismaybeaccom-plishedbyfollowingtheexpressionyouwantexpandedby\ numer":(%i4)% numer;(%o4)82.01219330881977Notetheusehereof%torefertothepreviou

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "1IntroductionToinvokeMaximainaconsole,ty..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1IntroductionToinvokeMaximainaconsole,typemaximante;&#xr000;Thecomputerwilldisplayagreetingofthesort:DistributedundertheGNUPublicLicense.SeethefileCOPYING.DedicatedtothememoryofWilliamSchelter.ThisisadevelopmentversionofMaxima.Thefunctionbug_report()providesbugreportinginformation.(%i1)The(%i1)isa\label".Eachinputoroutputlineislabelledandcanbereferredtobyitsownlabelfortherestofthesession.ilabelsdenoteyourcommandsandolabelsdenotedisplaysofthemachine'sresponse.Neverusevariablenameslike%i1or%o5,asthesewillbeconfusedwiththelinessolabeled.Maximadistinguishesloweranduppercase.Allbuilt-infunctionshavenameswhicharelowercaseonly(sin,cos,save,load,etc).Built-inconstantshavelowercasenames(%e,%pi,inf,etc).IfyoutypeSIN(x)orSin(x),Maximaassumesyoumeansomethingotherthanthebuilt-insinfunction.User-de nedfunctionsandvariablescanhavenameswhichareloweroruppercaseorboth.foo(XY),Foo(Xy),FOO(xy)arealldi erent.2Specialkeysandsymbols1.ToendaMaximasession,typequit();.2.ToabortacomputationwithoutleavingMaxima,type^C.(Here^standsforthecontrolkey,sothat^Cmeans rstpressthekeymarkedcontrolandholditdownwhilepressingtheCkey.)Itisimportantforyoutoknowhowtodothisincase,forexample,youbeginacomputationwhichistakingtoolong.Forexample:(%i1)sum(1/x^2,x,1,100000)$^CMaximaencounteredaLisperror:Interactiveinterruptat#x7FFFF74A43C3.Automaticallycontinuing.ToenabletheLispdebuggerset*debugger-hook*tonil.(%i2)3.InordertotellMaximathatyouhave nishedyourcommand,usethesemicolon(;),followedbyareturn.Notethatthereturnkeyalonedoesnotsignalthatyouaredonewithyourinput.2 However,itisoftenusefultoexpressaresultindecimalnotation.Thismaybeaccom-plishedbyfollowingtheexpressionyouwantexpandedby\,numer":(%i4)%,numer;(%o4)82.01219330881977Notetheusehereof%torefertothepreviousresult.InthisversionofMaxima,numergives16signi cant gures,ofwhichthelastisoftenunreliable.However,Maximacano erarbitrarilyhighprecisionbyusingthebfloatfunction:(%i5)bfloat(%o3);(%o5)8.201219330881976b1Thenumberofsigni cant guresdisplayediscontrolledbytheMaximavariablefpprec,whichhasthedefaultvalueof16:(%i6)fpprec;(%o6)16Hereweresetfpprectoyield100digits:(%i7)fpprec:100;(%o7)100(%i8)''%i5;(%o8)8.20121933088197564152489730020812442785204843859314941221\2371240173124187540110412666123849550160561b1Notetheuseoftwosinglequotes('')in(%i8)torepeatcommand(%i5).Maximacanhandleverylargenumberswithoutapproximation:(%i9)100!;(%o9)9332621544394415268169923885626670049071596826438162146859\2963895217599993229915608941463976156518286253697920827223758251\1852109168640000000000000000000000004AlgebraMaxima'simportanceasacomputertooltofacilitateanalyticalcalculationsbecomesmoreevidentwhenweseehoweasilyitdoesalgebraforus.Here'sanexampleinwhichapolynomialisexpanded:(%i1)(x+3*y+x^2*y)^3;23(%o1)(xy+3y+x)(%i2)expand(%);63432335232(%o2)xy+9xy+27xy+27y+3xy+18xy2423+27xy+3xy+9xy+x4 Notethatthedisplayconsistsofa\list",i.e.,someexpressioncontainedbetweentwobrackets[...],whichitselfcontainstwolists.Eachofthelattercontainadistinctsolutiontothesimultaneousequations.TrigonometricidentitiesareeasytomanipulateinMaxima.Thefunctiontrigexpandusesthesum-of-anglesformulastomaketheargumentinsideeachtrigfunctionassimpleaspossible:(%i10)sin(u+v)*cos(u)^3;3(%o10)cos(u)sin(v+u)(%i11)trigexpand(%);3(%o11)cos(u)(cos(u)sin(v)+sin(u)cos(v))Thefunctiontrigreduce,ontheotherhand,convertsanexpressionintoaformwhichisasumofterms,eachofwhichcontainsonlyasinglesinorcos:(%i12)trigreduce(%o10);sin(v+4u)+sin(v-2u)3sin(v+2u)+3sin(v)(%o12)---------------------------+-------------------------88Thefunctionsrealpartandimagpartwillreturntherealandimaginarypartsofacomplexexpression:(%i13)w:3+k*%i;(%o13)%ik+3(%i14)w^2*%e^w;2%ik+3(%o14)(%ik+3)%e(%i15)realpart(%);323(%o15)%e(9-k)cos(k)-6%eksin(k)5CalculusMaximacancomputederivativesandintegrals,expandinTaylorseries,takelimits,andobtainexactsolutionstoordinarydi erentialequations.Webeginbyde ningthesymbolftobethefollowingfunctionofx:(%i1)f:x^3*%e^(k*x)*sin(w*x);3kx(%o1)x%esin(wx)Wecomputethederivativeoffwithrespecttox:(%i2)diff(f,x);3kx2kx(%o2)kx%esin(wx)+3x%esin(wx)3kx+wx%ecos(wx)6 Maximaalsopermitsderivativestoberepresentedinunevaluatedform(notethequote):(%i9)'diff(y,x);dy(%o9)--dxThequoteoperatorin(%i9)means\donotevaluate".Withoutit,Maximawouldhaveobtained0:(%i10)diff(y,x);(%o10)0Usingthequoteoperatorwecanwritedi erentialequations:(%i11)'diff(y,x,2)+'diff(y,x)+y;2dydy(%o11)---+--+y2dxdxMaxima'sode2functioncansolve rstandsecondorderODE's:(%i12)ode2(%o11,y,x);-x/2sqrt(3)xsqrt(3)x(%o12)y=%e(%k1sin(---------)+%k2cos(---------))228 [-1a1][][1-aa][][11-1](%o4)-----------------a+1In(%i4),themodi erdetoutkeepsthedeterminantoutsidetheinverse.Asacheck,wemultiplymbyitsinverse(notetheuseoftheperiodtorepresentmatrixmultiplication):(%i5)m.%o4;[-1a1][][1-aa][01a][][][11-1](%o5)[101].-----------------[]a+1[110](%i6)expand(%);[a1][-----+-----00][a+1a+1][][a1](%o6)[0-----+-----0][a+1a+1][][a1][00-----+-----][a+1a+1](%i7)factor(%);[100][](%o7)[010][][001]Inorderto ndtheeigenvaluesandeigenvectorsofm,weusethefunctioneigenvectors:10 echoesit,tomakesure---------------------------------------------------------------------------*/print("f=",f),/*---------------------------------------------------------------------------producesalistwiththetwopartialderivativesoff---------------------------------------------------------------------------*/eqs:[diff(f,x),diff(f,y)],/*---------------------------------------------------------------------------producesalistofunknowns---------------------------------------------------------------------------*/unk:[x,y],/*---------------------------------------------------------------------------solvesthesystem---------------------------------------------------------------------------*/solve(eqs,unk))$Theprogram(whichisactuallyafunctionwithnoargument)iscalledcritpts.EachlineisavalidMaximacommandwhichcouldbeexecutedfromthekeyboard,andwhichisseparatedbythenextcommandbyacomma.Thepartialderivativesarestoredinavariablenamedeqs,andtheunknownsarestoredinunk.Hereisasamplerun:(%i1)batch("critpts.max");batching#p/home/robert/tmp/maxima-clean/maxima/critpts.max(%i2)critpts():=(print("programtofindcriticalpoints"),f:read("enterf(x,y)"),print("f=",f),eqs:[diff(f,x),diff(f,y)],unk:[x,y],solve(eqs,unk))(%i3)critpts();programtofindcriticalpointsenterf(x,y)%e^(x^3+y^2)*(x+y);23y+xf=(y+x)%e(%o3)[[x=.4588955685487001%i+.3589790871086935,y=.4942017368275118%i-.1225787367783657],[x=.3589790871086935-.4588955685487001%i,y=-.4942017368275118%i-.1225787367783657],[x=.4187542327234816%i-.6923124204420268,y=0.455912070111699-.8697262692814121%i],[x=-.4187542327234816%i-.6923124204420268,y=.8697262692814121%i+0.455912070111699]]12 expand(a)Algebraicallyexpandsa.Inparticularmultiplicationisdistributedoverad-dition.exponentialize(a)Transformsalltrigonometricfunctionsinatotheircomplexexpo-nentialequivalents.factor(a)Factorsa.freeof(a,b)Istrueifthevariableaisnotpartoftheexpressionb.grind(a)Displaysavariableorfunctionainacompactformat.WhenusedwithwritefileandaneditoroutsideofMaxima,ito ersaschemeforproducingbatch leswhichincludeMaxima-generatedexpressions.ident(a)Returnsanaaidentitymatrix.imagpart(a)Returnstheimaginarypartofa.integrate(a,b)Attemptsto ndtheinde niteintegralofawithrespecttob.integrate(a,b,c,d)Attemptsto ndtheinde niteintegralofawithrespecttob.takenfromb=ctob=d.Thelimitsofintegrationcanddmaybetakenisinf(positivein nity)ofminf(negativein nity).invert(a)Computestheinverseofthesquarematrixa.kill(a)RemovesthevariableawithallitsassignmentsandpropertiesfromthecurrentMaximaenvironment.limit(a,b,c)Givesthelimitofexpressionaasvariablebapproachesthevaluec.Thelattermaybetakenasinfofminfasinintegrate.lhs(a)Givestheleft-handsideoftheequationa.loadfile(a)Loadsadisk lewith lenameafromthecurrentdefaultdirectory.Thedisk lemustbeintheproperformat(i.e.createdbyasavecommand).makelist(a,b,c,d)Createsalistofa's(eachofwhichpresumablydependsonb),con-catenatedfromb=ctob=dmap(a,b)Mapsthefunctionaontothesubexpressionsofb.matrix(a1,a2,...,an)Createsamatrixconsistingoftherowsai,whereeachrowaiisalistofmelements,[b1,b2,...,bm].num(a)Givesthenumeratorofa.ode2(a,b,c)Attemptstosolvethe rst-orsecond-orderordinarydi erentialequationaforbasafunctionofc.part(a,b1,b2,...,bn)Firsttakestheb1thpartofa,thentheb2thpartofthat,andsoon.14