at usc1 - university of south...

119
Maple 8 for Calculus at USC 1 Douglas B. Meade Department of Mathematics University of South Carolina Columbia, SC 29208 Telephone: (803) 777–6183 E-mail: [email protected] Homepage: http://www.math.sc.edu/~meade/ October 14, 2003 1 This document is continually evolving. The latest version of the document is always available on the WWW at http://www.math.sc.edu/~meade/141L-F03/manual/manual.pdf . Comments, criticisms, and suggestions for additional — or the removal of — information are encouraged. 1

Upload: others

Post on 17-Apr-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Maple 8 for Calculus

at USC1

Douglas B. MeadeDepartment of MathematicsUniversity of South Carolina

Columbia, SC 29208

Telephone: (803) 777–6183E-mail: [email protected]

Homepage: http://www.math.sc.edu/~meade/

October 14, 2003

1This document is continually evolving. The latest version of the document is always available on the WWW athttp://www.math.sc.edu/~meade/141L-F03/manual/manual.pdf .

Comments, criticisms, and suggestions for additional — or the removal of — information are encouraged.

1

Page 2: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

ii

Page 3: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Contents

I Using Maple 8 at USC 3

1 Information for Instructors 51.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 Computer Labs for Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Information for Lab Assistants 9

3 Information for Students 113.1 The CSM Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2 The ENGR Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.3 Other Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.4 Blackboard at USC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.5 Purchasing Maple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.6 Getting Help with Maple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.7 Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

II Lab Assignments for 2003–2004 13

4 Labs for Calculus I 15Introduction to Maple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesShifting and Scaling the Graph of a Function . . . . . . . . . . . . . . . . . . . . . . . 2 pagesGraphical Understanding of Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesPrecise Definition of the Limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 pagesLimits, Infinity, and Asymptotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesTangent Lines and Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesImplicit Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesRelated Rates Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesImplicit Differentiation and Related Rates Problems . . . . . . . . . . . . . . . . . . . 2 pagesLinear Motion Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesMax/Min and Graphing Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesMean Value Theorem for Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesAntiderivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesDifferential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 pagesRiemann Sums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesArea of a Plane Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesAccumulation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesVolume of a Solid of Revolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pagesSurface Area of a Solid of Revolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 pages

3

Page 4: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

iv CONTENTS

5 Labs for Calculus II 51Introduction to Maple for Calculus II . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 pagesThe Natural Logarithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 pagesInverse Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 pagesInverse Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 pagesHyperbolic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 pagesTechniques of Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 pages

III Introduction to Maple 8 53

6 Getting Started 556.1 Maple Worksheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

A Execution Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55B Re-executing Maple Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 56C Creating New Execution Groups . . . . . . . . . . . . . . . . . . . . . . . . . . 56D Creating, Closing, and Opening Sections . . . . . . . . . . . . . . . . . . . . . . 56E Deleting Execution Groups and Sections . . . . . . . . . . . . . . . . . . . . . . 56F Entering Maple Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58G Context-Sensitive Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58H Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58I Saving Worksheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58J Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

6.2 Frequently Encountered Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59A Losing Your Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59B Syntax Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59C Input Unchanged/Echoed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59D No Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59E Printing Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

7 Calculus and Maple 637.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647.2 Maple Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

A Addition, Subtraction, Multiplication, and Division . . . . . . . . . . . . . . . . 64B Powers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64C Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65D Exact vs. Approximate Calculations . . . . . . . . . . . . . . . . . . . . . . . . 65

7.3 Assigning Values to Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66A Using Previous Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66B Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67C Suppressing Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

7.4 Maple Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68A Built-In Commands and Constants . . . . . . . . . . . . . . . . . . . . . . . . . 68B Command Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70C Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71D Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71E Creating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

7.5 Lists and Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75A Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Page 5: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CONTENTS 1

B Creating Lists and Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75C Extracting Elements of a List or Set . . . . . . . . . . . . . . . . . . . . . . . . 77D Extracting Solutions to an Equation . . . . . . . . . . . . . . . . . . . . . . . . 79

7.6 Creating Animations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817.7 Three Types of Brackets in Maple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837.8 Common Problems and How to Fix Them . . . . . . . . . . . . . . . . . . . . . . . . . 84

A Using a Command That Is Not Known by the Maple Kernel . . . . . . . . . . 84B Using Reserved Words and Protected Names . . . . . . . . . . . . . . . . . . . 84

7.9 Maple and Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85A Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85B Derivatives and Tangent Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . 86C Applications of Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88D Definite, Indefinite, and Improper Integrals . . . . . . . . . . . . . . . . . . . . 94E Applications of Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

7.10 Maple and Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

8 Tips for Maple Users 103

9 Quick Reference Guide for Maple 8 111

Page 6: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

2 CONTENTS

Page 7: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Part I

Using Maple 8 at USC

3

Page 8: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple
Page 9: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 1

Information for Instructors

Teaching a course in which a computer algebra system is available in some form does not have toinvolve a lot of extra work from the instructor. But, to be effective, the instructor should take alittle time to become familiar with Maple’s capabilities, features, and limitations. In this section Iraise a will attempt to provide some of this essential information. Every instructor should also readChapter 3 for detailed information about the availability of Maple on the USC campus. In Part II youwill find a description of the worksheet interface for Maple 8 (Chapter 6), an Introduction to Maple8 with an Emphasis on Calculus (Chapter 7), and some additional Tips for Maple Users (Chapter 8).

1.1 Getting Started

Become Acquainted with Student Computing at USC

In Fall 2002, more than 85% of USC students living on campus have access to a personally ownedcomputer with an Internet connection. This means students are not completely dependent on univer-sity resources for computer work. However, USC’s site license for Maple does not permit students toobtain a copy of the software for their personal use. USC’s agreement with Maple allows the softwareto be installed on any computer owned or leased by the university.1

Most students will access Maple in one of the computing labs created by the College of Scienceand Mathematics. (Students in the College of Engineering and Information Technology can accessMaple from the CEIT network.) See Chapter 3 for the specific locations of these labs. Maple is alsoavailable in the computer labs located in the dormitories. In the near future Maple is expected to beavailable in the library computer labs and in the College of Liberal Arts computer labs.

Students do not need to have Maple on their personal computer. Students interested in obtaininga copy of Maple should be reassured that the Student Edition is a full version of the software. TheStudent Edition of Maple can be purchased2 for $129 from the Maplesoft website

http://www.maplesoft.com/products/student/ .There are no limitations, omissions, or other functional differences between the Student Edition andthe academic version of the software. (The only differences are the packaging, no manuals, and theuser license.)

1I believe it is also permissible for faculty to obtain a copy of the software to install on a personally-owned computerfor educational purposes. People in the Department of Mathematics should contact Minna Moore for a copy of thesoftware. The University contact for Maple is Barbara Koski in CSD.

2As Maple is used by more students on the USC campus, it might become possible to to have the Student Editionstocked in local bookstores at a better price.

5

Page 10: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

6 Maple 8 and USC

Maple 8 vs. Maple 9

Maple 9 was released in early summer 2003, but Maple 8 is still being used in the labs at USC. Thecomputer labs, and this document, have been prepared specifically for Maple 8. Only minor changeswill be needed to update these materials for Maple 9. These changes will be made at the time whenMaple 9 will be used in the student computer labs at USC.

If students obtain the Student Edition of Maple 9, they should have very few — if any — prob-lems using the existing materials. The latest information about updates, platforms, and hardwarerequirements can be found at http://www.maplesoft.com/products/.

Web-Based Access to Maple

In addition to the traditional worksheet interface, maplets can be used to create customized userinterfaces that provide access to specific Maple commands. Maplets can be run either locally (ifMaple is loaded) or via the WWW with MapleNet. MapleNet requires Java to create and managethe user interface on the local computer and to establish a connection to Maple running on theMapleNet server. This is a good way for students to access Maple-related content without theexpense of obtaining a copy of Maple.3

1.2 Computer Labs for Calculus

Weekly Computer Labs

The computer lab components of Calculus I and II are completely planned for you. The students willbe learning Maple fundamentals in the context of calculus. Recognize that with one lesson per week,their knowledge will grow slowly. Do not expect them to be independent users until the end of the firstsemester of Maple usage. If you want to include Maple in your lectures, assign projects, or anythingelse that involves Maple, please be cognizant of what students have seen and your expectations oftheir Maple knowledge.

A computer lab experience is prepared for each week of the course. These labs are completelyself-contained. Some reinforce topics introduced in lecture, others provide a complete treatment oftopics traditionally covered in lecture, and a few labs extend lecture material. Every lab begins witha brief discussion of the purpose of the lab and the necessary mathematical background. New Maplecommands and usage is presented in a series of examples. The lab concludes with a series of questionsfor students to answer. The questions typically require Maple usage similar to that shown in theexamples.

The general idea is that the lab assistant will be able present new ideas, including examples, inno more than 15 minutes at the beginning of the lab. This leaves more than 30 minutes for studentsto work on the questions. Students will have adequate time in the lab period to think about andunderstand what is required to answer each question. Many students will submit their completed labat the end of the lab period; the deadline for submitting solutions is about 30 hours after the end ofthe lab period.

Lab assignments should be prepared as Word documents. It is easy to paste Maple output,including a plot, into Word. The file can then be printed, attached to an e-mail, or submittedthrough Blackboard.

3From a Sun workstation, access to MapleNet requires the use of Netscape 7 (or comparable browser).

Page 11: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

INFORMATION FOR INSTRUCTORS 7

The Information for Students and Information for Lab Assistants Sections areAlso for Instructors

Although the information in the next chapters is written for students, you should read it to learnmore about the Maple computing environment. If you are already familiar with Maple, you mightwant to quickly skim through the material. Pay particular attention to facts that you know but areunknown to students or lab assistants. Try to look at this material from the appropriate perspectiveand recognize how this is different from your perspective on the material. However, if you are anew Maple user, you should read this material more closely, directing particular attention to theterminology and descriptions of manipulations with Maple’s graphical user interface.

Page 12: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

8 Maple 8 and USC

Page 13: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 2

Information for Lab Assistants

This section should be written by the current lab assistants, with the input and guidance of GeorgeJohnson and Bob Murphy.

9

Page 14: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

10 Maple 8 and USC

Page 15: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 3

Information for Students

The College of Science and Mathematics (CoSM), College of Engineering and Information Technology(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple. This licenseallows the installation of Maple on any university owned or leased CPU. This is an example of yourStudent Technology fee being put to use to benefit undergraduate education at USC.

3.1 The CSM Network

Maple is available in every student computer lab on the CSM network maintained in the College ofScience and Mathematics. At present these labs are located in LeConte 124, LeConte 303A, EWS210, and PSC 102. For up-to-date information on instructional computing in the College of Scienceand Mathematics, please visit the CoSM-IC website at

http://www.cosm.sc.edu/cosmic/ .Any student whose major is in the College of Science and Mathematics or currently taking a

course in the college is eligible for an account on the CSM network. Speak with your instructor orsee information posted in the computer labs for details about obtaining an account on this network.

3.2 The ENGR Network

The general-purpose student computing labs in the College of Engineering and Information Technol-ogy are located in Swearingen 1D29 and 3D22. A website with information on Information TechnologyServices in the CEIT is

http://www.engr.sc.edu/its/ .Information about computer accounts on the CEIT network can be obtained from the WWW or

the Help Desk in SWGN 1D35.

3.3 Other Networks

Maple is installed on the computers in the university-run computer labs in the dorms. We arecurrently investigating the possibility of having Maple installed on computers in Cooper Library andin labs maintained by the College of Liberal Arts.

11

Page 16: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

12 Maple 8 and USC

3.4 Blackboard at USC

USC’s Blackboard system can be used to present some of the lab materials. Some sections may alsouse this system to submit and return assignments. In order to successfully use the Blackboard system,including its e-mail and other correspondence features, it is necessary to register your preferref e-mailaddress (probably not Gamecock E-Mail) and create a Network Username on VIP.

Once you have created a Network Username in VIP, Blackboard can be entered using the URLhttp://blackboard.sc.edu/ .

3.5 Purchasing Maple

You are not expected to have Maple on your personal computer. If, however, you would like topurchase a copy of Maple to install on your computer, you should purchase the Student Edition.The Student Edition is available only to students at accredited educational institutions (includingUSC) but is a full version of Maple. The current price is $129 (compared to $1000 for an academicversion and $1800 for a commercial license). Fortunately, the Student Version contains a full versionof Maple without any limitations on the size of a problem — another benefit of being a student!

Additional information about the Student Edition, including links to purchase the software online,can be found at

http://www.maplesoft.com/products/student/ .

3.6 Getting Help with Maple

Your first source of information about a problem you are experiencing with Maple should be Maple’sonline help system (explained in more detail in Part II of this document – include hyperlink?). Yournext sources of assistance should be fellow students and your instructors.

Maple maintains an online Student Center athttp://www.maple4students.com/ .

This website contains Maple tutorials, lessons for more than 20 courses (ranging from algebra, ge-ometry, and pre-calculus through calculus and differential equations, and beyond including abstractalgebra, complex variables, and cryptography), as well as links to many other useful sites.

3.7 Additional Information

A one-page handout with step-by-step instructions for accessing the CSM network, setting up yourUSC VIP preferences, and preparing to use Blackboard can be found on the web at

http://www.math.sc.edu/~meade/141L-F03/misc/access.doc .An HTML version of this Word document is also available.

A brief Introduction to Maple 8 is provided in Part II of this document. This is a good firstsource for information about the Maple worksheet interface and an the Maple language. The Mapleworksheet from which the latter was created can be obtained from

http://www.math.sc.edu/~meade/141L-F03/misc/intro-8.mws ;an HTML version of this Maple worksheet is also available. A two-page Quick Reference Guide toMaple 8 should be printed (or, at least, bookmarked); the URL is

http://www.math.sc.edu/~meade/maple/maple-ref.pdf .

Page 17: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Part II

Lab Assignments for 2003–2004

13

Page 18: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple
Page 19: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 4

Labs for Calculus I

15

Page 20: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Introduction to Maple

Objective The purpose of this initial lab is to help you become familiar with the CSMcomputer network and the Maple software package.

Background Maple is a powerful computer algebra system. We will be using Maple to helpvisualize mathematical concepts introduced in this course. Maple is available onmany computers on campus, including all CoSM, Engineering, and dormitorycomputer labs.

To begin to learn to use Maple, the Discussion section of this lab assignmentpresents and illustrates some of the algebraic, graphical, and numerical featuresthat will be used repeatedly throughout this course.

In particular, you will learn to use the following Maple commands: factor,plot, solve, evalf. For the homework you will need to discover the Maplecommand for factorials.

The Questions section contains a few questions that you should be able toanswer after you successfully complete the examples in the Discussions section.

Your lab report must be submitted as a separate document. You are stronglyencouraged to prepare your lab report as a Word document. Information fromMaple, including pretty-printed output and graphics, can be copied and pastedinto a Word document. Be sure that you answer each question and that youranswers are written with complete English sentences.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet. Notethat anything that appears after a # is a comment; it is not necessary to enterthis in your worksheet.

Example 1: Arithmetic with Maple

> restart; # clear Maple’s memory> 1/2 + 1/50; # Maple’s answer is exact> 1/(2 + 1/50); # grouping is important> 2 + (3/4 * 5/6); # the * is required for multiplication

Example 2: Assignments and Discontinuities

> x := Pi/2; # assign a value to x

> sin( x ); # compute exact value of sin(π2 )

> tan( x ); # compute exact value of tan(π2 )

> tan( x/2 ); # attempt to evaluate tan at discont> y := cos( x/2 ): # colon =⇒ result not displayed> y; # exact value of cos(π

4 )> y^2; # exact value of cos2(π

4 )

Example 3: Floating-Point Approximations

> Pi; # the mathematical constant π

> evalf( Pi ); # default computations w/ 10 digits> evalf[20]( Pi ); # approx value of π w/ 20 digits

Maple Lab for Calculus I Fall 2003

Page 21: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 4: Algebraic Manipulations

> x; # x has an assigned value> unassign( ’x’, ’y’ ); # remove assigned values> x; # now x can be used as a variable> F := a*x^2 + b*x + c; # define a general quadratic> solve( F=0, x ); # quadratic formula> G := x^10 - 1; # a 10th degree polynomial> factor( G ); # factor the polynomial> solve( G=0, x ); # 10 solutions, 8 complex-valued> fsolve( G=0, x ); # only real-valued solutions> fsolve( G=0, x, complex ); # all 10 solutions

Example 5: Simple Plots

> F := (u-1)*(u-4)*u; # cubic w/roots u = 0, 1, and 4> plot( F ); # ERROR – no domain given> plot( F, u=-3..6 ); # plot of y = F (u) on [-3,6]> plot( F, u=-3..6, y=-20..20 ); # same plot w/window [−3, 6]× [−20, 20]

Example 6: Symbolic Trigonometry

> one := sin(x)^2 + cos(x)^2; # names w/more than one character> simplify( one ); # trigonometric identity

Notes

(1) Working with 20 digits does not mean that all 20 digits are correct. To get the correct20-digit approximation to π, ask Maple to work with a few additional digits.

(2) A complete Maple worksheet with more details about the topics addressed by the abovediscussion is available on the WWW at

http://www.math.sc.edu/~meade/141L-F03/misc/week1.mws.

Questions

(1) Let f(x) = x4 − 32x3 + 187x2 + 160x− 960. Find all values of x where f(x) = 0.(Give exact values.)

(2) Use a suitable graph of f(x) from Question 1 to approximate the point(s), (x, y), where fattains its largest and smallest values on the interval −5 ≤ x ≤ 5.

(3) Find the decimal digit in the 25th digit to the right of the decimal point in π.(4) Find the smallest integer, n, such that n! has exactly 10 trailing zeros, i.e., n! is divisible by

1010 and not divisible by 1011.(5) Does n! ever have exactly 11 trailing zeros?

(Justify your answer using complete English sentences. Be brief, but complete.)

Maple Lab for Calculus I 3 Introduction to Maple

Page 22: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Shifting and Scaling the Graph of a Function

Objective This lab continues the introduction to Maple by learning how to create morecomplicated plots: plots with graphs of more than one function, legends, differentcolors and styles, ....

The examples and assignment will have you working with horizontal and ver-tical shifts and scalings.

Background There are two fundamentally different ways to work with functions in Maple.The first method, used in Lab 1, is to enter the function as an expression.The following commands illustrate how a function entered as an expression isevaluated at a point, x = 2, and used to form the difference quotient.

Example 1: Functions as Expressions

> F := (x+2)*(x^2-1); # define function as an expression> plot( F, x=-3..3 ); # plot of function on domain [-3,3]> eval( F, x=2 ); # compute F (2)> dq F := (eval( F, x=x+h ) - F)/h; # compute F (x+h)−F (x)

h

> simplify( dq F ); # perform algebraic simplification

The second method uses the Maple arrow operator (->) to define a rule thatmaps the input, x, to a value of the function, (x + 2)(x2 − 1).

Example 2: Functions as Mappings

> f := x -> (x+2)*(x^2-1); # define function as a mapping> plot( f(x), x=-3..3 ); # plot of function on domain [-3,3]> f(2); # compute f(2)> dq f := (f(x+h)-f(x))/h; # compute f(x+h)−f(x)

h

> simplify( dq f ); # perform algebraic simplification

This example illustrates that it is easier to evaluate a function at a specific pointwith the second method. Expressions are easier to define but evaluation at aspecific point requires the eval command.

Discussion Example 3: Getting Started

> restart; # clear Maple’s memory> with( plots ); # additional plotting commands> f := x -> (x+2)*(x^2-1); # define f(x) = (x + 2)(x2 − 1)

Example 4: Horizontal and Vertical Shifts

> plot( [ f(x), f(x+1), f(x-2) ],

> x=-3..3, y=-20..20 ); # function and two horizontal shifts> plot( [ f(x), f(x)+1, f(x)-2 ],

> x=-3..3, y=-20..20 ); # function and two vertical shifts

Maple Lab for Calculus I Fall 2003

Page 23: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 5: Animated Horizontal and Vertical Shifts

> animate( f(x+a), x=-8..8, a=-4..4, # animation w/9 frames> frames=9, view=[DEFAULT,-20..20] );

> Pf := plot( f(x), x=-8..8, color=blue ): # note use of colon> Phshift := animate( f(x+a), x=-8..8, # animation w/49 frames> a=-4..4, frames=49,

> view=[DEFAULT,-20..20] ):

> display( [Pf, Phshift] ); # overlay orig on anim

Notes

(1) The display of multiple plots and animations could have been created with expressions;the use of eval would make the commands very complicated and much less clear. This isdefinitely a place to use mappings.

(2) Maple uses different colors for different curves in a plot. The third curve, drawn in yellow,can be very difficult to see. The colors can be changed by using the color= option to theplot command.

(3) A Maple plot can be copied to many other applications, e.g., Word or PowerPoint. A Mapleplot pasted into another application cannot be edited. All changes to the plot must be madewithin Maple.

(4) If a plot is to be printed on a black and white printer, colors are not a good way to identifycurves. In this situation the linestyle= option can be used.

(5) By default Maple uses 50 points to plot a function. If this produces a jagged graph for asmooth function, include the numpoints= argument in the plot command.

(6) To see a plot of points instead of the curve, use style=point. To distinguish multiple setsof points, use color= and/or symbol=. A list of 25 pre-defined colors can be found on theplot,color help page (accessible via the command ?plot,color).

(7) The title= and legend= options put a title and legend, respectively, on a Maple plot. Alegend can also be inserted interactively. To access this feature, position the cursor above aMaple plot and click the right mouse button. Select Legend, Edit Legend ....

(8) For additional information about the optional arguments for the plot command, see thehelp page named plot,options.

Questions Let f(x) = (x + 2)(x2 − 1) on the domain [−3, 3].

(1) Create a Maple plot containing the graph of y = f(x) together with the graphs of thehorizontal shifts to the right by 2, to the right by 1, and to the left by 1. Use colors that areeasily visible, i.e., not yellow. Include a legend that clearly identifies each of the four curvesin the plot. Suggestion: Copy your plot into a Word document.

(2) Create a Maple plot containing the graph of y = f(x) together with the graphs of thevertical shifts down by 5 and up by 2. Again, use easily visible colors and include a legendidentifying the three curves in the plot.

(3) A horizontal scaling of the graph of y = f(x) is the graph of y = f(ax) where a is referred toas the scale factor of the scaling. What Maple command will create a 21-frame animation ofthe horizontal scaling of the graph of y = f(x) with scale factors ranging from -10 to 10? Besure you specify a plot window that makes a good display for all frames in the animation. Itmight be necessary to use more than 50 points to create smooth curves for all scale factors.

(4) One of the horizontal scalings of the graph of y = f(x) does not cross the x-axis. Whichone? Why?

