Mathematica This page intentionally left blank Mathematica Second Edition Eugene Don, Ph.D. Professor of Mathematics Queens College, CUNY Schaum’s Outline Series New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Copyright © 2009, 2000 by The McGraw-Hill Companies, Inc. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. ISBN: 978-0-07-160829-9 MHID: 0-07-160829-X The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-160828-2, MHID: 0-07-160828-1. All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please visit the Contact Us page at www.mhprofessional.com. TERMS OF USE This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCU- RACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMA- TION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRAN- TY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your require- ments or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inac- curacy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise. To my wife, Benay, whose patience and understanding made this book possible. v This page intentionally left blank Preface to the First Edition This book is designed to help students and professionals who use mathematics in their daily routine to learn Mathematica, a computer system designed to perform complex mathematical calculations. My approach is simple: learn by example. Along with easy to read descriptions of the most widely used commands, I have included a collection of over 750 examples and solved problems, each specifically designed to illustrate an important feature of the Mathematica software. I have included those commands and options that are most commonly used in algebra, trigonometry, calculus, differential equations, and linear algebra. Most examples and solved problems are short and to the point. Comments have been included, where appropriate, to clarify what might be confusing to the reader. The reader is encouraged not only to replicate the output shown in the text, but to make modifications and investigate the resulting effect upon the output. I have found this to be the most effective way to learn the syntax and capabilities of this truly unique program. The first three chapters serve as an introduction to the syntax and style of Mathematica. The structure of the remainder of the book is such that the reader need only be concerned with those chapters of interest to him or her. If, on occasion, a command is encountered that has been discussed in a previous chapter, the Index may be used to conveniently locate the command’s description. Without a doubt you will be impressed with Mathematica’s capabilities. It is my sincere hope that you will use the power built into this software to investigate the wonders of mathematics in a way that would have been impossible just a few years ago. I would like to take this opportunity to thank the staff at McGraw-Hill for their help in the preparation of this book and to give a special note of thanks to Mr. Joel Lerner for his encouragement and support of this project. EUGENE DON vii This page intentionally left blank Preface to the Second Edition The recent introduction of Mathematica 6 and Mathematica 7 has brought significant changes to many of the commands that comprise the language. A complete listing of all the changes can be found in the Documentation Center that is included with your program. Most notably: Some of the menus and dialog boxes have changed. These changes are mostly cosmetic and should not cause any confusion. The BasicInput palette has been renamed Basic Math Input. Graphics output was enhanced in version 6. Consequently plots, particularly three-dimensional plots, may look slightly different from those in previous versions. In versions 4 and 5 a semicolon (;) was used merely to suppress an annoying line of output when executing graphics commands. In versions 6 and 7, the semicolon suppresses graphics output com- pletely and must therefore be deleted when using commands such as Plot, Plot3D, Show, etc. Furthermore, since the semicolon may now be used to suppress graphics, DisplayFunction ã Identity and DisplayFunction ã $DisplayFunction are no longer needed. Some of the commands that had previously been supplied in packages (and had to be loaded prior to use) are now included in the kernel and may be used without invoking Needs or . Some of the commands are located in different packages, and some of them are available by download from the Wolfram website. Some of the commands in version 5 have been eliminated and put into “legacy” packages, included with Mathematica 6 and 7. They will have to be loaded prior to using them. Some of the commands (e.g., ImplicitPlot) have been eliminated and their functionality has been incorporated into other commands (e.g., ContourPlot). Animation has been significantly enhanced with the introduction of Animate and Manipulate. A tool has been incorporated into Mathematica that will scan notebooks written using older versions of the software. Any incompatibilities are flagged and suggestions for correcting them are automatically generated. This second edition incorporates all of these changes in the command descriptions, examples, and solved problems. In addition a comprehensive list of commands used in the book, together with their descriptions, is conveniently located in the appendix. The manuscript for this book was proofread several times and all the examples and solved problems have been checked for accuracy. If you should come across a mistake that has not been caught, or would like to share your thoughts about the book, please feel free to send an e-mail to [email protected] I hope you will find this book helpful in navigating through Mathematica. I would like to thank Professor John-Tones Amenyo of York College for his help in highlighting those parts of the text that required modification. EUGENE DON ix