Bruce F. Torrence-The Student's Introduction to MATHEMATICA ?®- A Handbook for Precalculus, Calculus, and Linear Algebra-Cambridge University Press (2009)

Bruce F. Torrence-The Student's Introduction to MATHEMATICA ?®- A Handbook for...

(Parte 1 de 6)

This page intentionally left blank This page intentionally left blank

The Student’s Introduction to Mathematica®

Second edition

The unique feature of this compact student’s introduction is that it presents concepts in an order that closely follows a standard mathematics curriculum,rather than structured along features of the software. As a result, the book provides a brief introduction to those aspects of the Mathematica® software program most useful to students. The second edition of this well-loved book is completely rewritten for Mathematica® 6, including coverage of the new dynamic interface elements, several hundred exercises, and a new chapter on programming. This book can be used in a variety of courses, from precalculus to linear algebra. Used as a supplementary text it will aid in bridging the gap between the mathematics in the course and Mathematica®. In addition to its course use, this book will serve as an excellent tutorial for those wishing to learn Mathematica® and brush up on their mathematics at the same time.

Bruce F. Torrence and Eve A. Torrence are both ProfessorsintheDepartmentofMathematicsat Randolph-Macon College,Virginia.

The Student’s Introduction to Mathematica®

A Handbook for Precalculus,Calculus, and Linear Algebra

Second edition

Bruce F. Torrence Eve A. Torrence

CAMBRIDGE UNIVERSITY PRESS Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo

Cambridge University Press The Edinburgh Building, Cambridge CB2 8RU, UK

ISBN-13978-0-521-71789-2

First published in print format ISBN-13 978-0-511-51624-5

© B. Torrence and E. Torrence 2009 2009

Information on this title: w.cambridge.org/9780521717892

This publication is in copyright. Subject to statutory exception and to the provision of relevant collective licensing agreements, no reproduction of any part may take place without the written permission of Cambridge University Press.

Cambridge University Press has no responsibility for the persistence or accuracy of urls for external or third-party internet websites referred to in this publication, and does not guarantee that any content on such websites is, or will remain, accurate or appropriate.

Published in the United States of America by Cambridge University Press, New York w.cambridge.org eBook (EBL) paperback

For Alexandra and Robert

Contents

Preface · ix

1Getting Started · 1

Launching Mathematica · The Basic Technique for Using Mathematica · The First Computation · Commands for Basic Arithmetic · Input and Output · The BasicMathInput Palette · Decimal In, Decimal Out · Use Parentheses to Group Terms · Three Well-Known Constants · Typing Commands in Mathematica · Saving Your Work and Quitting Mathematica · Frequently Asked Questions About Mathematica’s Syntax

2Working with Mathematica · 27

Opening Saved Notebooks · Adding Text to Notebooks · Printing · Creating Slide Shows · Creating Web Pages · Converting a Notebook to Another Format · Mathematica’s Kernel · Tips for Working Effectively · Getting Help from Mathematica · Loading Packages · Troubleshooting

3Functions and Their Graphs · 51

Defining a Function · Plotting a Function · Using Mathematica’s Plot Options · Investigating Functions with Manipulate · Producing a Table of Values · Working with Piecewise Defined Functions · Plotting Implicitly Defined Functions · Combining Graphics · Enhancing Your Graphics · Working with Data · Managing Data—An Introduction to Lists · Importing Data · Working with Difference Equations

Factoring and Expanding Polynomials · Finding Roots of Polynomials with Solve and NSolve · Solving Equations and Inequalities with Reduce · Understanding Complex Output · Working with Rational Functions · Working with Other Expressions · Solving General Equations · Solving Difference Equations · Solving Systems of Equations

Computing Limits · Working with Difference Quotients · The Derivative · Visualizing Derivatives · Higher Order Derivatives · Maxima and Minima · Inflection Points · Implicit Differentiation · Differential Equations · Integration · Definite and Improper Integrals · Numerical Integration · Surfaces of Revolution · Sequences and Series

Vectors · Real-Valued Functions of Two or More Variables · Parametric Curves and Surfaces · Other Coordinate Systems · Vector Fields · Line Integrals and Surface Integrals

7Linear Algebra · 335