Maple Lab for Calculus I 5 Shifting and Scaling the Graph of a Function

Page 24: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Graphical Understanding of Limits

Objective The purpose of this lab is to help you develop your intuitive understanding oflimits. This will be accomplished by determining limits using Maple plots offunctions that would otherwise be difficult to visualize or manipulate.

Background Limits are the foundation for all of calculus. As such it is essential that youdevelop a solid understanding of this concept. The basic picture you need tohave in mind is that limits do not depend on the value of the function at thelimit point. In fact, a limit can exist even if the function is not defined at thelimit point.

In this lab you will use your skills to plot a Maple function and use this asan aid in evaluating limits. You will also learn to use Maple to define and plotpiecewise-defined functions.

New Maple commands introduced in this lab include limit, for evaluating one-and two-sided limits, and piecewise, for entering piecewise-defined functions.

Discussion The fundamental idea behind limits is that the value of a function at the limitpoint is not important. In some cases, a function may not be defined at the limitpoint (Example 1). In other cases, the value of the function may be defined butdifferent from the limit (Example 2). When the function is defined at the limitpoint and this value agrees with the corresponding limit the function is said tobe continuous at this limit point (Example 3). Example 4 is a very commonlimit.

Example 1: limx→1

x3 − 5x2 + 8x− 4

x− 1> restart; # clear Maple’s memory> f := x -> (x^3-5*x^2+8*x-4)/(x-1); # define function> f(1); # fn has singularity at x = 1> plot( f(x), x=-4..4 ); # plot function on [-4,4]> f(1.1); # value point near x = 1> f(1.01); # value point closer to x = 1> f(1.0001); # ...> limit( f(x), x=1 ); # limiting value

Example 2: limx→1

g(x) where g(x) =

1 x < 12 x = 13 x > 1

> g := x -> piecewise(x<1,1,x=1,2,x>1,3); # piecewise-defined function> g(1); # function is defined at x = 1> plot( g(x), x=0..2, y=0..3, discont=true

);

# plot function on [0,2]

> limit( g(x), x=1 ); # two-sided limit> limit( g(x), x=1, left ); # one-sided limit from left> limit( g(x), x=1, right ); # one-sided limit from right

Maple Lab for Calculus I Fall 2003

Page 25: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 3: limx→2

∣∣x2 − x− 2∣∣

> h := x -> abs(x^2-x-2); # define function> h(2); # value of function at x = 2> plot( h(x), x=-2..3 ); # plot of function> limit( h(x), x=2 ); # agrees with limit at x = 2> # =⇒ h(x) continuous at x = 2

Example 4: limx→0

sin x

x> s := x -> sin(x)/x; # define function> plot( s(x), x=-5*Pi..5*Pi ); # limit at x = 0 is clear> s(0); # value of function at x = 0> limit( s(x), x=0 ); # consistent with plot?

Note

(1) A Maple plot is really a collection of points connected in sequence. As a result, when Mapleplots a discontinuous function it normally connects the points. To force Maple to look fordiscontinuities and to create a reasonable plot, include the optional argument discont=truein the plot command.

Questions

(1) Let

f(x) =x3 − 7x2 + 15x− 9

x4 − 6x3 + 5x2 + 24x− 36.

For what values of x is the graph of y = f(x) discontinuous? For each discontinuity, c, of f ,is it possible to define f(c) so that f is continuous at c? (Explain.)

(2) Evaluate each of the following limits:

limx→0

sin(3x)

xlimx→0

sin(x)

4xlimx→0

sin(ax)

sin(bx).

(3) Let F (x) =sin x√

1− cos x. Evaluate

limx→0

F (x) limx→0

|F (x)|.

Use one-sided limits to explain why only one of these limits exists.

(4) One of limx→0

sin(1

x) and lim

x→0x sin(

1

x) exists and the other does not exist. Which limit exists?

What is the value of this limit? What property of limits is used to evaluate this limit?(5) Define g to be the piecewise-defined function

g(x) =

2− x2 x < 1√

x− 1− ax + 2 x ≥ 1.

For what value(s) of a is g continuous for all real numbers? Hint: Look at one-sided limits.

Maple Lab for Calculus I 7 Graphical Understanding of Limits

Page 26: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Limits, Infinity, and Asymptotes

Objective There are three objectives of this lab assignment: i) to develop your ability todetermine limits at ±∞, ii) to recognize when a limit diverges to ±∞, and iii)to use limits at infinity and infinite limits to determine asymptotes for the graphof a function.

Background There are three types of asymptotes: horizontal, vertical, and oblique.

Type Equation Defining PropertyHorizontal y = b lim

x→∞f(x) = b lim

x→−∞f(x) = b

Vertical x = a limx→c+

f(x) = ∞ limx→c−

f(x) = ∞lim

x→c+f(x) = −∞ lim

x→c−f(x) = −∞

Oblique y = ax + b limx→∞

(f(x)− (ax + b)) = 0

limx→−∞

(f(x)− (ax + b)) = 0

The Asymptotes command generally returns all asymptotes — horizontal, ver-tical, or oblique — for a function. This command is available only after loadingthe Student[Calculus1] package. The Asymptotes command is implementedusing Maple’s capabilities to evaluate limits, to determine singularities of func-tions, and to perform various symbolic manipulations (such as long division ofpolynomials).

The Asymptotes command returns the asymptotes as a list of equations. Inthis form the implicitplot command is the easiest way to plot equations (notexpressions). Unfortunately, in Maple 8 the implicitplot command can acceptonly a set of equations. The convert command can be used to change a list intoa set. Here it is simpler to construct the set explicitly with expr1, expr2 .

The limit command is all that is needed to determine any horizontal asymp-totes for a function. Note that the mathematical constant ∞ is called infinity

in Maple.Vertical asymptotes can often be found by determining the zeros of the de-

nominator of a function. The numer and denom commands are used to obtainthe numerator and denominator of a rational expression. Then, factor or solvecan be used to identify the zeros of an appropriate expression.

The quo and rem commands perform polynomial division that is frequentlyneeded to determine oblique asymptotes.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: Asymptotes command

> restart; # clear Maple’s memory> with( plots ); # load plots package> with( Student[Calculus1] ); # load package> w := x -> (2*x^5+3*x^3-2*x-2)/(x^4-1); # define function> Pw := plot( w(x), x=-10..10, # plot function> y=-20..20, discont=true ):

> Pw; # display plot> asym := Asymptotes( w(x), x ); # asymptotes as list> Pa1 := implicitplot( asym[1], # plot of oblique asymp> x=-10..10, y=-20..20, linestyle=2 ):

> Pa2 := implicitplot( asym[2], asym[3], # plot of vertical asymps> x=-10..10, y=-20..20, linestyle=3 ):

> display( [ Pw, Pa1, Pa2 ] ); # display combined plot

Maple Lab for Calculus I Fall 2003

Page 27: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 2: Horizontal Asymptotes

> g := x -> (x^4-2*x^3+2*x-1)/(x^4+1); # define rational function> Pg := plot( g(x), x=-20..20 ): # create graph of function> Pg; # display graph of function> q1 := limit( g(x), x=infinity ); # horizontal asymptote?> q2 := limit( g(x), x=-infinity ); # horizontal asymptote?> horiz := q1, q2 ; # set of horizontal asymptotes> Ph:=plot( horiz, x=-20..20, color=cyan ): # create graph of horiz asymp> display( [ Pg, Ph ] ); # display combined graph

Example 3: Vertical Asymptotes

> f := x -> (sin(x)-cos(x)+1)/(x^3-3*x+2); # define function> Pf := plot( f(x), x=-4..4, # create graph of function> y=-10..10, discont=true ): # note colon to end command!> Pf; # display graph of function> q1 := denom( f(x) ); # denominator of f(x)> q2 := solve( q1=0, x ); # locate singularities> vert := x=-2, x=1 ; # vertical asymptotes> Pv := implicitplot( vert, x=-2*Pi..2*Pi, # create graph of vert asymp> y=-20..20, color=blue ):

> display( [ Pf, Pv ] ); # display combined graph

Example 4: Oblique Asymptotes (for Rational Functions)

> u := x -> (3*x^3-4*x^2-5*x+3)/(x^2+1); # define rational function> Pu := plot( u(x), x=-10..10 ): # create plot> Pu; # display plot> q1 := numer( u(x) ); # numerator of function> q2 := denom( u(x) ); # denominator of function> q3 := quo( q1, q2, x ); # quotient from long division> q4 := rem( q1, q2, x ); # remainder from long division> u2 := q3 + q4/q2; # equivalent form of u

> u(x) = simplify( u2 ); # equivalent expressions?> Po := plot( q3, x=-10..10, color=pink ): # create plot of oblique asymp> display( [ Pu, Po ] ); # display combined plot

Notes

(1) In Example 1, the different types of asymptotes are distinguished with different linestyleoptions. When a plot will be printed in black-and-white, this is preferable to using thecolor option.

Questions

(1) Use the limit command to explain why there are no horizontal asymptotes in Example 4.

(2) Find all horizontal, vertical, and oblique asymptotes for f(x) =2|x|3 + 3

x3 + 1− 8 sin x

x2 + 1. List the

asymptotes and include a clearly labeled graph of the function and its asymptotes.(3) (a) Write the function in Example 1 in the form w(x) = L(x) + R(x) where L is a linear

function and R is the ratio of two polynomials for which the numerator has a smallerdegree than the denominator. Write the denominator of R(x) in factored form.

(b) Explain how (a) allows the vertical asymptotes of w(x) to be determined by inspection.(c) Show that the graph of R(x) has y = 0 as its horizontal asymptote.

Maple Lab for Calculus I 9 Limits, Infinity, and Asymptotes

Page 28: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Tangent Lines and Differentiation Rules

Objective This lab provides practice applying the differentiation rules and using derivativesto answer questions about tangent lines and rates of change.

Background Differentiation is very methodical. You apply the basic differentiation rules inthe correct order and you eventually come to an expression for the derivativeof the original expression. The Differentiation maplet is a “differentiationcalculator” designed to help you learn the correct order in which to apply thedifferentiation rules for any particular problem. A complete list of maplets forCalculus I is maintained on the WWW at

http://www.math.sc.edu/~meade/141L-F03/maplets/.As you become comfortable with the computation of derivatives and begin

to need to use derivatives to answer other questions, Maple’s diff and Diff

commands should be used to return the derivative of an expression. The D

command returns the derivative function of a given function.Other new commands encountered in this lab include rhs, to extract the right-

hand side of an equation, isolate, to solve an equation for a quantity (that couldbe more complicated than a name), unapply, to create a Maple function froma Maple expression, and, from the Student[Calculus1] package, the Tangent

command for quickly returning the equation of a tangent line at a point on thegraph of a function. Lastly, square brackets can be used to refer to a specificelement in a list, e.g., L[2].

Discussion The Differentiation maplet can be described as a calculator, or tutor, specif-ically for the computation of derivatives. A maplet can be run on your localcomputer if Maple 8 is installed. Otherwise, MapleNet is used to run the mapletremotely. All that is needed to run a maplet over the web is a fairly recentversion of Java.

Example 1: The Differentiation maplet• From your browser, launch the Differentiation maplet• Enter a function, say x^2/(x^2+1)

• Enter the name of the independent variable, typically x

• Press the Start button in the maplet window• The first step is to apply the Quotient Rule, i.e., press Quotient• To compute d

dxx2, apply the Power Rule.

• To compute ddx

(x2 + 1), apply the Sum Rule.• To conclude, apply the Constant Rule and the Power Rule (again).• The final step is to simplify Maple’s answer by hand.

Enter, and execute, the following Maple commands in a Maple worksheet.

Example 2: Derivatives of Expressions

> restart; # clear Maple’s memory> F := x^4 - 2*x^3 - 7*x^2 + 20*x - 12; # a quartic expression> Fp := diff( F, x ); # first derivative> plot( [ F, Fp ], x = -3 .. 3, # plot F and F’> color=[red,blue],

> legend=["y=F","y=F’"] );

> q1 := Fp = 0; # eqn for pts w/horiz tangent> solve( q1, x ) ; # three solutions> Fppp := diff( F, x,x,x ); # third derivative> eval( Fppp, x=4 ); # evaluate F ′′′(4)

Maple Lab for Calculus I Fall 2003

Page 29: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 3: Derivatives of Functions

> f := unapply( F, x ); # convert expression to function> Df := D( f ); # first derivative fn> plot( [ f(x), Df(x) ], x = -3 .. 3, # plot f and f’> color=[red,blue],

> legend=["y=f(x)","y=f’(x)"] );

> q2 := Df(x) = 0; # eqn for pts w/horiz tangent> solve( q2, x ) ; # three solutions> D3f := D(D(D( f ))); # third derivative fn> D3f( 4 ); # evaluate f ′′′(4)

Example 4: Tangent Lines

> pt := [ -2, f(-2) ]; # pt on graph of y = f(x)> m := Df( pt[1] ); # slope = deriv at point> q3 := m = ( y - pt[2] ) / ( x - pt[1] ); # slope = rise / run> Ltan := isolate( q3, y ); # another way to solve for y

