ebook img

Understanding Maple PDF

233 Pages·2017·1.597 MB·english
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Understanding Maple

UNDERSTANDING MAPLE IAN THOMPSON UniversityofLiverpool UniversityPrintingHouse,CambridgeCB28BS,UnitedKingdom OneLibertyPlaza,20thFloor,NewYork,NY10006,USA 477WilliamstownRoad,PortMelbourne,VIC3207,Australia 4843/24,2ndFloor,AnsariRoad,Daryaganj,Delhi-110002,India 79AnsonRoad,#06-04/06,Singapore079906 CambridgeUniversityPressispartoftheUniversityofCambridge. www.cambridge.org Informationonthistitle:www.cambridge.org/9781316628140 10.1017/9781316809761 ©IanThompson2017 Firstpublished2017 PrintedintheUnitedKingdombyClays,StIvesplc,November2016 ISBN978-1-316-62814-0Paperback Additionalresourcesforthispublicationatwww.cambridge.org/maple Contents Acknowledgements pageviii 1 Introduction 1 1.1 WhyThisBook? 2 1.2 TheMapleInterface 3 1.3 HowtoReadThisBook 4 2 GettingStarted 6 2.1 ConfiguringtheInterface 6 2.2 TheHelpSystem 9 2.3 StatementsandExecution 10 2.4 Spaces,LineBreaksandComments 16 2.5 ExecutionGroups 18 2.6 Sections 19 2.7 DisplayedResultsandReturnValues 19 2.8 ObtainingApproximateResults 21 2.9 ElementaryFunctions 24 2.10 ComplexNumbers 27 2.11 Variables 31 2.12 Names 34 2.13 AutomaticSimplificationandEvaluation 37 2.14 Concatenation 42 2.15 RelationalOperators 44 2.16 Sequences 48 2.17 SetsandLists 49 2.18 Indices 53 2.19 Element-wiseOperations 56 2.20 Theseq,addandmulCommands 58 2.21 Types 62 2.22 Packages 65 3 AlgebraandCalculus 71 3.1 ManipulatingExpressions 71 3.2 ExtractingPartsofanExpression 76 3.3 Substitutions 79 3.4 Functions 81 3.5 Limits 87 3.6 SummingSeries 89 3.7 Differentiation 92 3.8 Integration 94 3.9 SeriesExpansions 97 3.10 Assumptions 99 4 SolvingEquations 103 4.1 SolvingSingleEquations 103 4.2 SolvingMultipleEquations 107 4.3 SolvingApproximately 109 4.4 DifferentialEquations 113 5 LinearAlgebra 117 5.1 CreatingMatricesandVectors 117 5.2 AccessingVectorandMatrixEntries 120 5.3 DisplayingMatricesandVectors 122 5.4 Addition,MultiplicationandScalarProducts 123 5.5 VectorProductsandNorms 125 5.6 OtherMatrixOperations 127 5.7 SolvingLinearSystems 129 5.8 CopyingMatricesandVectorsandTestingfor Equality 129 6 Graphics 133 6.1 CreatingBasicPlots 133 6.2 CustomisingaPlot 135 6.3 ParametricandPolarPlots 137 6.4 Three-DimensionalPlots 138 6.5 CombiningPlots 140 6.6 PlotsfromData 141 6.7 Animations 144 7 Programming 147 7.1 ConditionalStatements 147 7.2 DoLoops 150 7.3 Nestingandprintlevel 158 7.4 TheprintandprintfCommands 159 7.5 Arrays 162 7.6 Tables 168 8 Procedures 174 8.1 ABasicProcedure 174 8.2 TheStructureofaProcedure 176 8.3 LocalandGlobalVariables 178 8.4 ArgumentsandParameters 183 8.5 CheckingArgumentValidity 189 8.6 DataReturnedbyProcedures 191 8.7 ReturningUnevaluated 192 8.8 OutputDisplayedfromWithinProcedures 195 8.9 RememberTablesandRecursion 195 8.10 ViewingaProcedureDefinition 197 9 ExamplePrograms 200 9.1 Pascal’sTriangle 200 9.2 TheCollatzProblem 203 9.3 ANewton–RaphsonIteration 205 9.4 SortingData 208 9.5 QuadratureFormulae 211 9.6 Necklaces 215 AppendixA OtherWaystoRunMaple 219 AppendixB TerminatingCharacters 223 IndexofMapleNotation 225 1 Introduction Hewouldkeepontryingtodothisorthatwithagrimpersistencethat waspainfultowatch... JohnWyndham,‘TheDayoftheTriffids’1 Mapleisacomputerprogramcapableofperformingawidevarietyof mathematicaloperations.Itoriginatedintheearly1980sasacomputer algebra system, but today this description doesn’t really do it justice. Maplehasfacilitiesforalgebra,calculus,linearalgebra,graphics(two- and three-dimensional plots, and animations), numerical calculations toarbitraryprecision,andmanyotherthingsbesides.Itiswidelyused in universities across the world, and is particularly useful for tasks that are tedious and error-prone when performed by humans, such as manipulating complicated series expansions and solving large sets of simultaneousequations.Usedcorrectly,Maplecansavetimeandquickly solveproblemsthatwouldotherwisebeintractable.Usedincorrectly,it canleadtofrustration,andthedestructionofexpensiveITequipment. Atthetimeofwriting,thecurrentversionisMaple2016.Versions before Maple 2015 were numbered starting from 1; the last of these wasMaple18.NewfeaturesintroducedineachversionfromMaple4.0 onwardscanbeviewedusingthehelpsystem(seeSection2.2).Forthe mostpart,recentchangeshavebeenrelativelyminor,atleastasfaras thematerialinthisbookisconcerned.Consequently,alloftheexamples workwithbothMaple2015andMaple2016.Infact,mostwillwork in older versions as well, though naturally the number of exceptions increasesthefurtherbackonegoes.Twosubstantialnewfeaturesare the dataplot command, discussed in Section 6.6, and the new rules concerningterminatingcharacters,describedinAppendixB(seealso Section2.3).BothofthesewereintroducedinMaple2015. 1 PenguinBooks,1954.ReprintedbypermissionofPollingerLimited (www.pollingerltd.com)onbehalfoftheEstateofJohnWyndham. 1 2 Introduction 1.1 WhyThisBook? Thisbookisintendedforstudents,teachersandresearcherswhowill ultimatelywishtouseMapleforadvancedapplications.Here,‘advanced’ meanssomethingmorecomplexthanevaluatingasingleintegral,but not necessarily designing and running a simulation of the latest jet engine.Thebookissuitableforundergraduatesandpostgraduatestaking a course in which Maple is used, and for researchers who intend to use Maple for part of their work. It can also serve as a consolidation guideforuserswhoalreadyhavesomeknowledgeofMaple,butfind themselvesunabletodecipherandeliminatecertainerrormessages,or who currently rely on apparently magic recipes for solving problems, basedoncommandsoroperationswhosemeaningisnotclear.There isnorelianceonmagicrecipeshere.Everyfeatureweuseisproperly explained,withreferencestotheonlinedocumentationwhereappropriate. Thebookisnotacomprehensivereferenceguide(alreadyavailablevia the help system; see Section 2.2), nor is it a beginner’s guide in the normalsense.Itmostcertainlyisnota‘guidefordummies’.Westartfrom thebeginning,assumingnopriorknowledgeofthesubjectwhatsoever, butwhereadvancedtopicsarecentraltounderstandingMapletheyare tackledhead-on,evenasearlyasChapter2.Inparticular,theevaluation rules are a regular feature throughout. These determine the order in whichinputisprocessedbyMaple.Inmostcircumstancestheyarefairly simple(Section8.4discussessomemorecomplexsituations),butthey areabsolutelycrucial. Usingthisbook,itispossibletotacklemanycomplexproblemswithout anyadditionalMapledocumentation.Readerscanquicklyprogressto usingpackagesandcommandsthathavenotbeendiscussed,becausethe principlesintroducedapplyacrossthewholesystem.Wherethebook aloneisnotsufficient,thosewhohavereaditwillfindthemselvesable tofullyunderstandMaple’shelppages,whichcanberathertechnical, andtheMapleProgrammingGuide(seeSection2.2),whichissquarely aimedatveryadvancedusers. 14:32:47, subject to the Cambridge Core terms .001 1.2 TheMapleInterface 3 1.2 TheMapleInterface UsersmayinteractwithMapleinseveraldifferentways.Onemayproceed bytypingcommands,byusinginterfacedrivenmethodsbasedonpalettes andcontextmenus,orbyacombinationofthetwo.Theadvantagesand disadvantagesofaparticularmethodarenotalwaysobvious,thoughthey maybehugelysignificant. Interfacedrivenmethodscanbeverytemptingtonewusers,because theymayappeartoeliminatetheneedtostudyamanual.Forexample, withthefactorysettingforinput(2-DMath;seeSection2.1)itdoesn’ttake muchefforttoworkouthowtosumseriesandevaluateintegrals,using theCalculusandExpressionpalettesatthesidesofthescreen(iftheseare notvisible,theycanberevealedbychoosing Palettes (cid:2) Expand Docks fromthe View menu).However,mostuserswilleventuallywanttotry somethingalittlemorecomplicated,inwhichcasethingsarenotquiteso straightforward.Forallitspower,Mapleisonlyacomputerprogram,and assuchitcanonlyunderstandmathematicalinputthatisstructuredinthe correctway.Justasitispossibletotypeincorrectcommands,itisalso possibletousethepalettesincorrectly,andconstructsomethingthata humanmathematicianmightunderstand,butMapledoesnot.Onewayor another,technicalissueswillsometimesarise,andasolidunderstanding ofMapleisneededtodealwiththeseeffectively.Inviewofthis,interface drivenmethodsdon’tsavemuchtime,unlessthesoftwareistobeused exclusivelyforsolvingelementaryproblems.Therewillbenofurther discussionofsuchmethodshere(searchfortheUserManualinthehelp systemformoreinformationonthesubject). This book takes a command driven, or programmatic, approach to Maple, with the focus on the language rather than the interface. This hastwoprincipaladvantages.First,itscalesupveryeasily:thesimple building blocks that make up the Maple language can be assembled to solve complex problems in an efficient way. This is where the real powerofMaplelies.Second,thereistransparency:aMapleworksheet constructed using a sequence of mouse clicks and menu selections is opaqueinthatauseropeningitcannotseeimmediately(ifatall)howit wascreated,orhowitcouldbemodifiedandadaptedtohis/herneeds. 14:32:47, subject to the Cambridge Core terms .001 4 Introduction On the other hand, a worksheet composed from typed commands is 100% transparent. It may be that some users who master the Maple languagelaterdecidethatmoreinterfacedrivenmethodsaresuitablefor someoralloftheirwork.However,suchuserswillcontinuetofindthis bookvaluable,becauseunderstandingtheMaplelanguagemakesthe behaviourofitsinterfacefarmoretractable. 1.3 HowtoReadThisBook Thetechnicalmaterialinthisbookisintendedtobereadinorderand initsentirety.Greatefforthasbeenexpendedtokeepthecontentshort, while still covering all of the key points. Time has also been spent minimisingthenumberofsituationsinwhichconceptsareusedbefore theyareproperlyintroduced.Inafewplaces,thesestructuralaberrations turn out to be unavoidable (or the lesser of two evils). Where this is the case, the simplest possible examples have been used to illustrate theissueathand,andareferencetoalatersection,inwhichtheoutof placeconceptisdealtwithindetail,isalwaysgiven.Attheveryleast, everyreadershouldstudyChapter2.Mostofthisisverybasic,butmany fundamentalaspectsofMaplearedescribedhere,andwithoutknowledge of these its behaviour can seem mysterious at best, and infuriating at worst.Chapters3–6dependheavilyonChapter2,butlesssouponeach other.ThemajorityofuserswillneedthematerialinChapters3and4, whichintroduceMaple’ssymboliccomputationfacilities.Chapters7–9 reallyneedtobereadinsequence.Withouttheideastheycontain,solving someproblemswillnecessitatetedious,repetitivework,suchasentering largenumbersofverysimilarcommands,whichisnotanefficientway touseMaple. Throughoutthebook,itemsthatappearinmenusordialogueboxes are shown in a rounded box with a grey background, such as Help . Keystrokes such as return have a sharp-cornered box with a white background. Icons for toolbar buttons are shown as they appear in Maple2016;theMaple2015versionisalsoshownordescribedifitis significantlydifferent.Smallblocksoftextmarkedwiththesymbol(cid:3)are tips.Theseareuseful(oftenveryuseful)butnotvitalpiecesofinformation 14:32:47, subject to the Cambridge Core terms .001 1.3 HowtoReadThisBook 5 oradvice.Insomecasesitispossibletodeducethemfromotherpartsof thebook.Inputandoutputisshowninthesamestyleinwhichitappearsin Mapleitself(providedtheconfigurationprocessexplainedinSection2.1 isfollowed).Inparticular,Maplecommandsandstatementsareshownin atypewriter typeface.Inafewplaces,Maplestatements,orparts thereof,havebeenomittedinordertoillustratealargerormoregeneral structure.Textinitalicsisusedtogiveanindicationastowhatismissing. Outputisomittedifshowingitrequiresaninordinateamountofspace. ThisconventionisusedextensivelyinChapter6,whereplotsdrawnby Maplearenotshown. Togetthemostoutoftheexamplesthroughoutthebook,itisnecessary to execute them in Maple, and to experiment by modifying them. To save time for readers, the relevant files have been made available for download.2Typingtheexamplesmanuallyisfine,butitmaybenecessary toinsertadditionalrestartcommands(seeSection2.11)betweensome of them to prevent unintended interactions, especially if the ordering ischanged.Theonlineworksheetsalreadycontainsufficientrestart commandstoensurethateverythingworksexactlyasshown.Copying andpastingfromanelectronicversionofthebookmayleadtounexpected results,andisthereforenotrecommended. [email protected]. 2 pcwww.liv.ac.uk/∼itho17/understanding_maple 14:32:47, subject to the Cambridge Core terms .001

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.