CramX Logo
Solution Manual For Introduction To Linear Algebra, 5th Edition - Document preview page 1

Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 1

Document preview content for Solution Manual For Introduction To Linear Algebra, 5th Edition

Solution Manual For Introduction To Linear Algebra, 5th Edition

Stay on top of your textbook work with Solution Manual For Introduction To Linear Algebra, 5th Edition, a guide offering complete solutions for every exercise.

Ella Hall
Contributor
4.3
0
12 months ago
Preview (16 of 314 Pages)
100%
Log in to unlock
Page 1 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 1 preview imageMarieVaniskoDouglasB.MeadeIntroductiontoLinearAlgebraaFIFTHEDITION:LeeW.Iohnson®R.DeonRipsmJimmyI.fmoldSoCeeelaEeEe
Page 2 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 2 preview imageDownloadedfromStudyXY.com®+StudyXYSdYe.o>\|iFprE\3SStudyAnythingThisContentHasbeenPostedOnStudyXY.comassupplementarylearningmaterial.StudyXYdoesnotendroseanyuniversity,collegeorpublisher.Allmaterialspostedareundertheliabilityofthecontributors.wv8)www.studyxy.com
Page 3 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 3 preview imageBASICOPERATIONS1_—MapleTechnologyResourceManualMapleisapopularandpowerfulsoftwaretoolusedforthenumeric,symbolic,andgraphicanalysisofmathematicalproblems.Unlikemosttraditionalcomputationalsoftware,acomputeralgebrasystem(CAS)suchasMapleisdesignedtoperformexactsymbolicmanipulationsofmathematicalobjects,includingvectorsandmatrices.ThepurposeofthissupplementistointroducethebasicMaplecommandsneededtostartusingMapleasatoolforexploringthelinearalgebratopicsdevelopedinthistext.Maple,likeanyothercomputeralgebrasystem(CAS),isdesignedtoperformsymboliccomputations.Thatis,Maplecanmanipulateandprocessmathematicalobjectssuchasexpressions,equations,sets,vectors,andmatricesusingtherulesofalgebratherebyavoidingmanyofthenumericalissuesthatareinvolvedinmostfloating-pointnumericcomputations.Maplecanalsoperformnumericcomputations,butthefocusofthissupplementisontheexactsymboliccomputationsrelatedtolinearalgebra.1BasicOperationsLaunchMaple.WhenMapleopensalargewindowwillappear.Thiswindowprovidesanenvironmentforcreating,modifying,andviewingMapledocuments,calledworksheetsor.mwsfiles.AMapleworksheetcancontaintext,input,output,andgraphics(includinganimations).Worksheetsareplatform-independentASCIIfilesthatareeasilytransferredbetweenusersviae-mailortheWWW.Maplecanbeusedforsimplecomputations,suchasthefollowing:>8*17+49;185>alpha:=sin(Pi/3);1a=3V3If,insteadofasemi-colon,acolonisusedtoterminateaMaplecommand,theoutputofthecommandissuppressed:>beta:=sqrt(1+7/10*alpha):Ifneitherasemi-colonnoracolonisusedtoterminateaMaplecommand,anerrormessagewillbegenerated:>beta”2Warning,prematureendofinput‘Whenthisoccurs,itisnotnecessarytore-typethecommand.Simplypositionthecursorattheendofthecommand,typetheappropriateterminalcharacterandre-executethecommand.Notethatassignmentsaremadeusing“:="and“=”isusedtoconstructequations:>beta=evalf(beta);175V100+353=1267366475Maplehasanextensiveonlinehelpdatabase.Typehelp(topic);ortheshorthand?topictogethelponaspecifictopic.ForafirstlookatMaple’slinearalgebracapabilities,enterandexecutethecommand?linalg.TheHelppull-downmenuinthemenubarofMaple’sgraphicaluserinterfaceprovidessearchtoolsforaccessingMaple’shelpdocumentswhenthespecifictopicorMaplecommandnameisnotknown.StudyXY
Page 4 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 4 preview image2MAPLETECHNOLOGYRESOURCEMANUALInordertohaveameansofaccessingpreviousresultsitisagoodideatoassignresultstounique(andmeaningful)names.Maplenamesarecase-sensitive(e.g.,theconstant7isPi,notpinorPI).See?namesforadditionalinformationaboutvalidnamesinMaple.Exercisesfor§12.Evaluatetan14.32.Hint:See?mathforexamplesshowingtheuse3.Evaluate([sin41)*usingexactofsomeofMaple’sbasicmathematicalarithmetic,using32-,16-,8-,4,2-,andfunctions.1-digitfloating-pointarithmetic.(Note1.Evaluate3.132+|cosv/7|.thattheresultsarenotalwaysthesameasroundingthisnumbertothespecifiednumberofdigits.)2EnteringMatricesSupposewewishtoenterthematrix1-1011A=|131].0ee1Priortoenteringthematrixitisnecessarytousethecommandwith(linalg);toloadMaple’slinalgpackage.ToenterAtypethecommand:>A:=matrix(3,3,[1,-1,0,1/2,3,1/3,0,exp(Pi),1]);1-1011A=|3330e™1Thefirsttwoargumentsofthismatrixcommandspecifythenumberofrowsandcolumnsinthematrix.Ifthematrixdimensionserenotstatedexplicitly,extrasquarebrackets(“[”,|”)mustbeusedtoseparatetherows:>Ac:=matrix([[1,-1,03,[1/2,3,1./31,[0,exp(Pi),111);1-101A=53.33333333330em1See?matrixforafulldescriptionofthesyntaxofthematrixcommand.Noticethatthe(2,3)entryofAhasbeenconvertedtoafloating-pointapproximation,butnottheotherfractionortheexponentialfunction.Ingeneral,Maplepreservesexactvaluesuntilafloating-pointnumberappearsinanexpressionoruntiltheevalfcommandisused.Afloating-pointversionofthismatrix,withfive(5)significantdigits,isobtainedwith:>evalf(evalm(A),5);1.-10..500003..333330.23.1411.ThedefaultnumberofsignificantdigitsiscontainedintheMaplenameDigits.Unlessexplicitlychanged,allfloating-pointcomputationsareperformedwithten(10)significantdigits.Thatis,atthestartofaMaplesession,theassignmentDigits:=10:isexecuted.StudyXY
Page 5 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 5 preview imageTHEGAUSSELIMANDGAUSSJORDCOMMANDS3Therowandcolumnindicescanbeusedtoaccessindividualelementsofamatrix.Forexample,tonegatethe(2,1)elementofA,type:>A[2,1]:=-A[2,1];-1Agi=5Toseethecurrentvalueofamatrix,usetheevalmcommand:>evalm(A);1-10-153.33333333330e"1Exercisesfor§22.Obtainthefloating-pointversionofthe1.CreatethematrixQbychangingthematrixQcreatedinExercise1(1,3)entryofAfrom0to2.3ThegausselimandgaussjordCommandsTheMaplecommandsgausselimandgaussjorduseelementaryrowoperationstotransformamatrixtoechelonformandreducedechelonform,respectively.Toillustrate,considertheproblemofsolvingthesystemzy+229+223+x4=32z7+4p+3x3+44=6ThepairoflinearequationscanbeenteredinMapleas:>eql:= x[1]+2xx[2]+2%x[3]+x[4]=3:>eq2:=2xx[1]+4xx[2]+3*x[3]+4*x[4]=6:Theaugmentedcoefficientmatrixis:>A:=genmatrix([eql,eq2],[x[i]$i=1..4],flag);12213A=|24346Thereducedechelonformoftheaugmentedmatrixis:>Ar:=gaussjord(A);12053a=}01-2HThus,theoriginalsystemisequivalenttoBx=bwith:>B:=submatrix(Ar,1..2,1..4);>b:=convert(submatrix(Ar,1..2,[5]),vector);[tr205B=E01—2b:=[3,0]StudyXY
Page 6 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 6 preview image4MAPLETECHNOLOGYRESOURCEMANUALThetwolinearequationsinthereducedsystemare:>sol:=geneqns(B,x,b);sol:={z1+222+524=3,2324=0}Fromwhichthesolutionsareseentobe:>solve(sol,{x[11,x[3]1});{#1=—229524+3,23=224}ThelinsolvecommandreturnsthegeneralsolutionwhenthesystemhasaninfinitenumberofsolutionsandNULL(theemptyresponse)whenthesystemofequationsisinconsistent.Exercisesfor§32.SolvethesysteminExercise31(Section1.SolvethesysteminExercise30(Section1.2).1.2).4SurgeryonMatricesMapleprovidesconvenienttoolsforthemanipulationofindividualelementsandsubmatrices(blocks)ofexistingmatricestocreatenewmatrices.Toillustrate,considerthe3x4matrix:>B:=matrix(3,4,[[1,3,-5,0],>[9,6,-2,11,>[o,4,4,111):ToextractanindividualelementofB,sayby3,use:>b23:=B[2,3];b23:=—2Toextractthe2x2blockfromtheupper-rightcornerofB,type:>Bl:=submatrix(B,[1,2],[3,4]);-50NET)ThiscommandinstructsMapletodefineanewmatrix,B1,madefromrows1and2ofBandcolumns3and4ofB.Anequivalentwaytoachievethesameresultis:>Bl:=submatrix(B,1..2,3..4);-50NET]Therangenotationlo..hiisanabbreviationforallintegersbeginningwithloandendingwithhi.Similarly,amatrix@couldbeassignedtobetheupper-right2x3blockofBwiththecommand:>Q:=submatrix(B,[1,2],2..4);3-50Q:=|6-21TodefinePtoconsistofcolumns1,3,and4ofrows1and2ofB,use:>P:=submatrix(B,[1,2],[1,3,4]);1-50P=9-21StudyXY
Page 7 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 7 preview imageELEMENTARYROWOPERATIONSONMATRICES5Notethattherangenotationcouldnotbeusedtoselectthenonconsecutivecolumns1,3,and4.(ThedefinitionofPcoulduse[1,$(3..4)|asthethirdargumenttothesubmatrixcommand.)Toforma2x4matrixfromtheupper-leftandlower-right2x2blocksofB,constructthetwoblocksseparatelyandthenplacethemside-by-sidewiththecommands:>C1:=submatrix(B,1..2,1..2):>C2:=submatrix(B,2..3,3..4):>C:=augment(C1,C2);[13-21C=9641Theaugmentcommandcreatesacompositematrixbyplacingtheargumentsside-by-sideprovidedeachargumenthasthesamenumberofrows.TostackC1ontopofC2,use:>C3:=stackmatrix(C1,C2);1396C3:=2141.13Exercisesfor§4LigConsiderthematrix08—61342-8203470085~613—7A=23437.-1-10641344433-73008T1437Usematrixsurgerytocreateeachofthe064followingmatrices.5ElementaryRowOperationsonMatricesGaussandGauss-Jordaneliminationcanbecompletedinonestepwiththegausselimandgaussjordancommands,respectively.However,toobtainathoroughunderstandingofthesealgorithmsitisnecessarytopracticedecidingontheelementaryrowoperationtobeperformedateachstep.ThethreeMaplecommandsthatimplementthethreeelementaryrowoperationsareswaprow,mulrow,andaddrow.Toillustrate,considerthetransformationofAtoreducedechelonformwhere0213A=12316].3222StudyXY
Page 8 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 8 preview image6MAPLETECHNOLOGYRESOURCEMANUALTheoriginalmatrixis:>A:=matrix(3,4,[0,2,1,3,2,3,1,6,3,2,2,2]1):First,tohaveanon-zeropivotinthefirstrow,interchangerows1and2ofA:>Al:=swaprow(A,1,2);2316Al:=[02133222Thenextstepistocreatealeading1inthefirstrow,multiplyrow1ofAlby1/2:>A2:=mulrow(Al,1,1/A1[1,1]);3112=A2=22“102133222Toeliminatethe3inthe(1,3)position,add-3timesrow1torow3(ofA2):>A3:=addrow(A2,1,3,-A2(3,1]);311333A43=10213—5Notethatineachsteptheresultoftherowoperationisassignedtoanewname.Whilethisisnotrequired,itisrecommendedsothatthestateateachstepisavailableintheeventitisnecessarytoinvestigateadifferentsequenceofstepsortocorrectanerror.MapleCommandswaprow(A,i,j)|interchangerows4andjofmatrixAmulrow(A,i,r)multiplyrow7ofmatrixAby7addrow(A,j,i,r)|replacerowiofmatrixAwiththesumofrowiand7timesrowjExercisesfor§53.Useelementaryrowoperationstoputthe1.CompletethereductionofmatrixAtofollowingmatrixintoreducedroweche-lonform.reducedrowechelonform.2.CleteExercise44inSection1.2or2.CompleteExercinSection1.2.B=]111132606GraphingCurvesTographtheMapleexpression:>F:=cos(3%x+1)+sin(2¥x-3);F:=cos(3z+1)+sin(2z3)for0<z<10,useStudy
Page 9 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 9 preview imageGRAPHINGCURVES7>plot(F,x=0..10);187AAYB/|/|i|os|iJ|\SETNPBISBNPUSTof17iiERAN/esq)\VARRVi\/NERYREIi.SaliRR\Toaddaplotofy=sinztothisplot,modifythecommandto:>plot([F,sin(x)J,x=0..10);neAAIAi[[4p[fhAd[A][ERE0.51Por[ABE[ERJEIiTEREgli\lalPRa|e|AEANARBYBRAN4SeRARVARVARIBVAHE:vodfr)|RNLJSY,V4Analternatemethodforcombiningplotsistousethedisplaycommandfromtheplotspackage.Forexample,toaddtheplotsofy=sinandy=coszontheinterval[0,27]tothefirstgraph(onthelargerinterval[0,10])use:>pi:=plot(F,x=0..10):>p2:=plot([cos(x),sin(x)],x=0..2%Pi,color=[GREEN,BLUE]):>display([p1,p2]J);1sAJAAiIfAARSTNJA[\ZNETONRERSPBNPBSla|10NN]\7VoVANS0\Jos;|AdNJ|\/LLYXY/dyorvodDRYyStudy
Page 10 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 10 preview image8MAPLETECHNOLOGYRESOURCEMANUALNotethattheoutputfromthedefinitionsofp1andp2hasbeensupressed.Toviewoneoftheseplots,sayp2,useeitherdisplay(p2);orp2;.Plotscanbeenhancedwiththeinclusionofatitle,alegend,axislabels,ordifferentlinecolororlinestyle,etc..Theonlinehelptopic?plot,optionsprovidesacompletelistingofallavailableoptions.Toidentifythecoordinatesofapointintheplotwindow,forexample,thefirstintersectionofthegraphsofy=sinzandy=coszintheplotp2,positionthecursoronthedesiredpointandclickthe(left)mousebutton.Thecoordinateofthispointwillappearintheleft-mostboxonthecontextbar.Thesecoordinatescanbecopiedtothedesireddestination.Exercisesfor§6a)Createasingleplotwiththegraphsoff1.Considerthetwofunctionsandg..b)Notethatifdiscont=trueisomittedfromf(z)=cos2z+sinztheplotcommandusedtocreatetheplotandina)thereappeartobesevenplaceswherethetwographsintersect.Explaing(z)=0.0l1tanzNwhytherecanbeonlyfivepointswhereontheinterval0<z<9.Theobjectivethetwographsintersect.Whatcausesofthisproblemistoestimatethepointsthetwo“extraneous”points?wherethegraphsofthesefunctionsin-tersect.c)Estimatethecoordinatesofeachofthefiveintersectionpoints.7MatrixOperationsLetAandBbemxnmatricesandletsbeascalar.TheMaplecommandformatrixadditionisevalm(A+B)andthecommandforscalarmultiplicationisevalm(s*A).ToaddthescalarstoeachelementofamatrixA,usethecommandevalm(A+s).IfAismxnandBisnxp,thematrixproductABisobtainedwiththecommandevalm(A&*B).Asseenpreviously,ifbisann-dimensionalcolumnvector,thecommandlinsolve(A,b)returnsthesetofallsolutionstoAx=b.Toprepareatableoffunctionvaluesfor2+3z+1)coszsoy=EETems+sinzforz=1.0,1.2,1.4,...,29.8,30.0,usetheMaplecommands:>f=x=>(x"2+3*x+1)*cos(x)/(2+sin(x));2,fiz(z+3z+1)cos(z)2+sin(z)>X:=[1.41/56$i=10..145]:>Y:=map(f,X):>hdr:=[[x,fx1,[--==—,--—-—-11:>pts:=zip((x,y)->[x,y]1,X,¥Y):>stackmatrix(hdr,pts):Theoutputofthisstackmatrixcommandisa148x2matrix.Intheinterestofconservingspace,thisoutputhasbeensuppressed.The146datapointscanbeplottedwiththecommand:StudyXY
Page 11 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 11 preview imageTRANSPOSE,NORM,ANDINVERSE9>plot(ptsJ;400A200noooiiFan[HYio{ooofMus|obasia°=JnTTVoREAOBVou—200VdVolVl|iY)Vol—a00byExercisesfor§73.Createatableofvaluesofthefunction1.UseMapletoworkExercises31-41info)=tan(1+2?)Section1.5.x)=(1+z3)itz2.UseMaple’slinsolvecommandtosolveatthepointsz=2.0,2.1,...,5.0.thesysteminExercise27inSection1.1.8Transpose,Norm,andInverseTodefineB=A",typeB:=evalm(transpose(A));.Maple’snormcommandcomputesthenormofamatrixorvector.ToobtaintheEuclideannormofavector,besuretoinclude2asthesecondargument,e.g.,norm(x,2).Tofindtheinverseofasquarematrix4,usetheMaplecommandinverse(A).TheinverseiscalculatedusingGaussian-JordaneliminationwhenAislargerthan4x4;forsmallermatrices,determinantsandCramer’sruleareused.IfanyentryofAisafloating-pointnumber,thenMaplecomputesA!asafloating-pointmatrix.Inallothercases,e.g.,allentriesofAareintegersorrationalnumbers,MaplewillcomputeanexactrepresentationforA1.IfAissingular,ornumericallysingular,Maplewillreportthiswithanerrormessage.StudyXY
Page 12 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 12 preview image10MAPLETECHNOLOGYRESOURCEMANUALExercisesfor§8a)ExecutetheMaplecommandsinverse(A);1.UseMapletofindtheinverseofthema-andinverse(evalf(evalm(A))):.NotethatA©.inbothcasesMaplereportsthatthema-trixinExercise20ofSection1.9.ewtrixissingular.2.UseMapletofindtheinverseofthema-.trixinExercise27ofSection1.9.b)Repeata)forthematrix5.3.ToillustrateMaple’shandlingofsingu-©)Repeata)forthematrixCfori=—1,y.—2,...,—20.(Hint:UsetheMaplecom-larmatricesandthedifferencesbetweenmandinverse(eval(evalm(C),i=-1)):.)exactandfloating-pointarithmetic,con-Bensiderthematricesd)Repeat«c¢)whentheentriesof3694Carefloating-pointnumbers.A=19,B=12]s(Hint:UsetheMaplecommandinverse(evalf(eval(evalm(C),i=-1)));.)c=12+10°e)Explainthedifferentresultsinpartsc)12:andd).f)(Optional.)ComparetheseresultswiththoseobtainedwithMATLAB.9SpecialMatricesTodefinethezeromatrix,usetheMaplecommandmatrix(m,n,0)wheremandnarethenumberofrowsandcolumns,respectively,inA.Likewise,matrix(2,3,1)createsa2x3matrixinwhicheveryentryis1.Moregenerally,B:=matrix(m,n,f);createsanmxnmatrixBwithentriesbij=f(i,7).Toillustrate,the3x3matrixinwhichtheentriesalternatebetween1and0,startingwith1,canbecreatedwiththecommandB:=matrix(3,3,(i,j)->i+j+1mod2);.The5x5identitymatrixisobtainedwithmatrix(5,5,(i,j)—>ifi=jthen1else0endif).ArandommxnmatrixcanbecreatedwiththeMaplecommandrandmatrix(m,n).Bydefault,theentriesinthismatrixrangefrom-99to99,thatisatwo-digitinteger.Tolimitthevaluestointegersbetweenaandb,inclusive,addathirdargument:randmatrix(m,n,entries=rand(a..b)).Randommatricesarefrequentlyusedtotestaconjectureorsimulateaseriesofrandomevents,suchastrafficflowinastreetnetwork.Exercisesfor§9b)Usethegaussjordcommandtosolveeach1.Createa4x5matrixconsistingentirelyofthe10systems.ofsevens.c)Usingpencilandpaper(orlinsolve),5writeeachsolutioninstandardform.:Whatcanyouconcludeifm<n?(Hint:a)UsetherandmatrixcommandtogenerateSeeTheorem4,Section1.3.)10differenthomogeneousmxnsystemswithintegerentriesbetween-20and20.Makesureatleast6ofthematricesm<n.StudyXY
Page 13 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 13 preview imageWORKINGWITHDATAINMAPLE1110WorkingwithDatainMapleMaplehasanumberoftoolsforworkingwithlistsofdata.The(minimal)interpolatingpolynomialforacollectionofdatapointscanbefoundwiththeinterpcommand.Also,thestatspackagecontainsacommand,fit,thatcandeterminethebestleast-squaresfitofdatatoagivenfamilyoffunctions.Toillustratetheuseofthesecommands,considerthetableofdatapoints:z|123456y|41217334552Thelistsofzandyvaluesare:>xi:=[8$1..61];21:=[1,2,3,4,5,6|>yi:=[4,12,17,33,45,521;ul=[4,12,17,33,45,52)Thecorrespondingdatapointsare:>pts:=zip((x,y)->[x,y],x1,yi);pts=[[1,4],[2,12],[3,17],[4,33],[5,45},[6,52]]Forfuturereference,constructaplotofthedatapoints:>pt_plot:=pointplot(pts):Thebestleast-squareslinearfittothedatais:>1s_fit:=fit[leastsquare[[x,y],y=a*x+b,{a,b}11([x1,y1]);7125Is_fity=roThefollowinggraphprovidesavisualconfirmationofthisresult:>1s_plot:=plot(rhs(ls_fit),x=0..7):>display([pt_plot,1ls_plot]);so~~Pp=ABSEPBEaoaThebestleast-squaresquinticfittothese6datapointsisthepolynomialinterpolator:>fit[leastsquarel[x,y],y=a*x"5+b*x~4+c*x"3+d*x"2+exx+f,{a,b,c,d,e,f}1]>C[x1,y1]J;43,79,359,1661,5903¥=1557prtgEToz="30z—93StudyXY
Page 14 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 14 preview image12MAPLETECHNOLOGYRESOURCEMANUALbutitissimplertoobtainthisinterpolatingpolynomialdirectlyfromthedatapoints:>interp_poly:=interp(x1,yi,xJ);437935916615903interp_poly=52pd4227132interp_poly150°Bot3x5430z93Thebestlinearfitandinterpolatingpolynomialareeasilycomparedinagraph:>ip_plot:=plot(interp_poly,x=0..7,color=GREEN):>display([pt_plot,ls_plot,ip_plot]);100°esNotethatthedataconsistsofintegersandthecoefficientscomputedforthebestleast-squareslinearfitandinterpolatingpolynomialarerational;nofloating-pointapproximationshavebeenem-ployed.Toseefloating-pointapproximationstothesepolynomials,changeoneormoredatavaluetoafloating-pointnumberoruseevalf(interp_poly);.Exercisesfor§10c)Plotthedatapoints,bestleast-squares1.Considerthefollowingtableofdatafit,andinterpolatoronthesamegraph.2.Repeat1.withthetableofdataz|12345y[33526790108z|{-3-2-10123a)Findthebestleast-squaresfittothey{337.810512.2109823.1data.b)Findthepolynomialinterpolatorforthedata.11ProceduresTheMapleworksheetprovidesaconvenientenvironmentfordevelopingandarchivingsequencesofMaplecommandsthatwillbeexecutedmanytimes.ItisalsopossibletoreadMaplecommandsfromatextfile;see7readforacompleteexplanation.Tofurtherfacilitatetheimplementationofnewalgorithms,blocksofMaplecommandscanbegroupedtogethertodefineaprocedure.(AninterestingfactaboutMapleisthatthevastmajorityoftheMaplecommandsarewritteninMapleasprocedures.)Forexample,supposeitisnecessarytocomparebestleast-squarespolynomialfitstoagivensetofdatapointsforpolynomialsofdifferentdegrees.Thefollowingprocedure,namedIsplot,[+s
Page 15 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 15 preview imagePROCEDURES13threeargumentsthelistof«values,thelistofyvalues,andthedegreeofthepolynomialtobeusedintheleast-squaresfitandreturnsaplotofthedatapointsandthebestleast-squrarepolynomialoftherequesteddegree:>1splot:=proc(X,Y,n)>locala,ls_plot,p,pts,pt_plot,x,y;>global1ls_fit;>p:=add(alli*xx™i,i=0..n);>ai={coeffs(p,x)};>1s_fit:=fit[leastsquarel[[x,y],y=p,a11([X,Y]);>pts:=zip((x,y)->[x,y],X,Y);>pt_plot:=pointplot(pts,color=RED);>1s_plot:=plot(rhs(Is_fit),x=min(op(X))-1..max(op(X))+1,>color=GREEN);>returndisplay([pt_plot,1ls_plot]);>endproc:Thisprocedurecloselyfollowstheapproachpresentedintheprevioussection.ThefirstlinedefinesIsplottobeaMapleprocedureandspecifiesthearguments.Line2,beginninglocal,definesthenamesthataretoremainlocaltothisprocedure;thenextlinedefinesIsfittobeaglobalvariable.Localvariablesdonotassumeanyvalueatthestartoftheprocedureandtheirfinalvaluesarenotaccessibleoncetheprocedureterminates.Conversely,globalvariablesretaintheirvalueaftertheprocedureterminatesandcanbeaccessedfromelsewhereintheMaplesession.(Foradditionalinformationonlocalandglobalvariablessee?procedure;see?parameterforparameterpassinginMapleprocedures.)Thenexttwolinesdefineptobethegeneralpolynomialofdegreenandatobethesetofcoefficientsinp.ThenextfourlinesimplementthealgorithmdiscussedinSection10.Notethatthepolynomialisplottedoveranintervalthatextendsoneunitoneithersideofthesmallestandlargestzvaluewithoutassumingthatthesevaluesaresorted.ThefinalcommandinstructsMapletoreturnthecombinedplotastheresultoftheIsplotcommand.Now,thebestleast-squarescubicfittothedatainSection10canbegraphedviathesinglecommand:>1splot(x1,yi,3);so=/“0,20,se0.5g=ER5s>Becausethebestleast-squaresfitisaglobalvariable,itcanbeaccessedasifithadbeenreturnedbytheprocedure:>1s_fit;_%3355MB,554VCETERTm108AnotherwaytodefineaprocedureistouseMaple’s“arrow”notation(see?->).Thisformispar-ticularlysuitedtotheimplementationofmathematicalfunctionsandcommandsthatareexpressedStudyXY
Page 16 of 16
Solution Manual For Introduction To Linear Algebra, 5th Edition - Page 16 preview image14MAPLETECHNOLOGYRESOURCEMANUALwithouttheneedforlocalvariablesorintermediateresults.Forexample,thescalartripleproductofthevectorsu,v,andw,u-(vxw),canberepresentedas:>sc_triple_prod:=(u,v,w)->dotprod(u,crossprod(v,w));sc_triple_prod:=(u,v,w)dotprod(u,crossprod(v,w))Considerthevectors:>a:=vector([1,2,3]):>b:=vector([2,3,1]):>¢:=vector([1,2,1]):Thescalartripleproductofa,b,andcis>sc_triple_prod(a,b,cJ;2Exercisesfor§112.UsetheprocedureIsplotwithavalueofn-3)i1.WriteaMapleprocedurethatcalculates0thatthebestleast-squarespolynomial.approximationofdegreenorlesslooksthevectortripleproductux(vxw).5Testfunctionusingthevectorsreasonableforthedatapoints(z;,y;)=estyourfunctionusing(ini),i=1,2,...,20.(Hint:Thereis19010needtoconsidern>5.)a=|1|,b=|-2],e=]|1],214StudyXY
Preview Mode

This document has 314 pages. Sign in to access the full document!