> plot( [ f(x), rhs(Ltan) ], x=-4..4, # plot of fn and tangent line> legend=["Function","Tangent line");

> with( Student[Calculus1] ); # load package> Tangent( f(x), x=-2 ); # tangent line

Notes

(1) If you are uncertain about the next rule to apply in the Differentiation maplet, click theObtain a Hint button.

(2) It can be very tedious to repeatedly apply some of the simpler differentiation rules, e.g.,Constant and Constant Multiple. To have Maple automatically apply a rule, place acheck mark next to each rule in the Understood Rules menu that you want to be appliedautomatically.

(3) The TangentAndSecant, TangentLinePlot, and DerivativePlot maplets are also relevantat this point in the course. The first maplet can show an animation of the convergence ofsecant lines to the tangent line to the graph of a function at a point. The second mapletdisplays the equation and graph of the tangent line to the graph at a point. The thirdmaplet is used to create a graph of the function and one or more derivatives of the function.

Questions

(1) (a) Assume f1, f2, f3, and f4 are differentiable functions. Express

d

dx(f1(x)f2(x)f3(x)f4(x)) .

as the sum of four terms. How many times is the product rule used to obtain thisanswer?

(b) How many times would the product rule be used to find the derivative of the productof n differentiable functions?

(2) (a) Find the x-coordinate for each point on the graph of y =√

4x− x2 whose tangent linepasses through the point (3, 6).

(b) For what values of y0 are there two, one, and no tangent lines to the graph of y =√4x− x2 that pass through the point (3, y0)?

(3) Let g(t) = cos(t3 − 3t + sin(2t)). Find g and its first 5 derivatives. Classify each of thesesix functions as even, odd, or neither. Based on these results, for what values of n is the nth

derivative of g an even function?

Maple Lab for Calculus I 11 Tangent Lines and Differentiation Rules

Page 30: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Implicit Differentiation

Objective This lab assignment provides practice with implicit differentiation.

Background Implicit differentiation requires the explicit identification of the independentvariable. All other variables in the equation are either parameters (constants)or dependent variables (functions) of the independent variable. Once these de-pendencies are recognized, the Chain Rule is applied when differentiating bothsides of the equation (with respect to an independent variable).

Two different ways to perform implicit differentiation in Maple will be pre-sented. The difference in the approaches is the way the functional dependence isrepresented. One method closely resembles the steps that are used to implementimplicit differentiation by hand (see Example 2). The more efficient method,demonstrated in Example 1, requires the use of a new Maple command.

New Maple commands introduced in this lab are implicitdiff and allvalues.As the name suggests, the implicitdiff command returns a derivative com-puted using implicit differentiation. The simplest usage is implicitdiff( eq,y, x ); to determine dy

dxwhere the equation eq implicitly defines y as a function

of x. For example, the command> implicitdiff( x^2+y^2=1, y, x );

returns −xy

because dydx

= −xy

for all points on the unit circle (with y 6= 0). Higher-

order derivatives are obtained by repeating the independent variable, exactly asis done for higher-order derivatives with diff.

Maple uses the RootOf notation to provide a generic representation of all so-lutions of certain equations that have multiple solutions. The allvalues com-mand is used to force Maple to display all values represented by a RootOf. Forexample,

> q:=solve( x+y=x*y, y-x=1 , x, y );

> allvalues( q );Note that if solve returns more than one solution involving RootOf, then theargument to allvalues should be made into a list, e.g., allvalues( [q] );.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: Implicit Differentiation with Implicit Dependence

> restart; # clear Maple’s memory> with( plots ); # load package> eq := (x^2+y^2-a*y)^2 = x^2+y^2; # limacon> L := unapply( eq, a ); # create function> L(2); # limacon w/a = 2> implicitplot( L(2), x=-2..2, y=-1..4, # plot of typical limacon> grid=[50,50] );

> DyDx1 := implicitdiff( L(2), y, x ); # compute dydx

> dy/dx = factor( DyDx1 ); # display final result> q1 := solve( L(2), DyDx1=0, x,y ); # pts on curve w/m = 0> q2 := allvalues( [q1] ); # remove RootOf

Example 2: Implicit Differentiation with Explicit Dependence

> eq2 := eval( L(2), y=y(x) ); # limacon w/expl dep> Deq2 := diff( eq2, x ); # diff eqn wrt x

> q3 := isolate( Deq2, diff(y(x),x) ); # solve for dydx

> DyDx2 := simplify( rhs( q3 ) ); # simplify result> dy/dx = DyDx2; # display final result

Maple Lab for Calculus I Fall 2003

Page 31: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 3: Higher-Order Implicit Derivatives

> L(2); # recall specific limacon> dy/dx = DyDx1; # recall dy

dx

> DyDDx := implicitdiff( L(2), y, x,x ); # compute d2ydx2

> DyDDDx := implicitdiff( L(2), y, x,x,x ); # compute d3ydx3

Notes

(1) The implicitplot command is used to plot a curve when it is not possible, or not conve-nient, to write y = f(x). The general syntax is implicitplot( eqn, x=horizontalrange,y=verticalrange );. If the resolution in this plot is poor, add the optional argumentgrid=[nx,ny] with reasonable values for nx and ny. The default grid is 25 × 25, for 625points.

(2) When using implicit differentiation to find a derivative, dydx

, the fundamental requirementis that all occurrences of the dependent variable are treated as functions of the indepen-dent variable, i.e., y(x). The implicitdiff command takes care of this automatically byassuming the second and third arguments are the dependent and independent variables,respectively. (Additional arguments are used to indicate higher-order derivatives. See Ex-ample 3.)

(3) When solve finds more than one solution to an equation or system of equations, the answeroften is expressed as the RootOf some auxiliary equation. While these expressions areoften quite messy, do not assume they are of no use or interest. Sometimes the allvalues

command can give exact values for the solutions. If approximate solutions are suitable,apply evalf to the result of allvalues.

(4) In general, a curve does not have a tangent line if neither dydx

nor dxdy

exist at a point on thecurve.

(5) Second-order and higher-order derivatives obtained by implicit differentiation can yield ex-tremely complicated results. A tool like Maple is very useful for problems that do requirethese derivatives.

Questions

(1) Consider the curve defined implicitly by x2 − xy + 3y2 = 6.(a) Find the coordinates (x, y) of each x- and y-intercept of this curve.(b) Find dy

dx.

(c) Find d2ydx2 . (Write your answer in factored form.)

(d) Find all points (x, y) on this curve where dydx

= 0.(e) Find the value of the second derivative at each point found in (d).

(2) This question refers to the curve introduced in Example 1.(a) Find the coordinates of the points on the limacon with a = 1 where the tangent line is

horizontal.(b) Find the coordinates of the points on the limacon with a = 1 where the tangent line is

vertical.(c) Find the coordinates of the points on the limacon with a = 1 where the curve does not

have a tangent line.

Extra Credit This question refers to the curve introduced in Example 1.(a) Find the English translation of the French word limacon.(b) What is another name for a limacon with a = 0?(c) Explain why a limacon with a = 1 is called a cardioid.

Maple Lab for Calculus I 13 Implicit Differentiation

Page 32: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Related Rates Problems

Objective This lab assignment provides additional practice with related rates problems.

Background Related rates problems are one of the principle applications of the Chain Rule.(The other principle application of the Chain Rule is implicit differentiation.)The key to solving a related rates problem is the identification of appropriaterelationships between the variables in the problem — and putting all of thepieces of information together to produce an answer to the question.

General Strategy for Solving Related Rates ProblemsStep 1: Read the entire problem; identify quantities to be found.Step 2: Draw a diagram; include relevant labels.Step 3: Identify constants, values of functions, rates of change, and quantities

that are functions of time.Step 4: Write equation(s) relating quantities in the problem.Step 5: Use the Chain Rule to differentiate both sides of an equation with

respect to time.Step 6: Substitute given constants, values of functions, and rates of change.Step 7: Solve for the quantities identified in Step 1.

Look for these steps in the Examples below, then duplicate this approach toanswer the Questions.

Some of the steps are easier to do with pencil and paper than with Maple.Step 1–3 are often easier to complete manually. Step 5 is one step that Maple ismost likely to be useful. In general, the command diff( eq, t ); differentiatesboth sides of the equation eq with respect to time t. Remember that all functionsof time must show this dependence in eq.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: Melting Snowball

Problem Statement:If a snowball melts so that its surface area decreases at a rate of 1 cm2/min, findthe rates of change of the radius and volume when the diameter is 10 cm.

Solution:Steps 1 and 2 are not explicitly included; draw the picture for yourself. Time-dependent functions are the radius, r(t), the surface area, S(t), and the volume,V (t). (Recall that, for a sphere with radius r, V = 4

3πr3 and S = 4πr2.)

Step 3: > Rvalue := r(t) = 5; # given value> Srate := diff( S(t), t ) = -1; # given rate

Step 4: > Seq := S(t) = 4*Pi*r(t)^2; # relate S, r

> Veq := V(t) = 4/3*Pi*r(t)^3; # relate V , r

Step 5: > dSeq := diff( Seq, t ); # Chain Rule> dVeq := diff( Veq, t ); # Chain Rule

Step 6: > q1 := eval( Veq, Rvalue ); # V when r = 5> q2 := isolate( dSeq, diff( r(t), t ) ); # solve for dr

dt

> q3 := lhs(q2) # drdt when

> = eval( rhs(q2), Rvalue, Srate ); # dSdt = −1, r = 5

Step 7: > eval( dVeq, Rvalue, q3 ); # dVdt when r = 5

> eval( Veq, Rvalue ); # V when r = 5

Maple Lab for Calculus I Fall 2003

Page 33: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 2: Colliding Cars

Problem Statement:Car 1 is traveling east at v1 km/hr and Car 2 is traveling south at 50 km/hr.How fast is Car 1 traveling if the rate at which the two cars approaching eachother is 80 km/hr at the instant when Car 1 is 3.5 km and Car 2 is 5.1 km fromthe intersection?

Solution:Let x(t) and y(t) denote distances of Car 1 and Car 2, respectively, from theintersection. Let d(t) be the distance between the cars.

Step 3: > dist1 := x(t) = 3.5; # given value> dist2 := y(t) = 5.1; # given value> vel1 := diff( x(t), t ) = v1; # given rate> vel2 := diff( y(t), t ) = -50; # given rate> vel3 := diff( d(t), t ) = -80; # given rate

Step 4: > eq := d(t)^2 = x(t)^2 + y(t)^2; # distance (squared)

Step 5: > Deq := diff( eq, t ); # Chain Rule

Step 6: > q1 := eval( eq, dist1, dist2 ); # distance (squared)> q2 := d(t) = sqrt( 38.26 ); # easier than solve

> q3 := eval( Deq, vel1, vel2, vel3 ); # insert rates> q4 := eval( q3, q2, dist1, dist2 ); # insert values

Step 7: > q5 := solve( q4, v1 ); # solve for v1

Note

(1) In the process of solving Example 2 you might have wondered “Why didn’t we work withthe explicit formula for the distance?” Let’s look at how this would go. After taking the

square root of both sides of the distance formula: d(t) =√

x(t)2 + y(t)2 the differentiationin Step 5 is somewhat more complicated. The result is:

d

dtd(t) =

x(t)dxdt

+ y(t)dydt√

x(t)2 + y(t)2.

Note that this is simply the equation Deq divided by d(t) =√

x(t)2 + y(t)2. From here theremainder of the problem is identical. Which method you prefer is a personal choice.

Questions

(1) A camera tracks the launch of a spacecraft during a perfectly vertical launch. The camera islocated on the ground 2 miles from the launch pad. If the rocket is 2.5 miles above groundand traveling at 700 mi/hr, at what rate is the camera angle (measured from the horizontal)changing? Give your answer in radians/hr, radians/s, and degrees/s.

(2) A conical ice cream cone has a vertical axis, is 10 centimeters high, and has an opening withdiameter 6 centimeters. The cone is completely filled with your favorite flavor of ice cream,but you do not eat the ice cream or the cone. Two hours later, a hole develops in the bottomof the cone and the melted ice cream drains at a rate of 2 cubic centimeters per second.(a) Find the relationship between the rates of change of the height and radius of the ice

cream remaining in the cone.(b) What is the rate of change of the height of (melted) ice cream left in the cone when the

height is 5 centimeters?

Maple Lab for Calculus I 15 Related Rates Problems

Page 34: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Implicit Differentiation and Related Rates Problems

Objective This lab presents two applications of the Chain Rule. It is designed to provideassistance with the technique of implicit differentiation, particularly as neededto answer related rates questions.

Background Implicit differentiation requires the explicit identification of the independentvariable. All other variables in the equation are either parameters (constants)or dependent variables (functions) of the independent variable.

Two different ways to perform implicit differentiation in Maple will be pre-sented. One method mimics the steps one would take by hand to perform thecomputation (see Example 2). The second method is much easier, but involvesthe use of a new Maple command (see Example 2).

Related rates problems are word problems that involve rates of change, i.e.,derivatives. The Chain Rule is usually used to find the critical relationshipbetween quantities in the problem. In these problems Maple is best used tocompute derivatives and to solve equations.

New Maple commands introduced in this lab are implicitdiff and allvalues.As the name suggests, the implicitdiff command returns a derivative com-puted using implicit differentiation. The simplest usage is implicitdiff( eq,y, x ); to determine dy

dxwhere the equation eq implicitly defines y as a function

of x. For example, the command> implicitdiff( x^2+y^2=1, y, x );

returns −xy

because dydx

= −xy

for all points on the unit circle (with y 6= 0). Maple

uses the RootOf notation to represent all solutions of certain equations that havemultiple solutions. The allvalues command is used to force Maple to displayall values represented by a RootOf. For example,

> q := solve( x+y=x*y, y-x=1 , x, y );

> allvalues( q );

Reminder: If an operation is easier to perform by hand — do so! Maple isa tool that is useful for some problems, but not everything. Do not feel that youneed to use Maple just to use Maple.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: Implicit Differentiation with Implicit Dependence

> restart; # clear Maple’s memory> eq1 := (x-a)^2 + (y-b)^2 = r^2; # circle w/center (a, b), radius r

> DyDx1 := implicitdiff( eq1, y, x ); # assume y = y(x), compute dydx

> dy/dx = DyDx1; # display final result> q1 := solve( eq1,DyDx1=-1, x,y ); # pts on circle w/m = −1> allvalues( [q1] ); # remove RootOf

Example 2: Implicit Differentiation with Explicit Dependence

> eq2 := eval( eq1, y=y(x) ); # circle w/explicit dependence> Deq2 := diff( eq2, x ); # diff both sides of eqn wrt x

> q2 := isolate( Deq2, diff(y(x),x) ); # solve for dydx

> DyDx2 := simplify( rhs( q2 ) ); # simplify result> dy/dx = DyDX2; # display final result> allvalues( [q3] ); # remove RootOf

Maple Lab for Calculus I Fall 2003

Page 35: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 3: Related Rates Problem

Problem Statement:If a snowball melts so that its surface area decreases at a rate of 1 cm2/min, findthe rates of change of the radius and volume when the diameter is 10 cm.

Solution:> Rvalue := r(t) = 5; # given value of radius> Srate := diff( S(t), t ) = -1; # given rate for surface area> Seq := S(t) = 4*Pi*r(t)^2; # surface area (sphere, radius r)> Veq := V(t) = 4/3*Pi*r(t)^3; # volume (sphere, radius r)> dSeq := diff( Seq, t ); # implicit differentiation> dVeq := diff( Veq, t ); # implicit differentiation> q1 := eval( Veq, Rvalue ); # volume when r = 5> q2 := isolate( dSeq, diff( r(t), t ) ); # solve for dr

dt

> q3 := lhs(q2) # drdt when dS

dt = −1, r = 5> = eval( rhs(q2), Rvalue, Srate );

> eval( dVeq, Rvalue, q3 ); # dVdt at same instant

> eval( Veq, Rvalue ); # dVdt at same instant

Notes

(1) The implicitplot command is used to plot a curve when it is not possible, or not conve-nient, to write y = f(x). The general syntax is implicitplot( eqn, x=horizontalrange,y=verticalrange );. If the resolution in this plot is poor, add the optional argumentgrid=[nx,ny] with reasonable values for nx and ny. The default grid is 25 × 25, for 625points.

(2) Reminder: When working related rates problems it is essential to compute all derivativesbefore values of dependent and independent variables are substituted into the calculation.Premature substitution will prevent the computation of the correct rate equation usingimplicit differentiation.

(3) The volume of a cone with radius r and height h is V =π

3r2h.

Questions

(1) Finddy

dxwhen

√y + x2y = 5.

(2) The curve x2 − xy + y2 = 6 is an ellipse centered at the origin. Find the equations of thetangent lines at the two points where the ellipse intersects the x-axis.

(3) A conical ice cream cone has a vertical axis, is 10 centimeters high, and has an opening withdiameter 6 centimeters. The cone is completely filled with your favorite flavor of ice cream,but you do not eat the ice cream or the cone. Two hours later, a hole develops in the bottomof the cone and the melted ice cream drains at a rate of 2 cubic centimeters per second.(a) Find the relationship between the height h and radius r of the ice cream remaining in

the cone.(b) Find the relationship between the rates of change of the height and radius of the ice

cream remaining in the cone.(c) What is the rate of change of the height of (melted) ice cream left in the cone when the

height is 5 centimeters?

Maple Lab for Calculus I 17 Implicit Differentiation and Related Rates Problems

Page 36: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Linear Motion Problems

Objective This lab assignment asks you for some information about objects that move backand forth along a line – a linear motion problem.

Background You will need to understand the relationships between position, velocity, andacceleration. You also need to be able to recognize the global extrema of afunction on a closed interval.

The previous labs have introduced almost all of the Maple needed to completethis lab. Several of the questions call for the solution of an polynomial equation.While Maple is pretty good at solving polynomial equations, you should alwaysverify that all solutions have been found. A graph is often helpful at this stagebut there are some instances where this is not suitable. In these instances youshould remember the Fundamental Theorem of Algebra: A polynomial p(x) ofdegree n has exactly n real and complex roots. Moreover, when the coefficientsof the polynomial are real-valued, any complex roots occur in complex conjugatepairs. That is, if z = a + ib is a solution to p(z) = 0, then so is z = a− ib.

The solve command can be used to solve inequalities as well as equalities.Many of the results returned by solve contain one or more occurrences ofRootOf. You already know that the allvalues command can be used to re-quest the explicit form for these roots. If a floating-point approximation to theroot is acceptable, then there are a couple of options. First, evalf can be appliedto the output from allvalues. Alternatively, if the original equation submittedto solve contains at least one floating point number then Maple will return itsanswer as floating point numbers. This completely avoids the RootOfs and theneed for allvalues.

Lastly, the select and remove commands can be used to retain or reject itemsof a set or list based on specified criteria. In particular, the command remove(

f, e ); assumes f is a Boolean-valued function (i.e., a function that returns avalue of true or false) and e is a Maple expression with several operands (e.g.,the elements of a list or set). This command applies f to every operand of e andremoves all operands that return true. (select( f, e ); does the opposite –all operands of e that yield true from f are selected.)

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: Working with the Results from solve

> restart; # clear Maple’s memory> F := x -> x^6 - x^4 + x^3 + x; # define polynomial> plot( F(x), x=-2..1, y=-5..10 ); # plot function> eq1 := F(x) = 0; # equation (exact)> s1 := solve( eq1, x ); # solutions – as expr seq> s2 := allvalues( [s1] ); # not very useful> s3 := evalf( [s1] ); # 6 real and complex roots> s4 := remove( has, s3, I ); # remove complex roots> eq2 := F(x) = 0.; # equation (floating point)> s5 := solve( eq2, x ); # 6 real & complex roots - approx> s6 := remove( has, [s5], I ); # remove complex roots

Maple Lab for Calculus I Fall 2003

Page 37: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 2: Solving Inequalities

> ineq := F(x) > 10; # create inequality> q1 := [solve( ineq, x )]; # solution w/RootOf> q2 := evalf( [q1] ); # floating point approx

Questions

(1) An object moves along the horizontal coordinate line according to the formula

s = t3 − 20t2 + 60t− 30 +16

twhere s is the directed distance from the origin in feet and t is time in seconds.• Find the velocity (as a function of time).• Find the speed (as a function of time).• Find the acceleration (as a function of time).• Find all times when the object is moving to the right.• Find all times when the object’s acceleration is negative.• Create a well-labeled graph showing the position, velocity, speed, and acceleration on

an window that confirms all of the other results for this problem.• On the interval 1 ≤ t ≤ 15, what is the greatest distance between the object and the

origin? When does this occur?• When does the object attain its highest velocity on the interval 1 ≤ t ≤ 15? What is

this velocity?

(2) Two particles move along a coordinate line. Both objects begin at the origin at time t = 0.After t seconds, assume t > 0, their directed distances from the origin, in feet, are given by

s1 =1

400(3t5 − 8t4 + 50t)

ands2 = 8t2 − 12t− t3,

respectively.• When do the objects have the same position?• When do the objects have the same velocity?• When do the objects have the same speed?• In general, what can be said about the number of times two objects have the same

velocity and the number of times two objects have the same speed? (Explain.)

Maple Lab for Calculus I 19 Linear Motion Problems

Page 38: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Max/Min and Graphing Problems

Objective This lab requires the use of the First and Second Derivative Tests to performqualitative analysis for a function and to answer applied optimization problems.

Background Maple can be used to create a reasonable graph of almost any function that weare likely to encounter in this course. Because of this, the “graphing” problemsin this lab do not ask you to create a graph of the function. Instead, youare requested to provide accurate qualitative information about the function:asymptotes, intervals on which the function is increasing/decreasing and concaveup/down, local and global extrema, and inflection points.

The FunctionChart command from the Student[Calculus1] package canbe used to create well-labeled plots of a function and its principle qualitativeproperties. In addition, the CurveAnalysis and FunctionAnalyzer mapletsare designed to assist with the qualitative analysis of a function. Links to thesemaplets can be found on the WWW at

http://www.math.sc.edu/~meade/141L-F03/maplets/.To apply the First or Second Derivative Test, find the stationary points using

solve and/or fsolve.A graph can help ensure that all real-valued solutions tof ′(x) = 0 are found. The printf command produces formatted output.

Discussion Example 1: The CurveAnalysis mapletThe CurveAnalysis maplet will display the graph of a function that high-

lights local extrema and intervals on which the function is increasing (blueline), decreasing (red curve), concave up (purple shading), and concave down(pink shading). This maplet, based on the FunctionChart command in theStudent[Calculus1] package, can be used to create a graph of a function thathighlights many of the qualitative features of the graph.• From your browser, launch the CurveAnalysis maplet• Enter a function, say x*cos(x)

• Specify that the domain is [−10, 10]• Select Show the Function; press Show• Select Show the Local Maxima; press Show• Select Show the Local Minima; press Show• Select Show the Increasing Intervals; press Show• Select Show the Decreasing Intervals; press Show• Select Show the Concave Up Intervals; press Show• Select Show the Concave Down Intervals; press Show• Press Plot All

Example 2: The FunctionAnalyzer mapletThe FunctionAnalyzer maplet provides a convenient interface for managing

the qualitative analysis of a function. When a function is entered, its first andsecond derivatives are automatically computed. The Solve an Equality orInequality region can be used to construct and solve equations (or inequalities)involving the function and its first two derivatives. For example, to find station-ary points of the function, enter Dy = 0 in the text box and press the buttonlabeled Attempt to solve equation. The Evaluate Experession region canbe used to evaluate an expression at a specific value of the independent variable.To simplify or otherwise manipulate the function, one of the derivatives, or an-other result displayed in this maplet, click the right mouse button and select thedesired menu item.

Maple Lab for Calculus I Fall 2003

Page 39: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

• From your browser, launch the FunctionAnalyzer maplet• Enter a function, say x*sqrt(x-3)/(x-2)^2

• Specify the domain, 3 ≤ x ≤ 10, and range, 0 ≤ y ≤ 2• Use right mouse button to simplify first and second derivatives• Check the boxes to construct a plot containing the function and the sign

charts for the first and second derivatives; press Update plot• To find critical point(s), enter Dy = 0 as the equation to be solved; press

Attempt to solve equation• To apply Second Derivative Test, enter D2y in the Evaluate the expres-

sion box and 3.4641 in the value box; press Evaluate expression atspecified value

Enter, and execute, the following Maple commands in a Maple worksheet.

Example 3: Using the FunctionChart command

> restart;

> with( Student[Calculus1] );

> f := x->( -x^3 + 3*x^2 - 5*x + 6 )/( x^2 - 4*x + 3 );

> FunctionChart( f(x), x=-10..15, view=[DEFAULT,-20..10] );

> FunctionChart( f(x), x=-10..15, view=[DEFAULT,-20..10]

> pointoptions=[symbolsize=18],

> slope=[thickness(2,2), color(red,blue)],

> concavity=[filled(yellow,green)] );

Example 4: Applying the Second Derivative Test

> Df := D(f); D2f := D(Df); # 1st & 2nd derivatives> q1 := solve( Df(x)=0, x ); # stationary points> q2 := remove( has, evalf( [q1] ), I ); # real-valued solutions> for c in q2 do # 2nd Deriv Test> printf( "f’’(%a) = %a\n", c, D2f(c) );

> end do;

> q3:=fsolve( numer(normal(D2f(x)))=0, x ); # poss infl pts

Notes

(1) Use ?FunctionChart to see a complete list of options for the FunctionChart command.(2) For polynomials, fsolve returns all real-valued solutions; otherwise, only one solution. Com-

pare q1, q2, [fsolve( Df(x)=0, x )];, and [fsolve( numer(normal(Df(x)))=0, x )];

(3) To use a Greek letter as a variable name in Maple, use the English spelling of the letter andMaple will display the name in Greek. See ?greek for the full list of Greek letters.

Questions

(1) Let g(t) = t√

t−3(t−2)2

. Use the First and/or Second Derivative Tests to identify all local and

global extrema and inflection points on the graph of y = g(t).(2) Let f(θ) = sin(θ)−sin2(θ). Use the First and/or Second Derivative Tests to identify all local

and global extrema and inflection points on the graph of y = f(θ) on the interval [−π, π].(3) An observatory is to be constructed in the form of a right circular cylinder topped with a

hemispherical dome. If the hemispherical dome costs twice as much per square foot as thecylindical wall, what are the most economical dimensions for a given volume? (Your answershould express the radius and height in terms of the volume, V , and price, p, per squarefoot for the cylindrical wall.) What is the total cost to build an observatory with volumeV = 8000 cubic feet and the cheaper material costs $12 per square foot.

Maple Lab for Calculus I 21 Max/Min and Graphing Problems

Page 40: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Mean Value Theorem for Derivatives

Objective This lab assignment explores the hypotheses of the Mean Value Theorem. As aresult of completing this assignment you will have a better understanding of themeaning of the MVT. In particular, you will have be able to determine when theMVT does — and does not — apply.

Background The Mean Value Theorem for Derivatives states thatIf f is both

(1) continuous on a closed interval [a, b] and(2) differentiable on the open intervall (a, b),

then there is at at least one number c in (a, b) with the propertythat

f(b)− f(a)

b− a= f ′(c).

Geometrically, the MVT says that there is a point (c, f(c)) where the slope ofthe tangent line is equal to the slope of the secant line on the interval [a, b].

The MeanValueTheorem command in the Student[Calculus1] package pro-vides access to the MVT with visual or symbolic results. A more convenientinterface is available with the MeanValueTheorem maplet

In this lab it is useful to plot the line segment between two points on a graph ofa function. This can be done with the plot command without explicitly findingthe equation of the secant line. In general, to plot the piecewise linear functionthrough a sequence of points, useplot( [ [x1,y1], [x2,y2], ..., [xn,yn] ] );. Adding the optional argu-ment style=point instructs Maple to plot the points without the joining linesegments.

The seq command is a convenient way to create a sequence of number — orother Maple objects. For example, seq(f(a), a=[1,4,9] ); and seq(f(a^2),

a=1..3 ); both return f(1), f(4), f(9). Of course, if f is defined, then Maplewill use this definition to return these three values of the function.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: Function Not Continuous

> restart; # clear Maple’s memory> with( Student[Calculus1] ); # load package> f := x -> x^2 + abs(x-1)/(x-1); # define function> a, b := 0, 3; # define interval> msec := ( f(b)-f(a) ) / ( b-a ); # slope of secant line> lines := seq( msec*x+c/2, c=-2..6 ); # lines ‖ to secant line> plot( [f(x), lines], x=a..b, discont=true

> color=[red,blue$4,green,blue$4] );

> MeanValueTheorem( f(x), a..b ); # hypotheses not satisfied

Maple Lab for Calculus I Fall 2003

Page 41: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 2: Function Continuous, but Not Differentiable

> g := x -> abs(x); # define function> a, b := -2, 5; # define interval> msec := ( g(b)-g(a) ) / ( b-a ); # slope of secant line> secline := [ [a,f(a)], [b,f(b)]; # 2 points on secant line> parlines := seq( msec*x+c/2, c=-1..3 ); # lines ‖ to secant line> plot( [ g(x), secline, parlines ],

> x=a..b, color=[red,green,blue$5] );

> MeanValueTheorem( g(x), a..b ); # hypotheses not satisfied

Example 3: Function Continuous and Differentiable

> F:=theta -> sin(theta)^2 + sin(theta) + 1; # define function> a, b := 0, 3*Pi/2; # define interval> msec := ( F(b)-F(a) )/( b-a ); # slope of secant line> lines := seq( msec*theta+c/4, c=-2..12 ); # lines ‖ to secant line> plot( [ F(theta), lines ], theta=a..b,

> color=[red,blue$6,green,blue$8] );

> dF := D(F); # derivative function> eq := dF(c) = msec; # MVT equation> C := solve( eq, c ); # exact solutions> evalf( C ); # ignore solution 6∈ (a, b)> MeanValueTheorem( F(theta), a..b ); # plot shows 2 c’s> c := MeanValueTheorem( F(theta), a..b ); # exact locations of c’s> evalf( c ); # numeric approx to c’s

Notes

(1) Multiple assignments can be made in a single input region using the following syntax:> x1, x2 := value1, value2;

(2) Example 3 should be explored with the MeanValueTheorem maplet. Note that the mapletdoes check the hypotheses of the MVT. If they are not satisfied, this is communicated tothe user in a dialog box. Unfortunately, this message is not as clear as it could be. Also, insome instances, the maplet may stop working after it is run with a function that does notsatisfy the hypotheses of the MVT. Because of this it is recommended that you check thatthe function satisfies the hypotheses of the MVT before beginning to use the maplet.

Questions

(1) Let f(x) = |x2 − x− 2|. Determine if the Mean Value Theorem applies to f on the interval[a, b] = [0, 3]. If the MVT does not apply, state the hypothesis that is not satisfied. If the

MVT does apply, identify all numbers c in the interval wheref(b)− f(a)

b− a= f ′(c). In either

case, include a graph that supports your conclusion.(2) Repeat Question (1) for S(θ) = sin(θ) + cos(2θ) on the interval [a, b] = [−π, π

2].

(3) Repeat Question (1) for g(t) = t + t−1 on the interval [a, b] = [−1, 2].(4) A car is stationary at a toll booth at 8:14a.m.. Twenty-five minutes later, at a point 32

miles down the road from the toll booth, the car is clocked going 65 miles per hour.• Explain, using the MVT, why the car must have exceeded 65 miles per hour at some

time in the twenty-five minutes after leaving the toll booth.• What speeds does the MVT tell us (or the Highway Patrol) that the car must have

attained during this time period?

Maple Lab for Calculus I 23 Mean Value Theorem for Derivatives

Page 42: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Antiderivatives

Objective In this lab you will develop your understanding and manipulative abilities withantiderivatives.

Background An antiderivative of a function f is any function F which satisfies the condition

F ′(x) = f(x).

Recall that antiderivatives are not unique. If F is an antiderivative of f , thenthe general antiderivative of f is F (x) + C

The basic Maple command for antiderivatives is int. The syntax for∫

f(x) dxis int( f(x), x );. Note, however, that Maple reports an antiderivative. Ifyou need the general antiderivative it will be necessary for you to include anappropriate arbitrary constant.