Matrices · Performing Gaussian Elimination · Matrix Operations · Minors and Cofactors · Working with Large Matrices · Solving Systems of Linear Equations · Vector Spaces · Eigenvalues and Eigenvectors · Visualizing Linear Transformations

Introduction · FullForm: What the Kernel Sees · Numbers · Map and Function · Control Structures and Looping · Scoping Constructs: With and Module · Iterations: Nest and Fold · Patterns

Solutions to Exercises · w.TUVEFOUTNBUIFNBUJDB DPN viiiThe Student’s Introduction to Mathematica

Preface

The mathematician and juggler Ronald L. Graham has likened the mastery of computer programming to the mastery of juggling. The problem with juggling is that the balls go exactly where you throw them. And the problem with computers is that they do exactly what you tell them.

This is a book about Mathematica, a software system described as “the world’s most powerful global computing environment.” As software programs go, Mathematica is big—really big. We said that back in 1999 in the preface to the first edition of this book. And it’s gotten a good deal bigger since then. There are more than 900 new documented symbols in version 6 of Mathematica. It’s been said that there are more new commands in version 6 than there were commands in version 1. It’s gotten so big that the documentation is no longer produced in printed form. Our trees and our backs are grateful. Yes, Mathematica will do exactly what you ask it to do, and it has the potential to amaze and delight—but you have to know how to ask, and that can be a formidable task.

That’s where this book comes in. It is intended as a supplementary text for high school and college students. As such, it introduces commands and procedures in an order that roughly coincides with the usual mathematics curriculum. The idea is to provide a coherent introduction to Mathematica that does not get ahead of itself mathematically. Most of the available reference materials make the assumption that the reader is thoroughly familiar with the mathematical concepts underlying each Mathematica command and procedure. This book does not. It presents Mathematica as a means not only of solving mathematical problems, but of exploring and clarifying the concepts themselves. It also provides examples of procedures that students will need to master, showing not just individual commands, but sequences of commands that together accomplish a larger goal.

While written primarily for students, the first edition was well-received by many non-students who just wanted to learn Mathematica. By following the standard mathematics curriculum, we were told, the presentation exudes a certain familiarity and coherence. What better way to learn a computer program than to rediscover the beautiful ideas from your foundational mathematics courses?

What’s New in this Edition?

The impetus for a second edition was driven by the software itself. The first edition coincided with the release of Mathematica 4. While version 5 introduced a few notable new commands, much of the innovations in that release were kept under the hood, so to speak. The algorithms associated with many well-used commands were improved, but the user interface underwent minimal changes. Mathematica 6 on the other hand is a different beast entirely. Perhaps the most fundamental innova- tion is the introduction of dynamic user interface elements with commands such as Manipulate. It is now possible to take essentially any Mathematica expression and add sliders or buttons that permit a user to adjust parameters in real time. The second edition was re-written from the ground up to take these and other changes into account. Virtually every section of every chapter has undergone extensive revision and expansion. This edition reflects the software as it exists today.

The organization of the book has not changed, but there are two notable new additions:

The second edition has exercises, several hundred in fact. These provide a means for experimenting with and extending the ideas outlined in each section. They also provide a concrete and structured framework for interacting with the software. It is through such interactions that familiarity and (ultimately) competence and even mastery will be attained. Complete solutions are freely available online, as discussed in the next section.

In addition, a new chapter has been added (Chapter 8) to address the fundamental aspects of programming with Mathematica. While this topic is far too expansive to cover thoroughly in a single chapter, many of the fundamentals of programming are conveyed here. It is a fact that many of the new features of version 6 require a working knowledge of pure functions and other ideas that fit naturally into this context. You are likely to find yourself reading a section of this chapter here and there as you explore certain topics in the earlier chapters. Think of it as a handy reference.

How to Use this Book

Of course, this is a printed book and as such is perfectly suitable for bedtime reading. But in most cases you will want to have the book laid open next to you as you work directly with Mathematica. You can mimic the inputs and then try variations. After you get used to the syntax conventions it will be fun.

The first chapter provides a brief tutorial for those unfamiliar with the software. The second delves a bit deeper into the fundamental design principles and can be used as a reference for the rest of the book. Chapters 3 and 4 provide information on those Mathematica commands and procedures relevant to the material in a precalculus course. Chapter 5 adds material relevant to single-variable calculus, and Chapter 6 deals with multivariable calculus. Chapter 7 introduces commands and procedures pertinent to the material in a linear algebra course.

