ebook img

Computing with Mathematica PDF

332 Pages·2003·1.796 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 Computing with Mathematica

Computing with Mathematica ® Second Edition LIMITEDWARRANTYANDDISCLAIMEROFLIABILITY ACADEMICPRESS("AP")ANDANYONEELSEWHOHASBEENINVOLVEDINTHECREATIONOR PRODUCTIONOFTHEACCOMPANYINGCODE("THEPRODUCT")CANNOTANDDONOTWARRANTTHE PERFORMANCEORRESULTSTHATMAYBEOBTAINEDBYUSINGTHEPRODUCT.THEPRODUCTISSOLD "ASIS"WITHOUTWARRANTYOFANYKIND(EXCEPTASHEREAFTERDESCRIBED),EITHEREXPRESSEDOR IMPLIED,INCLUDING,BUTNOTLIMITEDTO,ANYWARRANTYOFPERFORMANCEORANYIMPLIED WARRANTYOFMERCHANTABILITYORFITNESSFORANYPARTICULARPURPOSE.APWARRANTSONLY THATTHEMAGNETICDISKETTE(S)ONWHICHTHECODEISRECORDEDISFREEFROMDEFECTSIN MATERIALANDFAULTYWORKMANSHIPUNDERTHENORMALUSEANDSERVICEFORAPERIODOF NINETY(90)DAYSFROMTHEDATETHEPRODUCTISDELIVERED.THEPURCHASER’SSOLEAND EXCLUSIVEREMEDYINTHEEVENTOFADEFECTISEXPRESSLYLIMITEDTOEITHERREPLACEMENTOF THEDISKETTE(S)ORREFUNDOFTHEPURCHASEPRICE,ATAP’SSOLEDISCRETION. INNOEVENT,WHETHERASARESULTOFBREACHOFCONTRACT,WARRANTYORTORT(INCLUDING NEGLIGENCE),WILLAPORANYONEWHOHASBEENINVOLVEDINTHECREATIONORPRODUCTIONOF THEPRODUCTBELIABLETOPURCHASERFORANYDAMAGES,INCLUDINGANYLOSTPROFITS,LOST SAVINGSOROTHERINCIDENTALORCONSEQUENTIALDAMAGESARISINGOUTOFTHEUSEOR INABILITYTOUSETHEPRODUCTORANYMODIFICATIONSTHEREOF,ORDUETOTHECONTENTSOFTHE CODE,EVENIFAPHASBEENADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGES,ORFORANYCLAIMBY ANYOTHERPARTY. Anyrequestforreplacementofadefectivediskettemustbepostageprepaidandmustbeaccompaniedbytheoriginal defectivediskette,yourmailingaddressandtelephonenumber,andproofofdateofpurchaseandpurchaseprice. Sendsuchrequests,statingthenatureoftheproblem,toAcademicPressCustomerService,6277SeaHarborDrive, Orlando,FL32887,1-800-321-5068.APshallhavenoobligationtorefundthepurchasepriceortoreplaceadiskette basedonclaimsofdefectsinthenatureoroperationoftheproduct. Somestatesdonotallowlimitationonhowlonganimpliedwarrantylasts,norexclusionsorlimitationsofincidental orconsequentialdamage,sotheabovelimitationsandexclusionsmaynotapplytoyou.ThisWarrantygivesyou specificlegalrights,andyoumayalsohaveotherrightswhichvaryfromjurisdictiontojurisdiction. THERE-EXPORTOFUNITEDSTATESORIGINSOFTWAREISSUBJECTTOTHEUNITEDSTATESLAWSUNDER THEEXPORTADMINISTRATIONACTOF1969ASAMENDED.ANYFURTHERSALEOFTHEPRODUCTSHALL BEINCOMPLIANCEWITHTHEUNITEDSTATESDEPARTMENTOFCOMMERCEADMINISTRATION REGULATIONS.COMPLIANCEWITHSUCHREGULATIONSISYOURRESPONSIBILITYANDNOTTHE RESPONSIBILITYOFAP. Computing with Mathematica ® Second Edition Hartmut F. W. Höft Eastern Michigan University Ypsilanti, MI Margret Höft University of Michigan-Dearborn Dearborn, MI Amsterdam Boston London NewYork Oxford Paris SanDiego SanFrancisco Singapore Sydney Tokyo SponsoringEditor BarbaraHolland ProductionEditor AngelaDooley EditorialAssistant TomSinger MarketingManager AnneO’Mara CoverDesign DickHannus Copyeditor AdrienneRebello Composition CEPHA Printer EdwardsBros. Thisbookisprintedonacid-freepaper. Copyright2003,1998,ElsevierScience(USA) Allrightsreserved. Nopartofthispublicationmaybereproducedortransmittedinanyformorbyany means,electronicormechanical,includingphotocopy,recording,oranyinformation storageandretrievalsystem,withoutpermissioninwritingfromthepublisher. Requestsforpermissiontomakecopiesofanypartoftheworkshouldbemailedto: PermissionsDepartment,Harcourt,Inc.,6277SeaHarborDrive,Orlando,Florida32887-6777. MathematicaisaregisteredtrademarkofWolframResearch,Inc. AcademicPress AnimprintofElsevierScience 525BStreet,Suite1900,SanDiego,California92101-4495,USA http://www.academicpress.com AcademicPress AnimprintofElsevierScience 84Theobald’sRoad,LondonWC1X8RR,UK http://www.academicpress.com AcademicPress AnimprintofElsevierSicence 200WheelerRoad,Burlington,Massachusetts01803,USA http://www.academicpressbook.com LibraryofCongressControlNumber:2002107986 InternationalStandardBookNumber:0-12-351666-8 PRINTEDINTHEUNITEDSTATESOFAMERICA 02 03 04 05 06 9 8 7 6 5 4 3 2 1 Contents Preface xiii Part I Learning the Basics 1 Mathematica Basics: An Introduction 3 Introduction 3 Arithmetic 3 MathematicalFunctions 5 SymbolicComputations 6 ExactandApproximateSolutionsforEquations 7 GraphsofFunctionsofOneVariable 9 GraphsofParametricEquations 10 GraphsofSurfacesinThreeDimensions 11 GraphsofContourCurvesforSurfaces 11 MatrixAlgebra 12 RandomNumbers 13 Exercises 14 Mathematica Basics: Help 19 Introduction 19 The?and??Operators 19 TheHelpBrowser 20 InterruptingMathematicaComputations 21 MemoryManagementinMathematica 21 Exercises 22 v vi Contents Mathematica Basics: Notebooks 25 Introduction 25 NotebookToolbars 25 FormatPreferences 25 PageBreakPreferences 26 CellGroupings 26 TagNames 27 Links 28 In/OutNames 28 HyperlinkstoDocumentation 29 Exercises 29 AssociatedNotebookonCD-ROM:CellHierarchy CellHierarchy.nb Mathematica Basics: Text and Typesetting 31 Introduction 31 TheBasicTypesettingandCompleteCharactersPalettes 31 AlgebraicManipulationPalette 33 BasicInputPalette 34 BasicCalculationsPalette 34 Exercises 35 Mathematica Basics: Packages 37 Introduction 37 LoadingStandardPackages 37 ForgettingtoLoadaPackage 39 Exercises 41 Part II Designing Functions 43 Values, Variables, and Assignments 45 Introduction 45 TheImmediateAssignmentOperator=forValues 46 TheDelayedAssignmentOperator:= forFunctions 49 EvaluationIssuesfortheImmediateandDelayed AssignmentOperators 53 Contents vii ComputationalEfficiencyandtheAssignmentOperators 56 Exercises 58 Functions 63 Introduction 63 FunctionswithaSingleArgument 63 FunctionswithSeveralArguments 69 FunctionswithStructuredArguments 71 FunctionswithDefaultValuesforArguments 75 FunctionswithaVaryingNumberofArguments 80 Exercises 81 Recursive Definitions 87 Introduction 87 FunctionswithaSingleRecursiveArgument 87 FunctionswithSeveralRecursiveArguments 92 LimitationstoRecursiveComputations 95 Exercises 99 Substitution Rules and Optional Arguments 107 Introduction 107 SubstitutionRulesandtheReplacementMechanism 107 SubstitutionRulesandInteractiveComputations 110 OptionsforBuilt-inFunctions 111 DefininganOptionforaFunction 114 Exercises 117 Four Spheres Packing Problem 119 Introduction 119 AnalysisoftheProblem 119 ComputationalSolutionoftheProblem 120 GraphicRenderingoftheSolution 121 Exercises 123 AssociatedNotebookonCD-ROM:Two-dimensionalViews oftheSpheres Views2D.nb Cross-sectionalViewofTwoTouchingSpheres VerticalProjectionofThreeTouchingSpheres viii Contents AssociatedFolderonCD-ROM:FourSpheresDrawings Views2D-Drawings.nb EvaluationofViews2D.nb SphereDrawings.nb Evaluationof“GraphicRenderingofSolution” Part III Designing Programs 125 List Processing Functions 127 Introduction 127 ProcessingListswiththeMap[]Function 127 ApplicationsoftheMap[]FunctiontoGraphicsObjects 134 ListManipulation,ElementExtraction,andtheFold[]Function 140 TheFunctionsHead[],Apply[],Outer[],Depth[],andPosition[] 146 Exercises 153 Iterations with Loops 159 Introduction 159 UsingtheDo[]Loop:Basics 159 UsingtheDo[]Loop:AHulaHoopAnimation 163 UsingtheWhile[]Loop:Basics 165 UsingtheWhile[]Loop:TerminationConditionsandthe BisectionMethod 167 UsingtheFor[]Loop:Basics 170 UsingListProcessingFunctionsasAlternativesforLoops 173 TheCollatzFunction 175 Exercises 176 Computations with Modules and Local Variables 181 Introduction 181 UsingtheModule[]Function:Basics 181 UsingtheModule[]Function:ReturningNumbersandLists 184 UsingtheModule[]Function:RenderingGraphicsObjects 188 Exercises 191 Contents ix Part IV Exploring Advanced Features 197 Advanced Mathematica: Options 199 Introduction 199 DefiningaSingleOptionforaFunction 199 DefiningSeveralOptionsforaFunction 204 UsingBuilt-inGraphicsOptionsinUser-DefinedFunctions 208 DefiningOptionsforOneFunctionThatAreOptionsinSeveral OtherFunctions 211 Exercises 216 Advanced Mathematica: Hyperlinks and Buttons 221 Introduction 221 HyperlinkswithinaNotebook 221 JumpswithinaNotebookwithoutHyperlinks 222 HyperlinksbetweenNotebooks 222 HyperlinkstotheHelpBrowser 222 HyperlinkstoInternetResources 223 HyperlinksasButtons 224 CreatingaTypesettingPalette 225 CreatingaPaletteofExpressions 227 CreatingaPaletteofCharactersandExpressions 228 CreatinganEvaluationPalette 229 PrintingaPalette 231 Exercises 231 AssociatedNotebookonCD-ROM:TargetofaHyperlink JumpTarget.nb AssociatedFolderonCD-ROM:SamplePalettes n-CompleteCharacters.nb p-Pi.nbandn-Pi.nb p-Trig.nbandn-Trig.nb p-Logic.nbandn-Logic.nb p-Evaluate.nbandn-Evaluate.nb Advanced Mathematica: Packages 233 Introduction 233 ContextsandNames 233

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.