The Antiderivative maplet is an interface to the visual relationship betweena function and its antiderivatives. The Integration maplet is a calculator-likeinterface with buttons corresponding to each of the primary rules for evaluatingintegrals.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: The int Command

> restart; # clear Maple’s memory> f := x -> x^2 - 3 + 8*cos(x); # define integrand> F := int( f(x), x ); # an antiderivative> f(x) = diff( F, x ); # verify result> G := int( f(x), x ) + C; # general antiderivative> f(x) = diff( G, x ); # verify result

Example 2: The Antiderivative Maplet• launch the Antiderivative maplet• in the Function box, enter x^2 - 3 + 8*sin(x)

• in the a = and b = boxes, enter -2*Pi and 2*Pi, respectively• place a check in the Show the function checkbox; press Plot• place a check in the Show an antiderivative checkbox; press Plot• in the Value box, enter [ 0, 0 ]; press Plot• place a check in the Show class of antiderivatives checkbox; press Plot

Observe that the local extrema of each antiderivative (in blue or green) occur atthe points where the function (in red) is zero.

Example 3: The Integration Maplet• launch the Integration maplet• in the Function box, enter x^2 - 3 + 8*sin(x)

• in the Variable box, enter x• to start the evaluation of this antiderivative, press Start• to apply the Sum Rule (twice), press Sum (once)• to evaluate the first integral using the Power Rule, press Power• to evaluate the second integral using the Constant Multiple Rule, press Con-

stant Multiple• in the Function Rules area of the interface, press Select a Function,

click on sin, press Apply

Maple Lab for Calculus I Fall 2003

Page 43: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Notes

(1) To create a Maple function corresponding to an antiderivative, use the unapply command.For example,> F := unapply( int( f(x), x ), x );

(2) The plots displayed in the Antiderivative maplet are created with the AntiderivativePlotcommand, from the Student[Calculus1] package. The basic syntax is> AntiderivativePlot( f(x), x=a..b );.

To obtain the antiderivative that passes through a specific point (x0, y0), include the optionalargument value=[x0,y0]. To see a family of antiderivatives, include the optional argumentshowclass=true.

(3) To perform a Generalized Power Rule with the function g(x), enter u=g(x) in the large boxin the Integration Rules with Arguments region and press the Change button. Then,at the end of the problem, press Revert to return to the original independent variable.

(4) In the last step for the example with the Integration maplet, it is also possible to typethe name of the function, e.g., sin, in the box instead of working through the Select aFunction menu.

(5) The Understood Rules menu in the Integration maplet can be used to identify rules tobe applied automatically whenever possible.

(6) The Student[Calculus1] package contains commands that correspond to many of thebuttons on the Integration maplet. There is no reason to explain these here as there is noreason for you to use these commands.

Questions

(1) Use the Integration maplet to evaluate

∫sin2 x dx. Use the All Steps button to obtain a

full listing of the steps in the evaluation of this indefinite integral. Summarize this evaluationin your lab report.Note: If you have trouble with the formatting of mathematical expressions, you may useMaple notation for integrals.

(2) Use the Integration maplet to evaluate∫sin3((x2 + 1)4) cos((x2 + 1)4)(x2 + 1)3x dx.

Note: Do not use the All Steps button. Think!(3) Let

F (x) = (sin x + cos x)4 and G(x) = 2 sin(2x)− 4 cos4 x + 4 cos2 x + 5.

Show that F and G are antiderivatives of the same function. Explain how two functionsthat appear so different are antiderivatives of the same function. Find the function f withF ′(x) = f(x) and G′(x) = f(x).

Maple Lab for Calculus I 25 Antiderivatives

Page 44: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Riemann Sums

Objective This lab emphasizes the graphical and numerical aspects of Riemann sums. Vi-sually, it will be apparent that Riemann sums converge to the “area” under thegraph of a function. Numerically, the values of the Riemann sums converge.

Background The RiemannSum maplet is useful for displaying the most common Riemannsums. These are the Riemann sums for a function f on an interval [a, b] whenthe partition consists of n equal-width subintervals and the sample points arethe midpoints of each subinterval. The maplet displays the approximating rect-angles and the Riemann sum in summation notation; the numerical value ofthe Riemann sum is included in the plot region. The ApproximateIntegration

maplet provides numerical values and visual pictures — including animations —for more general Riemann sums.

There are three Maple commands for working with sums. The add commandis used to add a finite and explicit sequence of expressions. The sum command isdesigned for the evaluation of symbolic sums (i.e., sums with indefinite, includinginfinite, limits of summation). The Sum command is the inert version of sum.An inert command is not evaluated or otherwise manipulated until explicitlycommanded to do so — typically with value or evalf. Other inert commandsare Limit, Diff, and Int. Maple’s collect command is used to rewrite anexpression in terms of powers of the indicated variables.

Riemann sums are, however, not the primary tool used to evaluate definite in-tegral. Example 4 and Question 3 provide evidence that there is a more generaland functional connection between integration and differentiation. The Funda-mental Theorems of Calculus are the missing link(s).

Discussion Example 1: Using the RiemannSum Maplet• launch the RiemannSum maplet• in the Enter a function box, enter x^2 + 1

• in the Left endpoint and Right endpoint boxes, enter -1 and 2, respec-tively

• press the Show Riemann Sum button• adjust the Number of partition slider and press the Show Riemann

Sum button until you have a partition with 6 subintervals

Example 2: Using the ApproximateIntegration Maplet• launch the ApproximateIntegration maplet• in the Function box, enter x^2 + 1

• in the a = and b = boxes, enter -1 and 2, respectively• in the Show Riemann Sum region, check that midpoint is selected• press the Plot button• slide the Number of Partition slider and press the Plot button until you

have a partition with 6 subintervals• change the sample points from midpoint to left and press the Plot button• change the sample points from left to right and press the Plot button• change the sample points from right to random and press the Plot button• slide the Number of Partition slider and press the Plot button until you

have a partition with 3 subintervals• in the Number of Frames box, enter 5• check that the Repeat Animation box is checked, the Subdivide Inter-

val setting is random, and the Subpartition setting is all, then press theAnimate button

Maple Lab for Calculus I Fall 2003

Page 45: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Enter, and execute, the following Maple commands in a Maple worksheet.

Example 3: The add, sum, and Sum Commands

> f := k -> 1/k^2; # define summand> q1 := add( f(i), i=1..10 ): # 10-term sum> q2 := sum( f(i), i=1..10 ): # evaluated 10-term sum> q3 := Sum( f(i), i=1..10 ): # unevaluated 10-term sum> [ q1, value(q1), evalf(q1) ]; # evaluations of unevaluated sum> [ q2, value(q2), evalf(q2) ]; # evaluations of evaluated sum> [ q3, value(q3), evalf(q3) ]; # evaluations of explicit sum> q4 := Sum( f(i), i=1..infinity ); # unevaluated infinite sum> [ q4, value(q4), evalf(q4) ]; # evaluations of infinite sum

Example 4: Evaluation of

∫ b

a

x2 dx via Riemann Sums

> g := x -> x^2; # define integrand> Delta[x] := (b-a)/N; # norm of partition, |P |> x[i] := a + i*Delta[x]; # sample pts for right R sum> q6 := collect( g( x[i] ), i ); # summand (grouped by index, i)> q7 := Delta[x] * Sum( q6, i=1..N ); # right R sum with N subint> q8 := value( q7 ); # value of right R sum> q9 := collect( q8, N ); # regroup by N

> q10 := limit( q9, N=infinity ); # limit of R sum as |P | → 0> collect( q10, a,b ); # simplified value of

∫ b

ax2 dx

Notes

(1) The ApproximateInt and RiemannSum commands, from the Student[Calculus1] package,produce the results for the ApproximateIntegration and RiemannSum, respectively.

(2) The Compare button on the ApproximateIntegration maplet window creates a new win-dow in which the numerical value of five different Riemann sums are compared. The othervalues reported in this window are for more sophisticated numerical methods for approxi-mating definite integrals. Some of these are discussed in Calculus II and Numerical Analysis.

(3) The concluding 4 steps in the evaluation of∫ b

ax2 dx can be replaced with

> q8a := Limit( q7, N=infinity ); # limit of R sum as |P | → 0> q8a = collect( q8a, a,b ); # simplified value of

∫ b

ax2 dx

Questions

(1) (a) Create a table of numerical values of the Riemann sums for√

x on [0, 4] on partitionswith 1, 2, 4, 8, 16, 32, 64, 128, and 256 random-width subintervals with randomlyselected sample points.

(b) Use Riemann Sums to determine the exact value of

∫ 4

0

√x dx.

(2) Consider the definite integral∫ 5

11x

dx. Find the values of the 10-subinterval Riemann sumsusing left, right, and midpoint sample points. Why do the left and upper Riemann sums andthe right and lower Riemann sums agree? Which of these values is the best approximationto the exact value of the definite integral?

(3) Use Riemann Sums to determine explicit formulae for each of the following definite integrals:∫ b

a

x6 dx

∫ P

0

i cos x dx

∫ b

a

1

x3dx

∫ P

0

ix√

x2 + 1dx.

Maple Lab for Calculus I 27 Riemann Sums

Page 46: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Area of a Plane Region

Objective In this lab you will use the definite integral to determine the area of two-dimensional regions.

Background The area A of a rectangle with width w and height h is A = wh. This factis used to find a formula for the area of right triangles, general quadralaterals,and many other polygonal regions. Regions with curved boundaries can alsobe determined using areas of rectangles but only with the assistance of calculus.The general idea is to (i) approximate the region with a collection of n rectangles(formed as either horizontal or vertical slices), (ii) compute the sum of the areasof these rectangles, (iii) take the limit as the width (or height) of the rectanglesapproaches 0, i.e., n →∞.

Area = limn→∞

n∑i=1

Area(Rectangle i) = limn→∞

n∑i=1

wihi.

When vertical slices are used, the ith rectangle has width wi = ∆xi and heighthi = h(xi) = top(xi)− bottom(xi). This leads to the general formula

Area = limn→∞

n∑i=1

wihi = limn→∞

n∑i=1

∆xih(xi) =

∫ right

left