¿Some sections of the text carry this warning sign. These sections provide slightly more comprehensive information for the advanced user. They can be skipped by less hardy souls.

Beginning in Chapter 3, each section has exercises. Solutions to every exercise can be freely downloaded from the website at w.TUVEFOUTNBUIFNBUJDB DPN.

Mathematica runs on every major operating system, from Macs and PCs to Linux workstations. For the most part it works exactly the same on every platform. There are, however, a few procedures (such as certain keyboard shortcuts) that are platform specific. In such cases we have provided specific information for both the Mac OS and Microsoft Windows platforms. If you find yourself running Mathematica on some other platform you can be assured that the procedure you need is virtually identical to one of these.

xThe Student’s Introduction to Mathematica

Acknowledgments

Time flies. When we wrote the first edition of this book Robert and Alexandra were toddlers who would do anything to get our attention and wanted to sit on our laps while we worked. Now they are teenagers who just want our laptops. Like Mathematica our kids have grown up. They have become our best friends and terrific travel buddies. This project has again disrupted their lives and we thank them for their attempts at patience. To quote Robert, “You guys aren’t going to write any more books, are you?” Don’t worry kids, at this rate you’l both be in colege.

Special thanks go out to Paul Wellin at Wolfram Research, who handled the page design and who dealt tirelessly with countless other issues, both editorial and technical. We would like to thank Randolph-Macon College and the Walter Williams Craigie Endowment for the support we received throughout this project. And we thank Peter Thompson, our editor at Cambridge, for his professional acumen and ongoing encouragement and support.

Preface xi

1 Getting Started

1.1 Launching Mathematica

The first task you will face is finding where Mathematica resides in your computer’s file system. If this is the first time you are using a computer in a classroom or lab, by all means ask your instructor for help. You are looking for “Spikey,” an icon that looks something like this:

When you have located the icon, double click it with your mouse. In a moment an empty window will appear. This is your Mathematica notebook; it is the environment where you will carry out your work.

The remainder of this chapter is a quick tutorial that will enable you to get accustomed to the syntax and conventions of Mathematica, and demonstrate some of its many features.

1.2 The Basic Technique for Using Mathematica

A Mathematica notebook is an interactive environment. You type a command (such as 2 2) and instruct Mathematica to execute it. Mathematica responds with the answer on the next line. You then type another command, and so on. Each command you type will appear on the screen in a boldface font. Mathematica’s output will appear in a plain font.

Entering Input After typing a command, you enter it as follows:

ÊOn a machine running Windows: Hit the combination Ú¹Ö, or hit the Ö key on the numeric keypad if you have one (usually in the lower right portion of the keyboard).

ÊOn a Mac: Hit the Ö key (usually in the lower right portion of the keyboard), or hit the combination Ú¹Ê.

1.3 The First Computation For your first computation, type then hit the Ú¹Ö combination (Windows) or the Ö key (Mac OS). There may be a brief pause while your first entry is processed. During this pause the notebook’s title bar will contain the text “Running...”

The reason that this simple task takes a moment is that Mathematica doesn’t start its engine, so to speak, until the first computation is entered. In fact, entering the first computation causes your computer to launch a second program called the MathKernel (or kernel for short). Mathematica really consists of these two programs, the Front End, where you type your commands and where output, graphics, and text are displayed, and the MathKernel, where calculations are executed. Every subsequent computation will be faster, for the kernel is now already up and running.

Mathematica works much like a calculatorforbasicarithmetic.Justusethe+,–, *, and / keys on the keyboard for addition, subtraction, multiplication, and division. As an alternative to typing *, you can multiply two numbers by leaving a space between them (the × symbol will automatically be inserted when you leave a space between two numbers). You can raise a number to a power using the key. Use the dot (i.e., the period) to type a decimal point. Here are a few examples:

2Getting Started

Out[7]= 17

This last line may seem strange at first. What you are witnessing is Mathematica’s propensity for providing exact answers. Mathematica treats decimal numbers as approximations, and will generally avoid them in the output if they are not present in the input. When Mathematica returns an expression with no decimals, you are assured that the answer is exact. Fractions are displayed in lowest terms.

(Parte 1 de 6)

Comentários