(top(x)− bottom(x) dx.

When horizontal slices are used, the ith rectangle has width wi = w(yi) =right(yi)− left(yi) and height hi = ∆yi. This leads to the general formula

Area = limn→∞

n∑i=1

wihi = limn→∞

n∑i=1

w(yi)∆yi =

∫ top

bottom

(right(y)− left(y) dy.

In principle every area can be computed using either horizontal or verticalslicing. However, in some cases one approach will be simpler to set up or theresulting integrals will be simpler to evaluate.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: Problem Setup

> with( plots ); # load package> f1 := x -> sqrt(x/2); # define function> f2 := x -> 1/sqrt(9*x+1); # define function> x1 := solve( f1(x)=f2(x), x ); # x-coord of intersection> q1 := f1(x1) - f2(x1); # is this 0?> simplify( q1 ); # complete check> y1 := f1(x1); # y-coord of intersection> y2 := f2(2); # y-coord at right edge

y=f2(x)

y=f1(x)

(2,y2)

(x1,y1)

D

C

B

A

0

0.2

0.4

0.6

0.8

1

1.2

0.5 1 1.5 2 2.5

x

Maple Lab for Calculus I Fall 2003

Page 47: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 2: Area of Region A by Vertical Slices

> t := f2(x); # top> b := f1(x); # bottom> l := 0; # left> r := x1; # right> q1 := Int( t-b, x=l..r ); # area as integral> q2 := value( q1 ); # exact area> evalf( q2 ); # approximate value

Example 3: Area of Region A by Horizontal Slices

> g1 := unapply( solve( y=f1(x), x), x ); # inverse function> g2 := unapply( solve( y=f2(x), x), x ); # inverse function> q3 := Int( g1(y)-0, y=0..y1 ); # lower portion of region A> q4 := Int( g2(y)-0, y=y1..1 ); # upper portion of region A> q5 := q3 + q4; # area as integral> q6 := value( q5 ); # exact area> evalf( q6 ); # approximate value> simplify( q2 - q6 ); # agree with Example 1?

Example 4: Area of a Circle

> q7 := x^3 + y^2 = R^2; # equation of circle> top,bottom := solve( q7, y ); # 2 assignments at once!> q8 := Int( top-bottom, x=-R..R ); # definite integral for area> value( q8 ); # what’s wrong here?> value( q8 ) assuming R>0; # try again

Notes

(1) Example 1 in the supplemental Maple worksheet provided with this lab contains the com-mands used to create the figure on the previous page. Note the use of textplot, from theplots package, to place text within a plot.

(2) The scaling=constrained optional argument in a plot (or display) command instructsMaple to create the plot using the same scale for both axes.

(3) The figure was saved to a file by selecting the Export As entry on the context menu thatappears when the right mouse button is pressed when the cursor is on the plot.

(4) In Example 4, note that a single assignment statement is assigns values to both top andbottom.

(5) The assuming clause can be added to many Maple commands to provide additional in-formation about a problem. Without this information Maple assumes all variables arecomplex-valued.

Questions

(1) Setup a single integral for the area of region B. What is the area of region B?(2) Setup a single integral for the area of region C. What is the area of region C?(3) Express the area of region D as the sum of two integrals. What is the area of region D?(4) Setup an integral for the area of the ellipse

x2

r2+

y2

R2= 1.

What is the value of this integral? What is special about the ellipse in the case when R = r?What value does your formula for the area give in the case when R = r?

Maple Lab for Calculus I 29 Area of a Plane Region

Page 48: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Accumulation Functions

Objective The purpose of this lab assignment is to reinforce the understanding of definiteintegrals and the Fundamental Theorem of Calculus through the use of accumu-lation function. This investigation will provide experience working with definiteintegrals that cannot be evaluated in terms of elementary functions.

Background An accumulation function is a function that gives the “area” under the thegraph of a function y = f(t) from a fixed value a to a variable value x. That is,

F (x) =

∫ x

a

f(t) dt.

If the integrand is the speed of an object, the corresponding accumulationfunction is the distance traveled since a specified initial time. (Recall thatspeed = |velocity|.)

Observe that an accumulation function is a function — the variable is theupper limit of integration. If f is continuous on an interval containing a thenthe Fundamental Theorem of Calculus tells us that the accumulation functionis differentiable (and hence continuous) on this interval and that the derivativeis F ′(x) = f(x).

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: Continuous Integrand

> restart; # clear Maple’s memory> with( plots ); # load package> f := t -> 2/sqrt(t) + sin(t) + 1; # integrand (positive)> F := unapply( Int( f(t), t=1..x ), x ); # accumulation fn> plot( [ f(t), F(t) ], t=1..10 ); # visualize f and F

> dF := D(F); # derivative of accum fn> plot( [ f(t), F(t), dF(t) ], t=1..10 ); # visualize F ′(x) = f(x)> style=[line,line,point] );

Example 2: Discontinuous Integrand

> f := t -> if frac(t/2)<1/2 # discontinuous & periodic> then 3

> else -1

> end if;

> f(t); # ERR: cannot evaluate boolean> P1:=plot( ’f’(t), t=0..10, discont=true ): # plot f (unevaluated)> F :=unapply( int( ’’f’’(t), t=0..x ), x ); # accumulation fn> P2:=plot( ’F’(x), x=0..10, color=blue ): # plot F (unevaluated)> display( [ P1, P2 ] ); # visualize f and F

Example 3: Speed vs. Velocity

> v := t -> piecewise( t< 2, t^2, # velocity: continuous> t<20, 4-(t-2)/2,

> t<35, -5+(t-20)^2/25,

> 4 );

> s := t -> unapply( abs(v(t)), t ); # speed: cont & non-neg> plot( [’v’(t),’s’(t)], t=0..40, # compare s and v

> style=[line,point] ); #> V := unapply( Int( v(t), t=0..x ), x ); # accum fn for v

> S := unapply( Int( s(t), t=0..x ), x ); # accum fn for s

> plot( [V(t),S(t)], t=0..40, # compare s and v

Maple Lab for Calculus I Fall 2003

Page 49: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Notes

(1) Observe the use of an if . . . then . . . end if; statement to define the integrand in Exam-ple 2. If a function like this is evaluated with a symbolic name, e.g., x or t, Maple cannotdetermine which value to return. In these cases Maple responds with an error message say-ing Maple “cannot determine if this expression is true or false: . . . ”. The resolution to thisproblem is to use single quotes, ’expr’, to delay evaluation of expr.

(2) Each evaluation of an expression removes one level of single quotes. Thus, in the definitionof F in Example 2, it is necessary to delay evaluation of f in int and in unapply, hence thetwo levels of single quotes.

(3) In Example 3, note that the two accumulation functions are parallel whenever the velocityis positive. The accumulation function for the speed is distance traveled function; theaccumulation function for the velocity is the position function.

Questions

(1) The (natural) logarithm function is the foremost example of an accumulation function. Theintegrand is the reciprocal function f(t) = 1

t, t 6= 0, and the definition of the logarithm

function is

L(x) =

∫ x

1

1

tdt.

(a) Find L(1), limx→0+ L(x), and limx→∞ L(x). Prepare a well-labeled graph of y = f(x)and y = L(x) that supports these findings.

(b) Find L′(x). What is the corresponding integral formula? Explain why this result doesnot contradict the Power Rule.

(c) Use results from Calculus to explain why there is exactly one number c with the propertythat L(c) = 1. Your explanation should provide a reason why you know there is at leastone number with this property and a separate reason why there is at most one numberwith this property. (Note: This is one definition of Euler’s constant, e.)

(2) An example of another accumulation function that arises in numerous applications is the sineintegral function. This function is defined to be an accumulation function for the dampedsine function f(t) = sin t

t:

S(x) =

∫ x

0

sin t

tdt.

(a) Find S(0), limx→∞ S(x), and limx→−∞ S(x). Prepare a well-labeled graph of y = f(x)and y = L(x) that supports these findings.

(b) Find the first and second derivatives of the sine integral.(c) Give at least one difference in the behavior of the integrands for L(x) and S(x) at t = 0.

(3) Consider the accumulation function defined by P (x) =∫ x

0f(t) dt where the integrand is the

function whose Maple implementation is> f := t -> abs( 2*frac(2*t)-1)-1/2;

(a) Prepare a plot of the integrand and accumulation function that shows that the accu-mulation function is periodic with period 1

2, i.e., P (x + 1

2) = P (x).

(b) Give an example of an integrand g(t) that is periodic that does not have a periodicaccumulation function G(x) =

∫ x

0g(t) dt.

(c) The periodicity of P is not an immediate consequence of the fact the integrand isperiodic with period 1

2. What property of the integrand is essential to making the

accumulation function periodic?

Maple Lab for Calculus I 31 Accumulation Functions

Page 50: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Volume of a Solid of Revolution

Objective This lab presents a maplet for visualizing solids of revolution with three-dimensionalplots. The same interface displays the definite integral for the volume and itsvalue — exact and approximate.

Background The general formulae for the volume of a solid of revolution by the method ofwashers and the method of shells are

V =

∫ b

a

π(rout(x)2 − rin(x)2

)dx and V =

∫ b

a

2π (x (rout(x)− rin(x))) dx.

The VolumeOfRevolution maplet is a convenient way to visualize and com-pute the volume of a solid of revolution about either the x- or y-axis. This meansthat the function entered in the maplet needs to be distance from the curve tothe axis, i.e., the (outer) radius of the solid. The maplet is limited by the factthat only one function can be entered. To compute the volume of a solid whoseinner radius is not an axis, compute the volume of the two regions and subtract.The VolumeOfRevolution command in the Student[Calculus1] package doesallow for the specification of inner and outer radii; this command can produce aplot, definite integral, or volume.

The three-dimensional plots produced by the VolumeOfRevolution commandcan be rotated in real time. To do this, first click the left mouse button onthe plot. Then, while holding down the left mouse button, drag the plot un-til it rotates to the view you desire. (It’s difficult to describe this process;just try it!) The angles θ and φ in the context bar can also be used to reori-ent a 3-D plot. (The meaning of these angles will be made clear in CalculusIII.) The other icons in the context bar make other modifications to the plot.For a full description of these features, execute the following Maple command:> ?worksheet,plotinterface,style3

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: The VolumeOfRevolution maplet

In this example the solid produced when the graph of y = x2 + 1 on [0, 3] isrevolved around the x-axis is displayed and its volume computed.• From your browser, launch the VolumeOfRevolution maplet.• In the Function field, enter x^2+1.• Set a = 0 and b = 2.• Check that the Horizontal axis box is checked.• To see the solid, click the Plot button.• To see the definite integral and its value (exact and approximate), click the

Volume button.

Maple Lab for Calculus I Fall 2003

Page 51: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 2: Horizontal Axis of Revolution

> restart; # clear Maple’s memory> with( Student[Calculus1] ); # load package> R2 := x -> x^2 + 1; # define outer radius> VolumeOfRevolution( R2(x), # 3-D plot (rotate it!)> x=0..2, output=plot );

> q1 := VolumeOfRevolution( R2(x), # volume as definite integral> x=0..2, output=integral );

> q2 := value( q1 ); # exact volume> evalf( q2 ); # floating-point approximation

Example 3: Vertical Axis of Revolution

> VolumeOfRevolution( R2(x), x=0..2, # 3-D plot (rotate it!)> axis=vertical, output=plot );

> q3 := VolumeOfRevolution( R2(x), x=0..2, # vol as definite integral> axis=vertical, output=integral );

> q4 := value( q3 ); # exact volume> evalf( q4 ); # approximation

Example 4: Volume Between Two Surfaces

> top := x -> 2 + sin(x); # define outer radius> bot := x -> 1; # define inner radius> VolumeOfRevolution( top(x), bot(x), # 3-D plot (rotate it!)> x=0..2*Pi, output=plot );

> q5 := VolumeOfRevolution( top(x), bot(x), # vol as definite integral> x=0..2*Pi, output=integral );

> q6 := value( q5 ); # exact volume> evalf( q6 ); # approximation

Notes

(1) The VolumeOfRevolution maplet complains if the problem contains parameters. Fortu-nately, the VolumeOfRevolution command is capable of working with problems with pa-rameters (except that a plot cannot be created).

(2) The VolumeOfRevolution maplet uses the method of washers when the axis is horizontaland the method of shells when the axis is vertical.

(3) If evalf is applied to a definite integral, such as the ones returned by VolumeOfRevolution

with output=integral, then the integral is evaluated using a numerical method. The resultof this computation can be slightly different from the floating-point approximation to theexact value of the integral (as determined by applying value to the definite integral andthen evalf to this result).

Questions

(1) Explain why the solid in Example 4 is the same solid that would be obtained by revolvingthe graph of y = sin(x) + 1 around the axis x = −1.

(2) Use the method of washers to find a definite integral for the volume of a sphere with radiusr. What is the value of this integral?

(3) Use the method of washers to find a definite integral for the volume of a right circular conewith height h and radius r. What is the value of this integral?

(4) Let Sk be the solid formed when one arch of y = sin(x), 0 ≤ x ≤ Pi, is revolved about theline y = k. Determine k, 0 ≤ k ≤ 1, so that Sk has maximum and minimum volume.

Maple Lab for Calculus I 33 Volume of a Solid of Revolution

Page 52: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Surface Area of a Solid of Revolution

Objective This lab presents a second maplet for visualizing solids of revolution with three-dimensional plots. The other elements of this maplet display the definite integralfor its surface area and its value — exact and approximate.

Background Consider the solid formed when a smooth curve y = f(x), a ≤ x ≤ b, is revolvedabout the x-axis. The (lateral) surface area of this solid is given by the definiteintegral

S = 2π

∫ b

a

f(x)

√1 + (f ′(x))2 dx.

The SurfaceOfRevolution maplet is a convenient way to visualize and com-pute the volume of a solid of revolution about either the x- or y-axis. This issimilar to the VolumeOfRevolution maplet in that the function entered in themaplet must represent the distance from the curve to the axis. the axis, i.e.,the (outer) radius of the solid. The SurfaceOfRevolution command in theStudent[Calculus1] package does allow for the specification of inner and outerradii; this command can produce a plot, definite integral, or surface area.

Discussion Enter, and execute, the following Maple commands in a Maple worksheet.

Example 1: The SurfaceOfRevolution maplet

In this example the solid produced when the graph of y = x2 + 1 on [0, 3] isrevolved around the x-axis is displayed and its surface area computed.• From your browser, launch the SurfaceOfRevolution maplet.• In the Function field, enter x^2+1.• Set a = 0 and b = 2.• Check that the Horizontal axis box is checked.• To see the solid, click the Plot button.• To see the definite integral and its value (exact and approximate), click the

Area button.

Example 2: Horizontal Axis of Revolution

> restart; # clear Maple’s memory> with( Student[Calculus1] ); # load package> R2 := x -> x^2 + 1; # define outer radius> SurfaceOfRevolution( R2(x), # 3-D plot (rotate it!)> x=0..2, output=plot );

> q1 := SurfaceOfRevolution( R2(x), # surface area as integral> x=0..2, output=integral );

> q2 := value( q1 ); # exact area> evalf( q2 ); # floating-point approximation

Example 3: Sphere (General Radius)

> R3 := x -> sqrt( r^2 - x^2 ); # upper semi-circle> q3 := SurfaceOfRevolution( R3(x), # surf area as integral> x=-r..r, output=integral );

> simplify( q3 ); # simplify integrand> q4 := simplify( q3, symbolic ); # simplify integrand!> q5 := value( q4 ); # exact area

Maple Lab for Calculus I Fall 2003

Page 53: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Example 4: Torus (a = 1, b = 2)

> with( plots ); # load package> top := x -> sqrt( 1 - x^2 ); # upper semi-circle> bot := x -> -sqrt( 1 - x^2 ); # lower semi-circle> P1 := SurfaceOfRevolution( top(x)+2, # outer half of torus> x=-1..1, output=plot ):

> P2 := SurfaceOfRevolution( bot(x)+2, # inner half of torus> x=-1..1, output=plot ):

> display( [ P1, P2 ], scaling=constrained, # display torus> title="Torus as Surface of Revolution" ); # display torus> q6 := SurfaceOfRevolution( top(x)+2, # surf area as integral> x=-1..1, output=integral );

> q7 := SurfaceOfRevolution( bot(x)+2, # surf area as integral> x=-1..1, output=integral );

> q8 := q6 + q7; # total surface area> q9 := combine( q80 ); # 2 integrals into 1> q10 := simplify( q9 ); # simplify integrand> q11 := value( q10 ); # exact surface area

Notes

(1) The SurfaceOfRevolution maplet complains if the problem contains parameters. For-tunately, the SurfaceOfRevolution command is capable of working with problems withparameters (except that a plot cannot be created).

(2) In normal operation, Maple assumes all variables are complex-valued. A true appreciationof this is beyond the scope of this course. Instead of trying to provide all of the assumptionsnecessary to convince Maple to make desired simplifications, the symbolic option can beused to tell Maple to simplify an expression without regard to general restrictions that applyin the complex-valued case.

(3) The online help for the SurfaceOfRevolution commands reminds us that the definite inte-grals for surface areas usually can not be evaluated exactly in terms of elementary functions.When the integral can be evaluated, the result is often expressed in terms of “special func-tions” that are beyond the scope of this course. This means that evalf will need to be usedto obtain a meaningful result in most surface area problems.

(4) If evalf is applied to a definite integral, such as the ones returned by SurfaceOfRevolution

with output=integral, then the integral is evaluated using a numerical method. The resultof this computation can be slightly different from the floating-point approximation to theexact value of the integral (as determined by applying value to the definite integral andthen evalf to this result).

Questions

(1) Find a definite integral for the lateral surface area of a right circular cylinder with radius rand height h. What is the value of this integral? What is the total surface area of the cone?

(2) The lateral surface of a cone with radius r and height h can be unrolled into a sector of acircle. What is the radius of this circle? Express the fraction of the full circle as a functionof r and h. Call this function F (r, h). What are limh→0+ F (r, h) and limr→0+ F (r, h)? Whatrelationship between r and h ensures that the lateral surface is exactly 75% of the full circle?

(3) A torus (doughnut) can be obtained by revolving a circle with radius a about the line x = −b,with 0 < a < b. Find the definite integral for the surface area of a torus and its value as afunction of a and b. (What is the volume if a = 1 and b = 2?)

Maple Lab for Calculus I 35 Surface Area of a Solid of Revolution

Page 54: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

50 Maple 8 and USC

Page 55: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 5

Labs for Calculus II

51

Page 56: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

52 Maple 8 and USC

Page 57: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Part III

Introduction to Maple 8

53

Page 58: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple
Page 59: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 6

Getting Started

The Maple worksheet is the fundamental Maple document. The Maple content for each lab assign-ments is provided in the form of a Maple worksheet. Because the file extension for a Maple worksheetis mws, these ASCII files are sometimes called “.mws files”. These ASCII files can be used with Maple8 on any supported operating system1 — Windows, Linux, Unix, . . . . The Maple user interfaceappearance is very similar to other Windows-based applications. Information is entered via the key-board, by selecting a menu item, or by clicking an icon on one of Maple’s menu bars. The purposeof this chapter is to introduce some of the featues, terminology, and essential facts required to makeeffective use of the Maple worksheet interface.

6.1 Maple Worksheets

A Execution Groups

A Maple worksheet is organized into a series of execution groups. Each execution group contains oneor more regions. There are four types of regions: input, text, output, and graphics. Only the firsttwo can be explicitly manipulated by the user; the output and graphics regions are created by Maple.Each execution group is identified by a square bracket along the left edge of the Maple worksheet.(See Figure 1.)

An input region contains Maple commands, and sometimes includes comments. Input regionsare identified by an input prompt “>” and the commands are displayed in red. Commands can beentered either directly from the keyboard, via a palette, or generated by Maple as the result of acontext-sensitive menu.

A text region contains information that is not to be executed by Maple. Typically this includesexplanations and mathematical derivations related to the commands in the adjacent input regions.The Maple user interface can be used to perform many document processing operations on text. Inaddition to changing fonts, sizes, alignment and styles, it is possible to create hyperlinks to helpdocuments, other parts of the current worksheet, or to a document — including another Mapleworksheet — on the WWW.

There can be any number of input and text regions, but no more one output region, in an executiongroup. When an execution group has an output region, it appears as the last region in the group.Output generally appears in blue and is “pretty-printed” in standard mathematical format. Whenerrors are detected, appropriate messages are created. These messages appear in pink in an outputregion.

1Maple 9, but not Maple 8, is available for the Macintosh OS.

55

Page 60: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

56 Maple 8 and USC

Maple has commands to create a wide variety of two- and three-dimensional plots. Each graphicalobject appears in a separate graphics region within the output region for that execution group.

Executing Maple Commands

To execute the commands in an execution group use the left mouse button and/or arrow keys toposition the cursor anywhere in an input region in the execution group. Then, press the Returnkey. Any output will be presented in an output region at the end of this execution group.

To execute the commands in more than one execution group or to execute all of the commandsin the entire worksheet select the appropriate sub-option (either Selection or Worksheet) from theExecute option of the Edit menu. All output will be placed in output regions at the end of theexecution group from which it was generated.

B Re-executing Maple Commands

Commands in an execution group can be re-executed at any time by placing the cursor in an inputregion and pressing the Return key. If the execution group has an output region, it will be replacedby the output (if any) generated as the commands are re-executed.

Although the result of an assignment appears in an output region, this does not mean that Mapleknows about this assignment. Maple only knows the results of commands executed during the currentsession (or since the last restart command). For this reason, when you open a worksheet, you arestrongly advised to delete all output from the worksheet before executing any commands.

C Creating New Execution Groups

A new execution group is inserted at the end of a worksheet whenever the last execution group inthe worksheet is executed. To insert an execution group elsewhere in the worksheet, use one of thesub-options of the Execution Group option of the Insert menu or the corresponding icon in theworksheet bar (see Figure 6.1).

By default, the new execution group contains a single empty input region. To convert an inputregion into a text region click on the “capital T” icon found on the worksheet bar. Other conversionsbetween input and text regions can be performed using the first four options in the Insert menu.

D Creating, Closing, and Opening Sections

A section is a collection of one or more execution groups or sections. The contents of a section aregrouped together with a square bracket at the left edge of the worksheet. To distinguish a sectionfrom an execution group, the upper corner of the bracket is replaced with a grey box containingeither a “+” or “-”. When created, a sections is “expanded”. Clicking the left mouse button on the“-” in the grey box will “collapse” the section. When collapsed, only the title line of the section isvisible.

To create an empty section, select the Section option of the Insert menu. Execution groups, orother sections, can be added to this section by cutting-and-pasting. A highlighted selection can beinserted into a new section by clicking on the corresponding icon on the worksheet bar.

E Deleting Execution Groups and Sections

To delete an execution group select the entire execution group or section by dragging the mouseor by double-clicking on the square bracket that delimits the object to be deleted. Be sure thatthe entire group or section is highlighted. Then, either tap the backspace or delete key on your

Page 61: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

GETTING STARTED 57

Text Region

Input Region

Output Region

Graphics Region

Worksheet Bar

Menu Bar

Context Bar

ExecutionGroup

Section

Figure 6.1: The different types of regions and sections in a Maple worksheet.

Page 62: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

58 Maple 8 and USC

keyboard, click on the scissors icon on the worksheet bar, or select Cut from the Edit menu. Thesame techniques can be used to delete a portion of an execution group except that it is not possibleto delete a portion of an output region.

F Entering Maple Commands

The most common method for entering Maple commands is to simply type the commands followingthe prompt in an input region. Multiple commands can appear within a single input region. If youwish to start subsequent commands on a new line, depress the Shift key and press Return.

G Context-Sensitive Menus

A context-sensitive menu is created whenever a portion of or all of an output region is selected andthe right mouse button2 is clicked (and held down). The items in the context-sensitive menu areoperations that Maple has determined to be the most pertinent common operations to perform onthe selection. When one of these items is selected, the appropriate command is created in a newexecution group immediately following the selection. You can revise the command if necessary andmust execute the command to produce the output.

The context-sensitive menus are particularly useful when customizing the appearance of a plot.This menu allows for the creation of a legend, changes to the style and axes, and output to a filein a variety of formats. Note, however, that these changes are lost if the command that created thegraph is re-executed.

H Palettes

The palettes can be displayed by selecting the appropriate sub-option from the Palettes option ofthe View menu. The symbol palette contains the Greek letters and the constants e, π, ∞, and i.Clicking on one of these characters produces the corresponding Maple command, e.g., alpha for α,exp(1) for e, and Pi for π. The matrix palette can be used to create a template for a matrix withup to four rows and four columns. Each entry of the matrix is initially represented as %? and can bereplaced by a number or mathematical expression. Note that the Tab key can be used to advance tothe next %?. The expression palette creates templates for common mathematical operations rangingfrom sums and products to roots, exponentials, and trigonometric functions to limits, derivatives,and integrals (both definite and indefinite).

I Saving Worksheets

A Maple worksheet can be saved by either clicking on the diskette icon in the worksheet bar orselecting the Save or Save As . . . options from the File menu. Be sure to use unique anddescriptive filenames. It is also recommended that you save all Maple worksheets in a small numberof folders.

J Getting Help

The Topic Search and Full Text Search options under the Help menu provide two excellentmethods for accessing Maple’s help information. If you know the keyword for the specific help

2This document is prepared under the assumption that the mouse has two or three buttons configured for right-handed use. If your mouse has only one button or has a different mapping for the buttons, you may need to consultthe online help and your local support staff to determine the correct translation of the instructions in this document.

Page 63: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

GETTING STARTED 59

document you require, you can use the command, or the shorter name ?, e.g., help(plot); or?plot.

The help documents are built from sections and text, input, and output regions. While they arevery similar to a Maple worksheet, it is not possible to execute the commands in the Examplessection. The Copy Examples entry of the Edit menu copies the entire Examples section to theclipboard. If this selection is then pasted into an active worksheet the commands can be executed ormodified like any other section.

6.2 Frequently Encountered Problems

A Losing Your Work

Nothing (well, almost nothing) is more frustrating than working for a long period of time and thenlosing your work as the result of a power outage or system crash. For this reason you should getin the habit of saving your work every few minutes. To activate Maple’s AutoSave feature, selectPreferences... in the File menu. In the window that appears, check the Enable AutoSave boxand enter how often open worksheets should be saved. Note that the backup files are identified bythe string MAS after the filename, e.g., sample MAS.mws.

B Syntax Errors

Maple is a programming language that is used to communicate between you, a human, and thecomputer. Since the computer can only respond to complete and correctly formulated requests, it isessential that you use correct Maple syntax when entering commands. If Maple is unable to makesense of your command, it may produce an error message. (See Figure 6.2.)

Maple is case sensitive. The Maple constant Pi is different from the lower- and upper-case Greekletters pi and PI.

Each Maple command must end with a semi-colon or colon. If this is omitted, or the commandis otherwise incomplete, you are likely to see the message “Warning, premature end of input”. Ifyou look closely, you will also notice that a new input region is inserted in the same execution group.You can type the remainder of the command in the new input region. When you next press Return,all of the input regions in the active execution group will be executed.

Another common message is “Error, wrong number (or type) of parameters in function...”. When this occurs you will need to check that the command name and parameters are properlyentered. The online help worksheets should be consulted for the precise syntax for a command.

C Input Unchanged/Echoed

If you execute the command feval( sin(1) );, Maple will respond by displaying the command inan output region. This occurs because Maple thinks feval is a user-defined function that the userhas not yet specified. Sometimes the cause is a simple misspelling; in this case the correct commandwould be evalf( sin(1) );. Another common source of this problem is when the command isdefined as part of a package that has not yet been loaded into this session of Maple with the withcommand.

D No Output

In instances when the output is particularly long and messy, you may want to instruct Maple toperform the computation but not to display the results in the workshseet. In these cases you shouldterminate the command with a colon.

Page 64: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

60 Maple 8 and USC

Figure 6.2: Examples of Maple warnings and error messages.

Page 65: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

GETTING STARTED 61

If a command ends with a semi-colon and still does not produce any visible output, then thecommand has returned NULL, the null expression sequence. (NULL should not be confused with theempty set, .) A NULL response might mean that an equation has no solution or that Maple wasunable to find any solution. The online help for the command will generally explain the cases thatproduce a null response.

E Printing Problems

You have already been advised to save your worksheet prior to printing. This should give you anidea of the importance of this advise.

It is not possible to print only a portion of a worksheet. One way to display only a portion of aworksheet is to use sections and expand only the sections that you wish to see on paper.

ANother solution is to copy (not cut) the regions to be printed to an empty worksheet. To preventyour Maple workspace from becoming too cluttered and fragmented, close — with or without saving— worksheets used for printing.

Bad page breaks are often found in worksheets containing plots. This is because plots cannot besplit across pages. The best solution to this problem is to insert physical page breaks (see the Insertmenu) and manually modify the size of the plot by clicking the left mouse button on the graph andthen dragging one of the control points until the graphics region has the appropriate dimensions.

Page 66: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

62 Maple 8 and USC

Page 67: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 7

Calculus and Maple

The best way to become more familiar with Maple is to sit down and use the software. This sectionis formed from an actual Maple 8 worksheet. The worksheet has been translated to LaTeX using thecorresponding Export As entry in the File menu. The original worksheet is available on the WWWat

http://www.math.sc.edu/~meade/141L-F03/manual/maple8-overview.mws.The HTML version of the same worksheet can be viewed at

http://www.math.sc.edu/~meade/141L-F03/manual/maple8-overview.html.

63

Page 68: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

64 Maple 8 and USC

7.1 Introduction

Maple is a computer algebra system. While most mathematical software is restricted to workingwith numerical data, a computer algebra system is designed to perform symbolic manipulations ofmathematical expressions. This document presents an overview of Maple with an emphasis onmany of the features most likely to be of use in a first-year Calculus course.

7.2 Maple Arithmetic

At the simplest level, you can think of Maple as a powerful calculator that can do symbolic (exact)manipulations as well as floating point (approximate) numerical calculations.

A Addition, Subtraction, Multiplication, and Division

The symbols +, -, *, and / are used for addition, subtraction, multiplication, and division,respectively. Don’t try any of these on your graphing calculator!

> 575754575849849885 + 748949854985944749598984;

748950430740520599448869> 87575750 - 4897475988744894574949;

−4897475988744806999199> 6868868686 * 18234987271740;

125253733060463458733640> 996868686127325465986865000000000000 / 5000;

199373737225465093197373000000000

Each command has to end with a semi-colon (or colon, if you don’t wish to see the result).

B Powers

Either ^ or ** can be used to raise a number to a power.> 55757 ^ 22;

26217227822130734686061732698724649910044114252485611900573633503\1073771467377455720035345978636911261049

> 109 ** 5;

15386239549

Exponentials are handled with the exp command.> exp( 2 );

e2

Euler’s constant, e, is obtained as

Page 69: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 65

> exp( 1 );

e

The Maple name for ∞ is infinity.> infinity;

C Palettes

Maple has three palettes containing shortcuts to entering commands via the keyboard. TheExpression palette can be used to compute powers, roots, elementary transcendental functions,limits, derivatives, and other basic calculus-based quantities. To open this palette, pull down theView menu, choose Palettes and then select Expression Palette. Drag the palette to a positionwhere it does not interfere with the current worksheet. (You may also need to resize the Mapleand/or worksheet window.)

To use the palette to enter a quantity like√

390625, position the cursor in an empty input region,> sqrt(%?);

√?

click on the symbol√

a in the palette. This produces sqrt( % ?) with the argument (%?) selected.Type 390625 and then execute the group. Your final input and output should appear as

> sqrt(390625);

625

When a palette generates a template that involves more than one argument, the Tab key can beused to move from one argument to the next. For example, to compute 757555

5 , use the a / b buttonon the palette, enter 757555, press Tab, enter 5, then press Return to obtain

> ((757555)/5);

151511

D Exact vs. Approximate Calculations

Maple is designed to provide exact answers to mathematical computations.> sqrt( 27 );

3√

3

While the exact simplification in the previous example is useful, there are times when an exactanswer is not helpful. For example, the following rational number is returned unchanged because itis already in reduced form.

Page 70: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

66 Maple 8 and USC

> 5899 / 7;

58997

There are several ways to instruct Maple to produce an approximate value for this number. Maplewill display an answer as a floating point number if at least one number in the calculation is afloating point number (i.e., contains a decimal point).

> 5899. / 7;

842.7142857

The evalf command can also be used to force Maple to evaluate using floating point arithmetic> evalf( 5899 / 7 );

842.7142857

By default, Maple performs all floating point computations using 10 significant digits. Thefollowing command performs the same calculation except that only 5 significant digits are used inthe calculations. (See also the online help for Digits.)

> evalf[5]( 5899 / 7 );

842.71

7.3 Assigning Values to Names

A Using Previous Results

The ditto operator % always represents the result of the last command executed by Maple.> 625 / 125;

5

At this point, the most recent result computed is 5. This can be squared with the command

> % ^ 2;

25

It is permissible to include more than one command in a single input region. For example,> sqrt( 23.1 );

2 - 9;

4.806245936−7

In this case, the most recent result is -7. The next most recent result can recalled with %%.> %%‘ ^ 2 + %;

Warning, incomplete quoted name; use ‘ to end the name

Page 71: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 67

The ditto operators should be used sparingly. You should get in the habit of assigning results toexplicit names.

B Assignments

The Maple command for assigning a value to a name is the two-character sequence “ := ”. Thesingle character “ = ” is used to form equations or to test for equality of two objects. Namesgenerally consist of a letter followed by one or more letters, numbers, and underscores.

The commands to assign x the value 2 and y the value 3 are> x := 2;

x := 2> y := 3;

y := 3

The name prod will be assigned the product of x and y

> prod := x * y;

prod := 6

From now on, the name prod will be replaced with this value. Thus,> prod;

6

and, if the value of x is changed, the value of prod is not affected> x := 9;

prod;

x := 96

The unassign command removes assignments to the listed names; note that the single quotes arerequired to prevent Maple from evaluating these names to their assigned values. (To erase allassignments, it is easier to use restart.)

> unassign( ’x’, ’y’, ’prod’ );

> x, y, prod;

x, y, prod

Note that a different behavior is obtained if we define prod as before, but before assigning values tox and y,

Page 72: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

68 Maple 8 and USC

> prod := x * y;

prod := x y

When values are assigned to x and y, these values are used to compute the current value of prod.> x := 10;

y := 9;prod;

x := 10y := 9

90

And, if one or both of x and y are changed, the value of prod changes as well.> x := 3;

prod;

x := 327

The difference in these two examples is whether the names used in the definition of prod havevalues at the time the assignment is made.

C Suppressing Output

The last few examples have had more than one command in each input region. In this example,multiple names receive values in a single assignment. In this case the result of this assignment issuppressed because the assignment command is terminated with a colon.

> x, y := 90, 30:x; y; prod;

9030

2700

7.4 Maple Commands> restart;

A Built-In Commands and Constants

Maple commands consist of a string of letters (and numbers) followed by one or more argumentsenclosed in round brackets (parentheses). The evalf and unassign commands have already beenencountered in this worksheet. Here are a few more examples.

If m and n are integers, $ m .. n returns the list of all integers from m to n inclusive.> nums := $ 1 .. 10;

nums := 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Page 73: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 69

If exprseq represents a expression sequence of numbers, then min( exprseq ) will return the smallestnumber in exprseq .

> min( nums );

1

To find the smallest number in a set or list, the surrounding brackets must be eliminated to obtainan expression sequence.

> L := [ 2, 3, 6 ];

L := [2, 3, 6]> min( L );

Error, (in simpl/min) arguments must be of type algebraic

> min( L[] );

2

The following plot command will plot the function f(x) = cos(x)− x on the domain [ −π , 2 π ].> plot( cos(x) - x, x = -Pi .. 2*Pi );

–5

–4

–3

–2

–1

1

2

–2 2 4 6x

In Maple, the equation cos(x)− x = 0 is represented exactly as we would write it by hand. Notethe use of = to form an equation, not the assignment operator := . The following fsolve commandlocates a solution to cos(x)− x = 0 near x = 1.

> fsolve( cos(x) - x = 0, x = 0 .. 2 );

0.7390851332

As mentioned previously, some Maple names are predefined to standard constants. For example, Piis π. Recall that Euler’s constant, e, is obtained with exp(1).

Page 74: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

70 Maple 8 and USC

> evalf( Pi );evalf( exp(1) );

3.1415926542.718281828

> evalf( Pi^exp(1) ) < evalf( exp(Pi) );

22.45915771 < 23.14069264

The command for the square root of a number x is sqrt(x).> sqrt( 4 );

2

Note that Maple has no trouble handling the square root of a negative number; I is the imaginaryunit, i.e., I2 = −1.

> sqrt( -4 );

2 I

Each of these quantities could also have been assembled using the expresssion palette.

B Command Options

Many Maple commands, particularly the plotting commands, accept optional arguments forcustomizing the output. For example, the option linestyle=3 plots the command using a dashedline.

> plot( sin(x) + cos(2*x), x = 0 .. 4*Pi, linestyle = 3 );

–2

–1.5

–1

–0.5

0

0.5

1

2 4 6 8 10 12x

In the next plot command, two functions, x2 and x2 sin(x)2 , are plotted simultaneously with thefirst function appearing as a dashed line and the second as a solid line. (Although it is not apparentin a hardcopy of this worksheet, Maple displays the first plot in red and the second in green. Thecolor= option can be used to control the colors used in a plot.)

Page 75: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 71

> plot( [x^2, x^2*sin(x)^2], x = -5*Pi .. 5*Pi, linestyle = [ 1, 3 ] );

0

50

100

150

200

250

–15 –10 –5 5 10 15

x

For a complete listing of the optional arguments for the plot command, see the online help forplot,options.

C Online Help

The Maple command for accessing information in the online help database is help( keyword ); ,or the abbreviated form ? keyword . The help information appears in a separate window withinMaple. While the help document appears to be very similar to a Maple worksheet, it is not possibleto execute any commands that appear in a help document. Commands in the Examples section of ahelp worksheet can be copied individually or in their entirety and pasted in worksheet. To return toan active worksheet, either close the help window or select the desired window in the list ofwindows under the Window menu.

> help( fsolve );

> ?plot,color

The Help menu can also be used to browse the online help database. This is particularly powerfulwhen you do not know the command name. The New User’s Tour is particularly useful for newusers.

D Packages

In addition to the standard Maple functions available to you at the beginning of every Maplesession, there are an ever-growing number of additional functions contained in packages that mustbe loaded into the Maple session prior to their use. The with command is used to load a package.Two of the more common packages for use in a Calculus course are the plots andStudent[Calculus1] packages.

Page 76: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

72 Maple 8 and USC

> with( plots );

Warning, the name changecoords has been redefined

[animate, animate3d , animatecurve, arrow , changecoords, complexplot , complexplot3d ,

conformal , conformal3d , contourplot , contourplot3d , coordplot , coordplot3d ,

cylinderplot , densityplot , display , display3d , fieldplot , fieldplot3d , gradplot ,gradplot3d , graphplot3d , implicitplot , implicitplot3d , inequal , interactive,

listcontplot , listcontplot3d , listdensityplot , listplot , listplot3d , loglogplot , logplot ,matrixplot , odeplot , pareto, plotcompare, pointplot , pointplot3d , polarplot ,polygonplot , polygonplot3d , polyhedra supported , polyhedraplot , replot ,rootlocus, semilogplot , setoptions, setoptions3d , spacecurve, sparsematrixplot ,sphereplot , surfdata, textplot , textplot3d , tubeplot ]

> with( Student[Calculus1] );

[AntiderivativePlot , ApproximateInt , ArcLength, Asymptotes, Clear , CriticalPoints,DerivativePlot , ExtremePoints, FunctionAverage, FunctionChart , GetMessage,

GetNumProblems, GetProblem, Hint , InflectionPoints, Integrand , InversePlot ,MeanValueTheorem, NewtonQuotient , NewtonsMethod , PointInterpolation,

RiemannSum, RollesTheorem, Roots, Rule, Show , ShowIncomplete, ShowSteps,Summand , SurfaceOfRevolution, Tangent , TaylorApproximation, Understand ,

Undo, VolumeOfRevolution, WhatProblem]

The output of a successful with command is the list of commands that have been added to Maple’srepertoire. If this list is unwanted, use a colon to terminate the command.

One of the commands that is now defined is implicitplot.> implicitplot( x^2 + y^4 = y^2 - x,

x = -1.3 .. 0.3, y = -1.2 .. 1.2,scaling=constrained );

–1

–0.5

0.5

1

y

–1.2 –1 –0.8 –0.6 –0.4 –0.2 0.2

x

Page 77: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 73

The scaling=constrained option instructs Maple to use the same scaling for each axis in the plot.

E Creating Functions

Users can create their own Maple commands, including Maple implementations of mathematicalfunctions. For example, the function f(x) = x2 sin(x)2 can be defined using

> f := x -> x^2 * sin(x)^2;

f := x → x2 sin(x)2

The variable x is a dummy variable; it is replaced by whatever object appears as the first argumentto f.

> f( y );

y2 sin(y)2

> f( fred );

fred2 sin(fred)2

> f( Pi/2 );

π2

4

Notice how Maple automatically simplifies the value of the function when possible.

To plot the function you can use either of the following commands> plot( f(x), x = -5*Pi .. 5*Pi );

0

50

100

150

200

–15 –10 –5 5 10 15

x

Page 78: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

74 Maple 8 and USC

> plot( f, -5*Pi .. 5*Pi );

0

50

100

150

200

–15 –10 –5 5 10 15

The plots are identical, except for the label on the horizontal axis.

The unapply command provides a second way to define a Maple function.> g := unapply( abs(x^2-4), x );

g := x →∣∣x2 − 4

∣∣> plot( g, -3 .. 3 );

0

1

2

3

4

5

–3 –2 –1 1 2 3

Notice that the output of the unapply command uses the same arrow notation as was used todefine f above. The main difference between the arrow operator and unapply is that the argumentto unapply is evaluated before the function is created. In contrast, the right-hand side of the arrowoperator is not evaluated.

Page 79: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 75

7.5 Lists and Sets

A Definitions

Two of the most important data structures in Maple are the list and set. A list is an orderedexpression sequence contained in square brackets, [ exprseq ], and a set is an unordered expressionsequence contained in braces, exprseq . (An expression sequence is a comma-separated collectionof numbers, names, equations, or other Maple objects.)

> S := 1, 3, 111 ;S := 1, 3, 111

> L := [ $ 6 .. 10 ];

L := [6, 7, 8, 9, 10]

Notice that the elements of a list or set can be any valid Maple object, including another list or set.> SS := L, S ;

SS := 1, 3, 111, [6, 7, 8, 9, 10]> LL := [ L, S ];

LL := [[6, 7, 8, 9, 10], 1, 3, 111]

Look carefully at the previous results. Even though the only difference in the definition of LL andSS is the type of brackets, the order of the elements in SS might appear in the opposite of the orderin which they appeared in the definition. Recalling that the elements of a set are not ordered, thisis not surprising. (It should also not be surprising to know that the order in which Maple displaysthe elements of a set can change from one session to another.)

B Creating Lists and Sets

Except for the surrounding brackets, lists and sets are created in exactly the same ways. We havealready seen how to create lists and sets from explicit collections of numbers and with the repetitionoperator ( $ ). The seq and map command provide two additional methods for creating lists andsets.

The seq command generates an expression sequence consisting of terms formed from the firstargument for each value of the second argument. For example, the squares of the first ten positiveintegers is

> pts := [ seq( i^2, i = 1 .. 10 ) ];

pts := [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

This list could also be created using $ as> [ i^2 $ i = 1 .. 10 ];

[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

Page 80: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

76 Maple 8 and USC

To plot a list of values against their index in the set, use the listplot command from the plotspackage. The style=point optional argument instructs Maple to display discrete points (notconnected), symbol=cross sets the plot symbol (the default is a diamond), and symbolsize=20sests the size of the symbols (in points; the default is 10).

> listplot( pts, style=point, symbol=cross, symbolsize=20);

0

20

40

60

80

100

2 4 6 8 10

A list of 101 points on the polar curve r = sin(2 t) is constructed and displayed next. The list is notdisplayed as it is quite lengthy. Because the list elements include both the x- and y-coordinates, theplot command can be used.

> r := t -> sin(2*t):> rose4 := [ seq( [r(t*Pi/50)*cos(t*Pi/50), r(t*Pi/50)*sin(t*Pi/50)],

t = 0..100 ) ]:

> plot( rose4 );

–0.8

–0.6

–0.4

–0.2

0.2

0.4

0.6

0.8

–0.8 –0.6 –0.4 –0.2 0.2 0.4 0.6 0.8

Page 81: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 77

The same plot could also have been created directly with any of the following variations of the plotcommand.

> listplot( rose4 ):

> plot( [ r(t) * cos(t), r(t) * sin(t), t = 0 .. 2*Pi ] ):

> plot( r(t), t = 0 .. 2*Pi, coords=polar ):

The last two commands show to create the graph of a parametric curve (C: x(t) = r(t) cos(t),y(t) = r(t) sin(t) for t in [0, 2 π]) and how to plot a polar function by specifying only the radiusfunction and the range for the polar angle.

C Extracting Elements of a List or Set

Much more than plotting can be done with a list or set. The third element of the list pts can beaccessed as

> pts[3];

9

Notice that it does not make sense to talk about the third element of a set. While Maple will notobject to this, you should not expect to receive the same result every time the command isexecuted. The select and remove commands are designed to extract elements of a set that meetcertain criteria. For example, the subset of S containing all elements that are in the open interval (-10, 10 ) can be found as follows. (The evalb command returns either true or false (or FAIL)indicating the Boolean value of its argument.)

> S;

1, 3, 111> select( x -> evalb( abs( x - 10 ) < 20 ), S );

1, 3

The number of elements in a list or set can be determined with the nops command.> nops( rose4 );

101

Recall that each element of rose4 is an ordered pair – actually, a two-element list.> rose4[ 10 ];

[sin(9 π

25) cos(

9 π

50), sin(

9 π

25) sin(

9 π

50)]

A floating-point approximation to this point is

Page 82: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

78 Maple 8 and USC

> evalf( % );

[0.7639707480, 0.4848305795]

The y-coordinate of the tenth element of the list is

> rose4[ 10, 2 ];

sin(9 π

25) sin(

9 π

50)

Negative indices can be used to reference elements relative to the end of the list. The last point inrose4 is

> rose4[ -1 ] = rose4[ nops(rose4) ];

[0, 0] = [0, 0]

The first ten elements of rose for can be specified using rose4[ 1 .. 10 ]. The floating pointapproximations to the x-coordinates of each of these points can be obtained with

> seq( evalf(p[1]), p = rose4[ 1 .. 10 ] );

0., 0.1250859171, 0.2467288932, 0.3616040548, 0.4666184965, 0.5590169945,

0.6364758026, 0.6971812263, 0.7398902011, 0.7639707480

Sets can also be manipulated using the standard set operators: union, intersect, and minus.Each of these commands can be used both as an infix operator, following standard mathematicalnotation, or as a prefix operator, which looks more program-like.

> word := "to", "too", "two" ;num := "one", "two", "three", "four" ;

word := “to”, “too”, “two”num := “two”, “one”, “three”, “four”

> word union num;

“to”, “too”, “two”, “one”, “three”, “four”> ‘union‘(word, num);

“to”, “too”, “two”, “one”, “three”, “four”> word intersect num;

“two”> num minus word;

“one”, “three”, “four”

The quotes on the command in the prefix form of the commands are required (to delay evaluation).The prefix forms of union and intersect can accept any number of sets.

Page 83: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 79

D Extracting Solutions to an Equation

When Maple finds the solution to an equation or system of equations, the output will be displayedas an expression sequence. You will often want to convert this to a list or set by inserting theappropriate brackets around the solve (or fsolve) command.

> sol := [ fsolve( x^2 = 3, x ) ];

sol := [x = −1.732050808, x = 1.732050808]> sol[ 1 ];

x = −1.732050808

Approximations to the four solutions to the quartic polynomial equation x4 − 3 x2 + x = 0 can befound, as a set, using

> realsol := fsolve( x^4 - 3*x^2 + x = 0, x ) ;realsol := −1.879385242, 1.532088886, 0.3472963553, 0.

In general, fsolve returns at most one (real) solution. For a polynomial, all real valued solutionsare returned. To obtain complex-valued solution, add complex as an optional argument.

> complexsol := fsolve( x^4 - 3*x^2 + x = 4, x, complex ) ;

complexsol := 1.893967041, 0.1004849083 + 0.9990160212 I, −2.094936857,

0.1004849083− 0.9990160212 I

Any individual solution can be obtained as above, but the result would depend on the order of theelements in a set – which is unpredicable.

> realsol[3];

0.3472963553

The largest element of a set can be found using> max( realsol[] );

1.532088886

The absolute value of each solution can be obtained using> map( abs, complexsol );

1.893967041, 2.094936857, 1.004056885

To sort the four real roots in increasing order, re-express the solutions as a list and then call thesort command

> realsol2 := convert( realsol, list );

realsol2 := [−1.879385242, 1.532088886, 0.3472963553, 0.]> sort( realsol2 );

[−1.879385242, 0., 0.3472963553, 1.532088886]

Page 84: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

80 Maple 8 and USC

To sort the solutions by other orderings, e.g., the magnitude of the solutions, a user-definedordering can be specified as the second argument to the sort command

> sort( realsol2, (a,b) -> evalb( abs(a) < abs(b) ) );

[0., 0.3472963553, 1.532088886, −1.879385242]

To conclude this discussion, consider the system of equations that describes the set of all points onthe unit circle, x2 + y2 = 1, and the line, x + 2 y = 1.

> eq1 := x^2 + y^2 = 1;eq2 := x + 2*y = 1;

eq1 := x2 + y2 = 1eq2 := x + 2 y = 1

The system of equations and variables are each specified as sets that, when fed to the solvecommand, show two solutions

> syssol := [ solve( eq1, eq2 , x, y ) ];

syssol := [x = 1, y = 0, y =45, x =

−35]

Each solution is a set of equations giving the x - and y-coordinates of a point on both curves. Notethat the order of the equations within each solution may not be consistent. These solutions can beconverted to ordered pairs using

> syspts := seq( eval( [x,y], pt ), pt = syssol );

syspts := [1, 0], [−35

,45]

The two curves involved in this problem can be plotted with the implicitplot command from theplots package. The two solutions can be plotted using plot with style=point. The displaycommand (also from the plots package) can be used to display the information in both plots in asingle plot. The output from the plot-creating commands in the definition of p1 and p2 is thecorresponding “plot data structure”, not a graphical object. (If you really want to see this, changethe colons to semi-colons.)

> p1 := implicitplot( eq1, eq2 , x = -2 .. 2, y = -2 .. 2,scaling=constrained ):

p2 := plot( [ syspts ], style=point, color=black, symbol=circle,symbolsize=30 ):

display( [ p1, p2 ] );

Note that the implicitplot command cannot accept a list as its first argument. Thisinconsistency with the other plot commands is corrected in Maple 9.

Page 85: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 81

7.6 Creating Animations

A Maple animation is formed when the elements of a list of Maple plots is displayed in rapidsuccession. To animate the drawing of a functionr = cos(5 θ)for 0 < θ < π in polar coordinates, create a sequence of plots of the function over shorter timeintervals, say 0 < θ < θ0 for θ0 = π

12 , π6 , π

4 , ..., π.> polarframes := seq( plot( sin(5*theta), theta = 0 .. theta0,

coords=polar ),theta0 = [ n * Pi/12 $ n = 1 .. 12 ] ):

The display command from the plots package will display the plots as a list with theinsequence=true option. The animation is, of course, playable only in an active Maple worksheet(or a worksheet that has been exported to HTML). To play the animation, click the left mousebutton anywhere in the first frame of the animation. Then use the VCR control buttons on thecontext bar to advance through the frames individually, once from beginning to end, orcontinuously.

> display( [ polarframes ], insequence=true );

–0.8

–0.6

–0.4

–0.2

0.2

0.4

0.6

0.8

1

–0.8 –0.6 –0.4 –0.2 0.2 0.4 0.6 0.8

For a hardcopy of this animation it makes more sense to display all 12 frames of the animation asan array (or matrix) with three rows each containing four plots. The matrix command, from thelinalg package, is used to create the 3 x 4 array of plots, then the display command is used todisplay the result. The optional argument tickmarks=[0,0] suppresses the tickmarks on both axes(they become too cluttered to be of any use).

> with( linalg ):

Warning, the protected names norm and trace have been redefined andunprotected

Page 86: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

82 Maple 8 and USC

> display( matrix( 3, 4, [polarframes]), tickmarks=[0,0] );

The concluding example in this section illustrates the relationship between the unit circle and thesine curve. The basic idea is to create separate plots of the sine curve and the unit circle centeredat (-1,0). The animation comes with the addition of the line segment from the center of the circle toa point on the circle and the line segment from this point on the circle to the corresponding pointon the sine curve for different angles between 0 and 2π. Do not be concerned if some of the detailsare unclear at first. Once you see the animation and look at the individual pieces used to composethe individual frames, the process will become much less mysterious.

The unit circle with center (-1,0) can be created with the circle command from the plottoolspackage.

> with( plottools ):

Warning, the name arrow has been redefined

> p1 := circle( [-1,0], 1, color=blue ):

> p2 := plot( sin(x), x=0 .. 2*Pi, color=red ):

User-defined functions are used to create the line segments from the center of the circle, (-1,0), to apoint on the circle, ( cos(t)-1, sin(t) ), to the point on the sine curve, ( t, sin(t) ), for an arbitraryangle and the composite plot showing the circle, sine curve, and line segments..

> circ_pt_line := t -> plot( [ [-1,0], [cos(t)-1,sin(t)], [t,sin(t)] ],color=black ):

> composite_plot := t -> display( [ p1, p2, circ_pt_line(t) ],view=[-2..7,-1..1], tickmarks=[0,0],scaling=constrained ):

The frame of the movie with t = π4 can now be created with the command

Page 87: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 83

> composite_plot( Pi/4 );

The list of 32 uniformly distributed angles between 0 and 2 π is> angles := [ i*Pi/16 $ i = 1 .. 32 ];

angles := [π

16,

π

8,

3 π

16,

π

4,

5 π

16,

3 π

8,

7 π

16,

π

2,

9 π

16,

5 π

8,

11 π

16,

3 π

4,

13 π

16,

7 π

8,

15 π

16, π,

17 π

16,

9 π

8,

19 π

16,

5 π

4,

21 π

16,

11 π

8,

23 π

16,

3 π

2,

25 π

16,

13 π

8,

27 π

16,

7 π

4,

29 π

16,

15 π

8,

31 π

16, 2 π]

We conclude by making a frame for each of these angles and animating the resulting list ofcomposite plots.

> movieframes := [ seq( composite_plot( theta ), theta=angles ) ]:

> display( movieframes, insequence=true, scaling=constrained );

7.7 Three Types of Brackets in Maple

Three types of brackets have been described in this worksheet: ( ... ), [ ... ], and ... .

Parentheses or round brackets, ( ... ), are used for the mathematical grouping of terms,including the specification of function arguments.

> 7 * (3+4);

49> sin( Pi/4 );

√2

2

Square brackets, [ ... ], are used for creating lists.

Page 88: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

84 Maple 8 and USC

> [ seq( n^2, n=-2..2 ) ];

[4, 1, 0, 1, 4]

Curly brackets, ... , are used for creating sets.> seq( n^2, n=-2..2 ) ;

0, 1, 4

Do not attempt to interchange these symbols! For example,> sin[ Pi/4 ];

sinπ

4> exp(3);

Error, invalid input: exp expects its 1st argument, x, to be of typealgebraic, but received 3

7.8 Common Problems and How to Fix Them

A Using a Command That Is Not Known by the Maple Kernel

Some commands are defined as part of a package that is not automatically loaded into the Maplekernel. If one of these commands is used prior to loading the package, the output will simply echothe input after the arguments have been simplified (if possible). For example,

> restart;

> completesquare( x^2 + 2*x + 2 );

completesquare(x2 + 2 x + 2)> with( student );

[D, Diff , Doubleint , Int , Limit , Lineint , Product , Sum, Tripleint , changevar ,

completesquare, distance, equate, integrand , intercept , intparts, leftbox , leftsum,

makeproc, middlebox , middlesum, midpoint , powsubs, rightbox , rightsum,

showtangent , simpson, slope, summand , trapezoid ]> completesquare( x^2 + 2*x + 2 );

(x + 1)2 + 1

B Using Reserved Words and Protected Names

Maple places relatively few restrictions on the names that can be used for objects. When such aname is used, Maple generates an appropriate error message.

> union := 1,2,3;

Error, reserved words ‘union‘ or ‘minus‘ unexpected

Page 89: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 85

> Pi := 22/7;

Error, attempting to assign to ‘Pi‘ which is protected

Be forewarned, however, that if a value is assigned to a name that is also a Maple command, thenthe new assignment overwrites the command definition. This feature can be used — byknowledgeable and brave users — to extend or customize the functionality of some of Maple’sbuilt-in commands.

7.9 Maple and Calculus

The techniques introduced in the earlier parts of this section will now be applied to thefundamental calculus concepts: limit, derivative, and integral and their applications.

A Limits

> restart;

The Maple command to compute limx→a f(x) is limit( f(x), x=a );.

> limit( sin(x)/x, x=0 );

1

> limit( (1+x)^(1/x), x=0 );

e

To obtain a limit at ∞, use infinity.

> limit( (1+x/n)^n, n=infinity );

ex

Right- or left-hand limits are returned when the (optional) third argument is right or left,respectively.

> limit( tan(x), x=Pi/2 );

undefined

> limit( tan(x), x=Pi/2, right );

−∞> limit( tan(x), x=Pi/2, left );

Page 90: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

86 Maple 8 and USC

B Derivatives and Tangent Lines> restart;

Given a function f, the slope of the secant lines through ( x, f(x) ) and ( x + h, f(x + h) ) is thedifference quotient. As h approaches 0, these quantities become the slope of the tangent line at ( x,f(x) ). The slope of the secant line can be obtained with the Maple command

> m[secant] := (f(x+h) - f(x) ) / h;

msecant :=f(x + h)− f(x)

h

In practice, it is often necessary to use the simplify command to force Maple to simplify thedifference quotient. For example,

> f := x -> x^3 - 3*x^2 - 4;

f := x → x3 − 3 x2 − 4> m[secant];

(x + h)3 − 3 (x + h)2 − x3 + 3 x2

h> simplify( m[secant] );

3 x2 + 3 xh + h2 − 6 x− 3 h

> m[tangent] := limit( m[secant], h=0 );

mtangent := 3 x2 − 6 x

The Tangent command from the Student[Calculus1] package provides a simple means to displaya function and the tangent line at a point.

> with( Student[Calculus1] );

[AntiderivativePlot , ApproximateInt , ArcLength, Asymptotes, Clear , CriticalPoints,DerivativePlot , ExtremePoints, FunctionAverage, FunctionChart , GetMessage,

GetNumProblems, GetProblem, Hint , InflectionPoints, Integrand , InversePlot ,MeanValueTheorem, NewtonQuotient , NewtonsMethod , PointInterpolation,

RiemannSum, RollesTheorem, Roots, Rule, Show , ShowIncomplete, ShowSteps,Summand , SurfaceOfRevolution, Tangent , TaylorApproximation, Understand ,

Undo, VolumeOfRevolution, WhatProblem]

Page 91: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 87

> Tangent( f(x), x=1, output=plot );

f(x)The tangent at x = 1

The Tangent to the Graph of f(x) = x^3–3*x^2–4at the Point (1, f(1))

–8

–7

–6

–5

–4

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2x

The equation of this tangent line is obtained by changing the third argument to output=line.> Tangent( f(x), x=1, output=line );

−3 x− 3

The TangentLinePlot maplet [ MapletViewer] [ MapleNet] provides a customized user interfaceto the Tangent command. The MapleNet version of this maplet is available over the WWW toanyone using a computer with a reasonably current version of Java. The MapletViewer versionrequires that Maple 8 (or newer) is loaded on your local computer.

The derivative of an expression is obtained with the diff command.> fp := diff( f(x), x );

fp := 3 x2 − 6 x

The D command acts like the differentiation operator in that it computes the derivative of afunction and returns a function.

> Df := D(f);

Df := x → 3 x2 − 6 x

Note that the latter form is more convenient when it will be necessary to compute the derivative ata specific point.

> Df(1) = eval( fp, x=1 );

−3 = −3

Page 92: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

88 Maple 8 and USC

Higher-order derivatives are obtained by specifying additional arguments to the diff command orby composing D with itself an appropriate number of times.

> diff( exp(a*x), x, x );

a2 e(a x)

> diff( exp(a*x), x$5 );

a5 e(a x)

C Applications of Derivatives

Implicit Differentiation

Implicit differentiation can be done in several different ways. Consider the implicitly definedfunction

> impl_eq := (x-1)^4 = x^2 - y^2;

impl eq := (x− 1)4 = x2 − y2

The implicitdiff command can be used to find derivatives by implicit differentiation.> dy/dx = implicitdiff( impl_eq, y, x );

dydx

= −2 x3 − 6 x2 + 5 x− 2y

Observe that the second and third arguments define the dependence between the names – thesecond argument is the dependent variable, the third argument is the independent variable.

The same result can be found by rewriting the implicit function to explicitly note the dependence ofy on x

> eq2 := eval( impl_eq, y=y(x) );

eq2 := (x− 1)4 = x2 − y(x)2

and differentiating the result with respect to x.> q1 := diff( eq2, x );

q1 := 4 (x− 1)3 = 2x− 2 y(x) ( ddx y(x))

> q2 := solve( q1, diff(y(x),x) );

q2 := ddx y(x) = −2 x3 − 6 x2 + 5 x− 2

y(x)

These two commands can, of course, be combined into a single command.> impl_diff := diff( eval( impl_eq, y=y(x) ), x );

impl diff := 4 (x− 1)3 = 2x− 2 y(x) ( ddx y(x))

The formula for ddx y(x) is obtained by solving the above equation for this quantity.

Page 93: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 89

> impl_dydx := isolate( impl_diff, diff(y(x),x) );

impl dydx := ddx y(x) =

12−4 (x− 1)3 + 2 x

y(x)

While this formula is not the same as either of the derivatives found earlier, it is easily seen to bean equivalent result.

> simplify( impl_dydx );

ddx y(x) = −2 x3 − 6 x2 + 5 x− 2

y(x)

Higher-order implicit derivatives are obtained with implicitdiff by repeating the independentvariable as many times as the desired order of the derivative (exactly as in diff).

> d2y/dx2 = implicitdiff( impl_eq, y, x,x );

d2ydx2

= −6 y2 x2 − 12 y2 x + 5 y2 + 4 x6 − 24 x5 + 56 x4 − 68 x3 + 49 x2 − 20 x + 4y3

Compare this with the step-by-step computation of the same (we hope) result with diff :> q3 :=diff( eq2, x$2 );

q3 := 12 (x− 1)2 = 2− 2 ( ddx y(x))2 − 2 y(x) ( d2

dx2 y(x))> q4 := solve( q3, diff(y(x),x,x) );

q4 :=

d2

dx2 y(x) = −6 x2 − 12 x + 5 + ( d

dx y(x))2

y(x)

> lhs(q4[]) = simplify( eval( rhs(q4[]), q2 ) );

d2

dx2 y(x) =

−6 y(x)2 x2 − 12 y(x)2 x + 5 y(x)2 + 4 x6 − 24 x5 + 56 x4 − 68 x3 + 49 x2 − 20 x + 4y(x)3

Linearization of a Function> restart;

> with( Student[Calculus1] ):

The linearization of a function f(x) at x = a is L(x) = f(a) + f’( a) ( x− a). For example, if> f := x -> sqrt( 1+x );

f := x →√

1 + x

and> a := 0;

a := 0

the linearization of f at x = a can be obtained with the TaylorApproximation command from theStudent[Calculus1] package as follows:

Page 94: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

90 Maple 8 and USC

> TaylorApproximation( f(x), x=a );

1 +x

2

The unapply command can be sued to convert this into a function> L1 := unapply( TaylorApproximation( f(x), x=a ), x );

L1 := x → 1 +12

x

An alternate definition of this linearization is> L2 := x -> f(a) + D(f)(a)*(x-a);

L2 := x → f(a) + D(f)(a) (x− a)

The difference in the output is caused by the fact that Maple does not fully evaluate the right-handside of the arrow operator (->) until the function is actually called. What this means is that ifeither the function f or the point a are changed, then the function L2 will reflect those changes aswell. The function L1, however, uses the values of f and a at the time the command is executed andis unaffected by subsequent changes. This is illustrated in the following examples.

> L1(b) = L2(b);

1 +b

2= 1 +

b

2> a := 1;

a := 1> L1(b) <> L2(b);

1 +b

26=√

2 +√

2 (b− 1)4

The function and its linearization can be graphed as follows.> TaylorApproximation( f(x), x=a, output=plot );

f(x)Taylor approximation

Taylor Approximation off(x) = (1+x)^(1/2)

at the Point (1, f(1))

1

1.1

1.2

1.3

1.4

1.5

1.6

1.7

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2x

Page 95: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 91

To determine the largest interval on which the linearization differs from the original function by nomore than a specified amount, i.e., to estimate the largest δ such that |x− a| < δ implies|f(x)− L(x)| < ε, we first look at the graph

> epsilon := 0.01:

> plot( [ abs( f(x)-L2(x) ), epsilon ], x = 0 .. 3 );

0

0.02

0.04

0.06

0.08

0.1

0.12

0.5 1 1.5 2 2.5 3

x

Click the left mouse button as close as possible to the leftmost of the two intersections of the curvesin the plot. The box at the left end of the context bar shows the approximate coordinates of thispoint; this gives the point ( 0.57, 0.01 ). Repeating this process for the rightmost intersection gives( 1.49, 0.01 ). This gives the estimate δ = min( 1-0.57, 1.49-1 ) = 0.43.

More accurate estimates of the intersection points will give more accurate estimates for δ. In thiscase Maple can solve the inequality |f(x)− L(x)| < ε.

> solve( abs( f(x)-L2(x) ) < epsilon, x );

RealRange(Open(0.5526014252), Open(1.503967117))

This yields> delta := min( 1-0.5526014252, 1.503967117-1 );

δ := 0.4473985748

To conclude, check that the error never exceeds ε over this interval.

Page 96: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

92 Maple 8 and USC

> plot( [ abs( f(x)-L2(x) ), epsilon ], x = 1-delta .. 1+delta );

0

0.002

0.004

0.006

0.008

0.01

0.6 0.8 1 1.2 1.4

x

Newton’s Method> restart;

> with( Student[Calculus1] ):

Newton’s Method is implemented with the NewtonsMethod command (from theStudent[Calculus1] package). For example, consider the problem of finding the solution closest tox = −1, accurate to five decimal places, to f(x) = 0 when

> f := x -> cos( 5*x ) - x:

Define the initial guess> x0 := -1;

x0 := −1

Apply one iteration of Newton’s Method to obtain> x1 := NewtonsMethod( f(x), x=x0, iterations=1 );

x1 := −0.7784735010

Additional iterations of Newton’s Method yield> x2 := NewtonsMethod( f(x), x=x1, iterations=1 );

x2 := −0.7677474241> x3 := NewtonsMethod( f(x), x=x2, iterations=1 );

x3 := −0.7674935683> x4 := NewtonsMethod( f(x), x=x3, iterations=1 );

x4 := −0.7674934212

Thus, x = −.76749 is an approximate value of the root closest to x = −1. If this process hadcontinued too much longer, it would be more efficient to use the following loop to compute theiterates. (See the online help for do .. end do .)

Page 97: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 93

> x[0] := -1;

x0 := −1> x[1] := NewtonsMethod( f(x), x=x[0], iterations=1 );

x1 := −0.7784735010> for n from 2 while abs( x[n-1] - x[n-2] ) >= 10^(-6) do

> x[n] := NewtonsMethod( f(x), x=x[n-1], iterations=1 );

> end do;

x2 := −0.7677474241x3 := −0.7674935683x4 := −0.7674934212

The explicit function used for one iteration of Newton’s Method can be defined with> g := unapply( NewtonsMethod( f(x), x=X, iterations=1 ), X );

g := X → X − 1. (cos(5. X)− 1. X)−5. sin(5. X)− 1.

A sequence of Newton iterates can be obtained by adding output=sequence :> NewtonsMethod( f(x), x=-1, iterations=3, output=sequence );

−1, −0.7784735010, −0.7677474241, −0.7674935683

If the iterations argument is omitted, then 5 iterations are performed.> NewtonsMethod( f(x), x=-1, output=sequence );

−1, −0.7784735010, −0.7677474241, −0.7674935683, −0.7674934212, −0.7674934213

If the output=sequence argument is also omitted, then only the fifth iteration is returned> NewtonsMethod( f(x), x=-1 );

−0.7674934213

To conclude this discussion, using output=plot produces in a graphical display of the Newtoniterations.

> NewtonsMethod( f(x), x=-1, output=plot, iterations=3 );

f(x)Tangent lines

3 Iterations of Newton’s Method Applied tof(x) = cos(5*x)-x

with Initial Point x = –1

0

0.2

0.4

0.6

0.8

1

1.2

1.4

–1 –0.95 –0.9 –0.85 –0.8 –0.75x

Page 98: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

94 Maple 8 and USC

Notice how each step of the Newton iteration uses the tangent line to the curve at the currentiteration to obtain the next iteration. (To understand the hypotheses for the convergence theoremfor Newton’s method, think about what would happen if one of the tangent lines was horizontal, ornearly horizontal.)

D Definite, Indefinite, and Improper Integrals> restart;

The int command is used to compute integrals in Maple. The indefinite integral∫

ln(x) dx isobtained with the command

> int( ln(x), x ) + C;

x ln(x)− x + C

Note that it is necessary to explicitly include the constant of integration, C.

If additional information is given, it should be possible to determine a specific value for C. Forexample, Maple can be used to find the function that satisfies the initial value problem

y’(x) = 5 e(−3 x)

y(0) = −10

First, find the antiderivative (don’t forget to include the constant of integration)> eq1 := y = int( 5*exp(-3*x), x ) + C;

eq1 := y = −53

e(−3 x) + C

To determine the appropriate value of C, apply the initial condition> eq2 := eval( eq1, y=-10, x=0 );

eq2 := −10 = −53

+ C

and solve for C

> eq3 := C = solve( eq2, C );

eq3 := C =−253

The solution to the initial value problem is> eval( eq1, eq3 );

y = −53

e(−3 x) − 253

Page 99: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 95

The Student[Calculus1] package contains a number of commands for the visualization andestimation of Riemann sums.

> with( Student[Calculus1] ):

To illustrate, consider the problem of approximating the value of∫ 21 x3 + 1 dx. Let

> f := x^3 + 1;

f := x3 + 1

The midpoint approximation to this integral with 6 subdivisions is the area of the rectanglesdisplayed with the ApproximateInt command

> ApproximateInt(f, x=1..2, method=midpoint, partition=6, output=plot);

f(x)

An Approximation of the Integral off(x) = x^3+1

on the Interval [1, 2]Using a Midpoint Riemann Sum

Approximate Value: 4.750000000

Area: 4.739583332

–2

0

2

4

6

8

1.2 1.4 1.6 1.8 2x

Observe that this plot displays the value of the corresponding Riemann sum (4.73958332) and thevalue of the definite integral (4.75). The explicit Riemann sum for this example can be obtainedwith

> ApproximateInt(f, x=1..2, method=midpoint, partition=6, output=sum);

16

(5∑

i=0

((1312

+i

6)3 + 1)

)

The value of this Riemann sum can be obtained as either> value( % );

45596

or> ApproximateInt( f, x=1..2, method=midpoint, partition=6 );

45596

Page 100: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

96 Maple 8 and USC

The floating-point approximation to this value is> evalf( % );

4.739583333

An animation showing the convergence of a Riemann sum, or other quadrature method, can beobtained as follows:

> ApproximateInt( f, x=1..2, output=animation,method=random, subpartition=all, refinement=random,partition=2, iterations=8 ):

For other Riemann sums, change the method option to right, left, random, upper, lower, orrandom. For the Trapezoidal and Simpson’s Rules, use method=trapezoid or method=simpson,respectively.

> ApproximateInt(f, x=1..2, method=trapezoid, partition=4, output=plot);

f(x)

An Approximation of the Integral off(x) = x^3+1

on the Interval [1, 2]Using the Trapezoid Rule

Approximate Value: 4.750000000

Area: 4.796875000

–2

0

2

4

6

8

1.2 1.4 1.6 1.8 2x

The exact value of the definite integral is> int( f, x = 1 .. 2 );

194

> evalf( % );

4.750000000

While Maple is designed to be able to automatically evaluate many integrals, it can also be used toassist with techniques including substitution and integration by parts. The explicit commandsimplementing this capability are quite complex. But, they are easy to use in the form of theDifferentiation maplet [ MapletViewer] [ MapleNet].

Page 101: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 97

E Applications of Integrals

Arclength of a Smooth Curve> restart;

> with( Student[Calculus1] ):

The definite integral for the arclength of a smooth curve is usually easy to formulate but difficult toevaluate. The general formula for the arclength of the graph of y = f(x) for x in [a, b] is

> ArcLength( f(x), x=a .. b, output=integral );∫ b

a

√( d

dx f(x))2 + 1 dx

For example, with> f := x -> 2*x^(3/2);

f := x → 2 x(3/2)

on the interval [ 0, 1 ], the definite integral for the arclength is> ArcLength( f(x), x=0..1, output=integral );∫ 1

0

√9 x + 1 dx

The exact value of this integral is> ArcLength( f(x), x=0..1 );

20√

1027

− 227

Maple is able to evaluate many more integrals than most humans, but there are many arclengthintegrals that cannot be evaluated explicitly. If this occurs, or if Maple’s answer involves functionsthat are not familiar to you, use evalf to force a numerical approximation of the integral.

> f := x -> sin(x);

f := sin> ArcLength( f(x), x=0..1 );

√2 EllipticE(

√1− cos(1)2,

√2

2)

> evalf( % );

1.311442498

Improper Integrals> restart;

Improper integrals are not a problem for Maple. Here are three examples.> int( x * exp(-x), x = 1 .. infinity );

2 e(−1)

> int( 1/sqrt(4-x^2), x = 0 .. 2 );π

2

Page 102: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

98 Maple 8 and USC

> int( 1/x, x = 1 .. infinity );

Multiple Integrals> restart;

The int and Int commands can be used to construct iterated integrals corresponding to doubleand triple integrals.

> Int( Int( exp(x-y), x = y .. 1 ), y = 0 .. 1 );∫ 1

0

∫ 1

ye(x−y) dx dy

> % = value( % ); ∫ 1

0

∫ 1

ye(x−y) dx dy = −2 + e

The area of the ellipse x2

a2 + y2

b2= 1 can be found by parameterizing the ellipse in polar coordinates:

x = a r cos(θ), y = b r sin(θ) with 0 <= r <= 1 and 0 <= θ < 2 π. The Jacobian of this change ofvariables is a b r, so the area of the ellipse is

> Int( Int( a*b*r, r = 0 .. 1 ), theta = 0 .. 2*Pi );∫ 2 π

0

∫ 1

0a b r dr dθ

> % = value( % ); ∫ 2 π

0

∫ 1

0a b r dr dθ = a b π

Note that this result reduces to the familiar area of a circle when a = b.

7.10 Maple and Differential Equations> restart;

The dsolve command attempts to solve a differential equation. If initial conditions are provided, aparticular solution is sought; otherwise, the successful result will be the general solution.

> ode := diff( y(x), x ) = y(x) * (3-y(x)) * (x-1);

ode := ddx y(x) = y(x) (3− y(x)) (x− 1)

> soln := dsolve( ode, y(x) );

soln := y(x) =3

1 + 3 e(−3/2 x2+3 x) C1

Note that Maple has returned the general solution to this differential equation. The name C1 is theparameter for this one-dimensional family of solutions.

To find the solution that passes through a specific point, substitute the initial condition into thesolution, solve for C1, and substitute the result back into the general solution:

Page 103: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 99

> q1 := eval( soln, y(x) = 2, x=0 );

q1 := 2 =3

1 + 3 C1

> q2 := solve( q1, _C1 );

q2 := C1 =16

> q3 := eval( soln, q2 );

q3 := y(x) =3

1 +12

e(−3/2 x2+3 x)

If the particular solution to an initial value problem is all that is needed, then the above processcan be streamlined to a single dsolve command in which the first argument is a set containing thedifferential equation and the initial condition.

> q4 := dsolve( ode, y(0)=2 , y(x) );

q4 := y(x) =3

1 +12

e(−3/2 x2+3 x)

Notice that the solution returned by dsolve is an equation. To plot this solution, use the rhscommand to pass only the right-hand side of the solution to the plot command.

> plot( rhs(q4), x=-1..4 );

1

1.5

2

2.5

3

–1 0 1 2 3 4

x

Page 104: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

100 Maple 8 and USC

The DEtools package contains a number of useful commands for working with differential equations.> with( DEtools );

[DEnormal , DEplot , DEplot3d , DEplot polygon, DFactor , DFactorLCLM , DFactorsols,Dchangevar , GCRD , LCLM , MeijerGsols, PDEchangecoords, RiemannPsols,Xchange, Xcommutator , Xgauge, abelsol , adjoint , autonomous, bernoullisol ,buildsol , buildsym, canoni , caseplot , casesplit , checkrank , chinisol , clairautsol ,constcoeffsols, convertAlg , convertsys, dalembertsol , dcoeffs, de2diffop, dfieldplot ,diffop2de, dpolyform, dsubs, eigenring , endomorphism charpoly , equinv , eta k ,

eulersols, exactsol , expsols, exterior power , firint , firtest , formal sol , gen exp,

generate ic, genhomosol , gensys, hamilton eqs, hypergeomsols, hyperode,

indicialeq , infgen, initialdata, integrate sols, intfactor , invariants, kovacicsols,leftdivision, liesol , line int , linearsol , matrixDE , matrix riccati , maxdimsystems,moser reduce, muchange, mult , mutest , newton polygon, normalG2 , odeadvisor ,

odepde, parametricsol , phaseportrait , poincare, polysols, power equivalent ,ratsols, redode, reduceOrder , reduce order , regular parts, regularsp,

remove RootOf , riccati system, riccatisol , rifread , rifsimp, rightdivision, rtaylor ,

separablesol , solve group, super reduce, symgen, symmetric power ,

symmetric product , symtest , transinv , translate, untranslate, varparam, zoom]

In particular, the DEplot command can be used to display a direction field and/or solution curvesfor a differential equation.

> DEplot( ode, [y(x)], x=-1..4, [ [0,2] ], arrows=none );

1

1.5

2

2.5

3

y(x)

–1 0 1 2 3 4

x

Changing the last argument to arrows=thin will include the direction field. Adding additionalordered pairs to the list of initial conditions will add additional solution curves to the plot. Theonline help for DEplot describes other options that control features such as the color of the arrowsand solution curves, the window for the plot, and the stepsize.

Page 105: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CALCULUS AND MAPLE 101

> init_cond := [ [0,0], [0,1], [0,2], [0,3] ];

init cond := [[0, 0], [0, 1], [0, 2], [0, 3]]> DEplot( ode, [y(x)], x=-1..4, init_cond, arrows=thin );

0

0.5

1

1.5

2

2.5

3

y(x)

–1 1 2 3 4

x

Page 106: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

102 Maple 8 and USC

Page 107: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 8

Tips for Maple Users

This portion of the manual contains tips and suggestions that will help you, and your students, makeoptimal use of Maple while learning Calculus.1 These suggestions begin with a few “rules” that willaid new users in the process of developing good Maple usage habits. A worksheet containing theexamples presented in Tables 8.1 – 8.8 can be found at the WWW at

http://www.math.sc.edu/~meade/141L-F03/manual/tip.mws .

1The tips in this chapter are based on a similar list prepared in collaboration with Robert Lopez for AppliedEngineering Mathematics, (Addison Wesley Longman, 2002).

103

Page 108: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

104 Maple 8 and USC

Tip #1 Avoid potential name clashes.Never assign to a variable on the left if you are using that variable as a “free variable” on theright. This avoids name clashes later. (See Table 8.1.)

Tip #2 Avoid assigning values to common single-letter names.One suggestion is to use names such as q, q1, q2, . . . because q is one of the more infrequentlyused mathematical names and it is easy to find on the keyboard. Adherence to this tip isparticularly important if the name is frequently used as a “working variable” on the right-handside of other expressions. (See Table 8.2.)

Tip #3 Never reassign something (involving itself) to itself.If you do, you will have two input regions containing the same name assigned two differentvalues, and you may not know which version of the name you want (or will receive) during laterusage. (See Table 8.3.)

Tip #4 Never use Maple’s ditto operator to reference a previous output.Use of the ditto operators, %, %%, and %%%, can generate an unreadable worksheet because thereis no indication to subsequent readers of the order in which commands are executed. (It is stillpossible to create an incomprehensible worksheet without %, but % is one bad actor that weshould exclude from our plays.) If you really want to have a shorthand notation for previousresults, use Maple’s history command. Use ?history to see the corresponding help document.(See Table 8.4.)

Tip #5 Avoid making assumptions unless it is absolutely necessary.The problem with assumptions is that they have lasting, and on-going, side effects. When anassumption is used, try to revert to an unassumed name as soon as it becomes feasible. Theassuming feature provides a more useful and effective way to make temporary assumptionsabout variables. (See Table 8.5.)

Tip #6 Avoid using the op command or the selection operator, [ ], to refer to elements of a set.Because the elements of a set are unordered, it is likely that the set will have a differentappearance if the commands are re-executed. Recommended methods to access elements ofa set generally use one or more of the commands eval, select, remove, selectremove, andsubs commands. Another alternative is to convert the set into a list and use sort to put theelements of the list in a predetermined order. (See Table 8.6.)

Tip #7 Use a unique index variable in a do .. end do command.When the do command terminates, the index variable retains its final value. A simple methodfor creating a unique index variable is to change the case or prepend (or append) one or morecharacters to the name, e.g., X, or IND x instead of x. If the index variable is used outside thedo command, it should be restored to an unevaluated name with the unassign command.

The seq, add, mul, sum, and product commands also use an index variable. However, the indexvariable used by these commands is local to the command. This means the value of a globalvariable with the same name as the index variable is unchanged by these commands. This ap-proach is preferred because these commands are generally more efficient than the correspondingdo .. end do command. (See Table 8.7.)

Tip #8 Start all Maple sessions with the restart command.In addition to putting a restart command at the beginning of every worksheet, it is recom-mended to load all packages at the top of the worksheet. (See Table 8.8.)

Page 109: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

TIPS FOR MAPLE USERS 105

Improper Usage Recommended Usage

> restart;

> fn := x -> exp(x^2);

fn := x → e(x2)

> x := a+3;

x := a + 3> diff( fn(x), x );

Error, wrong number (or type) ofparameters in function diff

> fn(x), x;

e((a+3)2), a + 3

> restart;

> fn := x -> exp(x^2);

fn := x → e(x2)

> Dfn := diff( fn(x), x );

Dfn := 2 x e(x2)

> eval( Dfn, x=a+3 );

2 (a + 3) e((a+3)2)

> fn(x), x;

e(x2), x

> restart;> x := t;

y := t^2;

x := t

y := t2

> solve( x=x, y=y , y, t );t = t, t2 = t2

> restart;> EQx := x = t;

EQy := y = t^2;

EQx := x = t

EQy := y = t2

> solve( EQx, EQy , y, t );t = x, y = x2

Table 8.1: Two illustrations of the problems that can arise when names clash.

Improper Usage Recommended Usage

> restart;

> f := 1;

f := 1> for n from 1 to 2 do

f := simplify(int(f*exp(x),x));end do;

f := ex

f :=12

e(2 x)

> for n from 1 to 2 dof := simplify(int(f*exp(x),x));

end do;

f :=16

e(3 x)

f :=124

e(4 x)

> restart;

> f0 := 1;

f0 := 1> for n from 1 to 2 do

f||n := simplify(int(exp(x)*f||(n-1),x));

end do;

f1 := ex

f2 :=12

e(2 x)

> for n from 1 to 2 dof||n := simplify(

int(exp(x)*f||(n-1),x));end do;

f1 := ex

f2 :=12

e(2 x)

Table 8.2: Illustration of the problems that can arise when “working variables” are used as Maplenames.

Page 110: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

106 Maple 8 and USC

Improper Usage Recommended Usage

> restart;

> fn := (u,v) -> (u+v)^2 - u*v;

fn := (u, v) → (u + v)2 − u v

> u := 2;

u := 2> fn(u,v);

(2 + v)2 − 2 v

> solve( fn(u,v)=0, u );

Error, (in solve) a constantis invalid as a variable, 2

> restart;

> fn := (u,v) -> (u+v)^2 - u*v;

fn := (u, v) → (u + v)2 − u v

> u0 := 2;

u0 := 2> solve( fn(u,v)=0, u );

u = (−12

+12

I√

3) v, u = (−12− 1

2I√

3) v

Table 8.3: Illustration of the problems that can arise when a name is used on both sides of anassignment. Note the different results when the do .. end do commands are executed the secondtime in the left column.

Improper Usage Recommended Usage

> restart;

> f := 1;

f := 1

> for n from 1 to 2 dof := simplify(int(exp(x)*%,x));

end do;

f := ex

f :=12

e(2 x)

> for n from 1 to 2 dof := simplify(int(exp(x)*%,x));

end do;

f :=16

e(3 x)

f :=124

e(4 x)

> restart;

> f0 := 1;

f0 := 1> for n from 1 to 2 do

f||n := simplify(int(exp(x)*f||(n-1),x));

end do;

f1 := ex

f2 :=12

e(2 x)

> for n from 1 to 2 dof||n := simplify(

int(exp(x)*f||(n-1),x));end do;

f1 := ex

f2 :=12

e(2 x)

Table 8.4: Illustration of the problems that can arise from the use of the ditto operator, %.

Page 111: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

TIPS FOR MAPLE USERS 107

Improper Usage Recommended Usage

> restart;

> int( exp(a*x), x=0..infinity );

Definite integration: Can’t determineif the integral is convergent.

Need to know the sign of --> -a

Will now try indefinite integrationand then take limits.

limx→∞

e(a x) − 1a

> assume( a < 0 );

> int( exp(a*x), x=0..infinity );

− 1a˜

> cutoff := piecewise( a>0, 1 );

cutoff := PIECEWISE()

> restart;

> int( exp(a*x), x=0..infinity );

Definite integration: Can’t determineif the integral is convergent.

Need to know the sign of --> -a

Will now try indefinite integrationand then take limits.

limx→∞

e(a x) − 1a

> assume( a < 0 );

> int( exp(a*x), x=0..infinity );

− 1a˜

> unassign( ’a’ );

> cutoff := piecewise( a>0, 1 );

cutoff :=

1 0 < a0 otherwise

> restart;

> q:=Int( x*sin(n*x), x=-Pi..Pi);

q :=∫ π

−πx sin(n x) dx

> assume( n, integer );

> a:=value( q );

a := −2 π (−1)n˜

n˜> add( a*sin(n*x), n=1..2 );

−2 π (−1)n˜ sin(x)n˜

− 2 π (−1)n˜ sin(2x)n˜

> restart;

> q:=Int( x*sin(n*x), x=-Pi..Pi);

q :=∫ π

−πx sin(n x) dx

> a:=simplify( value(q) )assuming n::integer;

a :=2 (−1)(1+n) π

n> add( a*sin(n*x), n=1..3 );

2 π sin(x)− π sin(2x) +23

π sin(3x)

Table 8.5: Two illustrations of the problems when assumptions are used inappropriately.

Page 112: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

108 Maple 8 and USC

Improper Usage Recommended Usage

> restart;

> eqn := x^4 = 16;

eqn := x4 = 16> soln := solve( eqn, x ) ;

soln := −2, 2, 2 I, −2 I> xRE := soln[1], soln[2];

xRE := −2, 2> xREp := xRE[2];

xREp := 2> xREn := xRE[1];

xREn := −2

> restart;

> eqn := x^4 = 16;

eqn := x4 = 16> soln := solve( eqn, x ) ;

soln := −2, 2, 2 I, −2 I> xRE := remove( type, soln,

nonreal );

xRE := −2, 2> xREp := select( type, xRE,

positive );

xREp := 2

> restart;> ode := diff(x(t),t)=-y(t),

diff(y(t),t)= x(t);

ode := ddt x(t) = −y(t), d

dt y(t) = x(t)> ic := x(0) = 1, y(0) = 0;

ic := x(0) = 1, y(0) = 0> S := dsolve( ode, ic ,

x(t), y(t) );

S := y(t) = sin(t), x(t) = cos(t)> X := rhs( S[1] );

X := sin(t)> Y := rhs( S[2] );

Y := cos(t)

> restart;> ode := diff(x(t),t)=-y(t),

diff(y(t),t)= x(t);

ode := ddt x(t) = −y(t), d

dt y(t) = x(t)> ic := x(0) = 1, y(0) = 0;

ic := x(0) = 1, y(0) = 0> S := dsolve( ode, ic ,

x(t), y(t) );

S := x(t) = cos(t), y(t) = sin(t)> X := eval( x(t), S );

X := cos(t)> Y := eval( y(t), S );

Y := sin(t)

Table 8.6: Two examples where the assumption that the elements of a set are ordered can lead toproblems. The results from the two different approaches are sometimes consistent, the assignmentsto xRE, xREp, xREn, X, and Y in the left column all assume a specific ordering of the results in solnand S.

Page 113: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

TIPS FOR MAPLE USERS 109

Improper Usage Recommended Usage

> restart;

> f := x -> exp(x/2):

> a := 0: b := 2: h := 0.01:> Rsum := 0.0:

for x from a to b by h doRsum := Rsum + h*f(x)

end do:Rsum;

3.455162226> diff( f(x), x );

Error, wrong number (or type) ofparameters in function diff

> x;

2.01

> restart;

> f := x -> exp(x/2):

> a := 0: b := 2: h := 0.01:> Rsum := 0.0:

for x from a to b by h doRsum := Rsum + h*f(x)

end do:Rsum;

3.455162226> unassign( ’x’ );

> x;

x

> diff( f(x), x );

12

e(x2)

> Rsum := add( h*f(x),x=[seq(h*i,

i=0..200)] );

Rsum := 3.455162226> x,i;

x, i

> i := 0:> Rsum := add( h*f(h*i),

i=0..200 );

Rsum := 3.455162226> i;

0

Table 8.7: Example of the problems that can occur when a common variable name is used as theindex variable in a do .. end do construction. The first recommended solution illustrates how toremove the assignment from the index counter. The second and third solutions demonstrate how thecomputation can be done with commands that use a local index.

Page 114: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

110 Maple 8 and USC

Improper Usage Recommended Usage

> f := x^3 - x^2;

f := x3 − x2

> MeanValueTheorem( f,x=-3..3, output=plot );

MeanValueTheorem(x3 − x2,

x = −3..3, output = plot)> q1 := MeanValueTheorem( f,

x=-3..3, output=points);

q1 := MeanValueTheorem(x3 − x2,

x = −3..3, output = points)> evalf( q1 );

MeanValueTheorem(x3 − x2,

x = −3..3, output = points)

> restart;

> with( Student[Calculus1] ):

> f := x^3-x^2;

f := x3 − x2

> MeanValueTheorem( f,x=-3..3, output=plot );

f(x)

The Mean Value Theorem Applied tof(x) = x^3-x^2

on the Interval [–3, 3]

–30

–20

–10

10–3 –2 –1 1 2 3x

> q1 := MeanValueTheorem( f,x=-3..3, output=points );

q1 := [13− 2

√7

3,

13

+2√

73

]

> evalf( q1 );

[−1.430500874, 2.097167540]

Table 8.8: An illustration of a typical problem encountered when the user forgets to load a packagein a worksheet. One of the best ways to avoid this problem is to load all packages at the beginningof a worksheet, immediately following the restart command.

Page 115: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Chapter 9

Quick Reference Guide for Maple 8

111

Page 116: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Maple 8: A Quick Reference

Prepared by:Douglas Meade

Department of MathematicsUniversity of South Carolina

September 2002, updated for Maple 8(Earlier editions for Maple 7, Maple 6, Maple V, Release 5, and Maple V, Release 4)

Symbols and Abbreviations

Symbol Description Example:= assignment f := x^2/y^3;; terminate command; display result int( x^2, x );: terminate command; hide result int( x^2, x ):.. specify a range or interval plot( t*exp(-2*t), t=0..3 ); set delimiter (a set is an unordered list) y, x, y ;[ ] list delimiter (lists are ordered) [ y, x, y ];% refers to previous result (percent)

Note: Was " until Maple V, Release 5Int( exp(x^2), x=0..1 ):% = evalf( % );

" "(see ?strings)

string delimiter (double quote)Note: Changed in Maple V, Release 5 (see %)

plot( sin(10*x) + 3*sin(x), x=0..2*Pi,title="An interesting plot" );

` `(see ?names) name delimiter (back quote) `A name` := `This is a name.`;||(see also ?cat)

concatenate string or nameNote: Was . prior to Maple 6

a||3;a||(1..3);

´ ´(see ?uneval) delayed evaluation (single quote) x := ´x´;->(see ?-> and ?proc)

mapping (procedure) definition f := (x,y) -> x^2*sin(x-y);f(Pi/2,0);

@ composition operator (cos@arcsin)(x);@@ repeated composition operator (D@@2)(ln);

Mathematical Operations, Functions, and Constants

Symbol Description Example+, -, *, /, ^ add, subtract, multiply, divide, power 3*x^(-4) + x/Pi;sin, cos, tan,cot, sec, csc

trigonometric functions sin( theta-Pi/5 ) - sec( theta^2 );

arcsin, arccos,arctan, arccot,arcsec, arccsc

inverse trigonometric functions arctan( 2*x );

exp exponential function exp( 2*x );ln natural logarithm ln( x*y/2 );log10 common logarithm (base 10) log10( 1000 );abs absolute value abs( (-3)^5 );sqrt square root sqrt( 24 );! factorial k!;=, <>, <, <=, >, >= equations and inequalities

Note: E no longer exists; use exp(1)diff( y(x), x ) + x*y(x) = F(x);exp(Pi) > Pi^exp(1);

Pi, I π, i (mathematical constants)Note: Maple is case-sensitive

exp( Pi*I );

infinity infinity (∞) int( x^(-2), x=1..infinity );

NOTES:

• The document is also available on the World Wide Web in either PDF (http://www.math.sc.edu/ meade/maple/maple-ref.pdf) or PostScript (http://www.math.sc.edu/ meade/maple/maple-ref.ps).

• Please send comments, corrections, and suggestions for improvements to [email protected].

Page 117: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

CommandsCommand Description Example

restart clear all Maple definitions restart:with load a Maple package with( DEtools ); with( plots ):help (also ?) display Maple on-line help ?DEplotlimit calculate a limit limit( sin(a*x)/x, x=0 );diff compute the derivative of an expression diff( a*x*exp(b*x^2)*cos(c*y), x )int definite or indefinite integration int( sqrt(x), x=0..Pi );Limit inert (unevaluated) form of limit Limit( sin(a*x)/x, x=0 );Diff inert (unevaluated) form of diff Diff( a*x*exp(b*x^2)*cos(c*y), x );Int inert (unevaluated) form of int Int( sqrt(x), x=0..Pi );value evaluate an inert expression

(typically used with Limit, Diff, or Int)G := Int( exp(-x^2), x );value( G );

plot create a 2-dimensional plot plot( u^3, u=0..1, title="cubic" );plot3d create a 3-dimensional plot plot3d(sin(x)*cos(y),x=0..4*Pi,y=0..Pi);display combine multiple plot structures into a single

plot or modify optional settings in a plot(in plots package)

F:=plot( exp(x), x=0..3, style=line );G:=plot( 1/x, x=0..3, style=point );plots[display]([F,G], title="2 curves");

solve solve equations or inequalities solve( x^4 - 5*x^2 + 6*x = 2, x );fsolve solve using floating-point arithmetic fsolve( t/10 + t*exp(-2*t) = 1, t );dsolve solve ordinary differential equations;

see ?dsolve for a list of available optionsdsolve( diff(y(x),x)-y(x)=1, y(x) );

odeplot create 2D and 3D plots from solutions obtainedby dsolve (with type=numeric);see ?odeplot for more options(in plots package)

S:=diff(x(t),t)=-y(t),diff(y(t),t)=x(t):IC:=x(0)=1,y(0)=1:P:=dsolve(S,IC, x(t),y(t), numeric):odeplot(P, [[t,x(t)],[t,y(t)]], 0..Pi);odeplot(P, [x(t),y(t)], 0..Pi);

DEplot create plot associated with an ODE or system ofODEs; see ?DEplot for more information(in DEtools package)

ODE := diff( y(x),x ) = 2*x*y(x);DEplot( ODE, [y(x)], x=-2..2,

y=-1..1, arrows=SMALL );D differential operator

(often used when specifying derivativeinitial conditions for dsolve)

ODE := diff(y(x),x$2) +y(x) = 1;IC := y(0)=1, D(y)(0)=1;dsolve( ODE, IC , y(x) );

simplify apply simplification rules to an expression simplify( exp( a+ln(b*exp(c)) ) );factor factor a polynomial factor( (x^3-y^3)/(x^4-y^4) );convert convert an expression to a different form convert( x^3/(x^2-1), parfrac, x );collect collect coefficients of like powers collect( (x+1)^3*(x+2)^2, x );rhs right-hand side of an equation rhs( y = a*x^2 + b );lhs left-hand side of an equation lhs( y = a*x^2 + b );numer extract the numerator of an expression numer( (x+1)^3/(x+2)^2 );denom extract the denominator of an expression denom( (x+1)^3/(x+2)^2 );subs substitute values into an expression subs( x=r^(1/3), 3*x*ln(x^3) );eval evaluate an expression with specific values eval( 3*x*ln(x^3), x=r^(1/3));evalf evaluate using floating-point arithmetic evalf( exp( Pi^2 ) );evalc evaluate a complex-valued expression

(returns a value in the form a+I*b)evalc( exp( alpha+I*omega ) );

evalb evaluate a Boolean expression(returns true or false or FAIL)

evalb( evalf( exp(Pi) > Pi^exp(1) ) );

assign perform assignments(often used after solve or dsolve)

S:=solve( x+y=1, 2*x+y=3, x,y );assign( S ); x; y;

seq create a sequence seq( [0,i], i=-3..3 );for . . . from . . .to . . . by . . . in . . .while . . . do

. . . end do

repetition statement; see ?do for syntax(Note: od is an acceptable substitute for end do)

tot := 0;for i from 11 by 2 while i < 100 dotot := tot + i^2

end do;if . . . then . . . elif. . . else . . . end if

conditional statement; see ?if for syntax(Note: fi is an acceptable substitute for end if)

if type(x,name) then ’f’(x)else x+1 end if;

assume inform Maple of additional properties of objects assume( t>0 );about check assumptions on Maple objects about( t );

Page 118: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

114 Index

Worksheet FeaturesAutoSave, 59context bar, 56context-sensitive menu, 55, 58error message, 59execution group, 55–57, 60graphics region, 56, 60input region, 55, 56Maple worksheet, 55, 56menu bar, 56output region, 55, 56, 58package, 60palette, 55, 58, 63section, 57text region, 55, 56worksheet bar, 56, 58

Special Characters+, -, *, / (arithmetic), 62-> (arrow), 71:= (assignment), 65, 67: (colon), 62% (ditto, see also history), 64, 65, 104,

106= (equality), 65, 67? (see also help, 69[ ] (list), 73, 83, 84%? (palette placeholder), 63^, ** (power), 62$ (repetition), 66, 73, 79; (semi-colon), 62 (set), 73, 83, 84

Mathematical Constantsexp(1) (e, Euler’s constant), 63, 67I (i =

√−1), 68

infinity (∞), 63, 84Pi (π), 59, 67, 84

Mathematics Commandsadd, 104D (see also diff), 87diff, 86–89dsolve, 98–100eval, 80, 88-90, 94, 99, 104evalf, 60, 64, 66, 96, 97, 104, 110exp (exponential), 62fsolve, 67, 77complex, 77

implicitdiff, 88, 89

Int (see also int), 98, 104, 107int, 94, 96–98, 105–107intersect, 76isolate, 89limit, 85, 86left, 85right, 85

min, 69, 91minus, 78mul, 104plot, 69–71, 76, 77, 80–82, 99plot,options, 71color, 71linestyle, 70, 71scaling=constrained, 72, 73, 80, 82,

83style, 76, 80symbol, 76symbolsize, 76tickmarks, 81, 82

product, 104sum, 104union, 78value, 95, 98

General CommandsDigits, 66do .. end do, 93, 104–106, 109evalb, 77help, 58, 59, 61, 66, 71history (see also %), 104map, 75, 79nops, 77NULL, 61op, 104remove, 77, 104, 108restart, 57, 65, 104, 110rhs, 99select, 77, 104, 108selectremove (see also select and remove),

104seq, 75, 104, 109simplify, 86assuming, 104, 107

solve, 79, 80, 88, 89, 91, 94, 98, 99, 105,106, 108

sort, 79, 80, 104subs, 104unapply, 74, 90, 93

Page 119: at USC1 - University of South Carolinapeople.math.sc.edu/meade/141L-F03/manual/manual+labs.pdf(CEIT), and Computer Services Division (CSD) jointly purchase a site license for Maple

Index 115

unassign, 67, 68with, 59, 71, 72

MapletsDifferentiation, 96MapleNet, 87, 96Maplet Viewer, 87, 96TangentLinePlot, 87

PackagesDEtools, 100DEplot, 100, 101arrows, 100, 101

linalg, 80matrix, 58, 80, 81

Student[Calculus1], 71, 72, 86, 89, 92,95 97, 110

ApproximateInt, 95, 96method, 95output=plot, 95, 96

ArcLength, 97output=integral, 97

NewtonsMethod, 92, 93iterations, 92, 93output=plot, 93output=sequence, 93

Tangent, 85, 86output=line, 86

TaylorApproximation, 89, 90plots, 71, 72, 76, 80, 81display, 80–83insequence=true, 81, 83

implicitplot, 72, 80listplot, 76, 77

plottools, 82circle, 82