Getting to Know Maple

Similar documents
Basic stuff -- assignments, arithmetic and functions

Section 1: Numerical Calculations

Choose the file menu, and select Open. Input to be typed at the Maple prompt. Output from Maple. An important tip.

Introduction to Matlab

POLYMATH POLYMATH. for IBM and Compatible Personal Computers. for IBM and Compatible Personal Computers

Introduction to Engineering gii

C1M0 Introduction to Maple Assignment Format C1M1 C1M1 Midn John Doe Section 1234 Beginning Maple Syntax any

MST30040 Differential Equations via Computer Algebra Fall 2010 Worksheet 1

Introduction to Sequences in Maple (Classic Version for Windows)

Introduction to Classic Maple by David Maslanka

YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM

The Graphing Calculator

Computer Programming in MATLAB

Matlab Introduction. Scalar Variables and Arithmetic Operators

Outline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline (Cont d) MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An

Outline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.

1 Maple Introduction. 1.1 Getting Started. 1.2 Maple Commands

Introduction. What is Maple? How to use this tutorial. Where can I find Maple?

10 Using the PCFL Editor In this chapter

Dr Richard Greenaway

Outline. CSE 1570 Interacting with MATLAB. Outline. Starting MATLAB. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.

Excel Tool: Calculations with Data Sets

Introduction to Programming with RAPTOR

Experiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?

1 A Section A BRIEF TOUR. 1.1 Subsection Subsection 2

Calculus II - Math 1220 Mathematica Commands: From Basics To Calculus II - Version 11 c

Sum and Difference Identities. Cosine Sum and Difference Identities: cos A B. does NOT equal cos A. Cosine of a Sum or Difference. cos B.

An Introduction to Maple and Maplets for Calculus

Graphics calculator instructions

Starting MATLAB To logon onto a Temple workstation at the Tech Center, follow the directions below.

INDEX INTRODUCTION...1

MAPLE CARD. All commands and constants must be typed in the case (UPPER or lower) that is indicated. Syntax Rules

ELEMENTARY MATLAB PROGRAMMING

LAB 1 General MATLAB Information 1

Calculus III. 1 Getting started - the basics

Algebra 1 Review. Properties of Real Numbers. Algebraic Expressions

Julia Calculator ( Introduction)

S H A R P E L R H UNIVERSITY OF SOUTHERN QUEENSLAND. The Learning Centre Learning and Teaching Support Unit

Graphing Calculator Tutorial

Basic Maple Tutorial

The following information is for reviewing the material since Exam 3:

Graphics calculator instructions

Macro Programming Reference Guide. Copyright 2005 Scott Martinez

Laboratory 1 Octave Tutorial

hp calculators HP 35s Using Algebraic Mode Calculation modes Functions of a single number in algebraic A simple example in algebraic

EXCEL 98 TUTORIAL Chemistry C2407 fall 1998 Andy Eng, Columbia University 1998

Dynamical Systems - Math 3280 Mathematica: From Algebra to Dynamical Systems c

AMS 27L LAB #1 Winter 2009

Graphics calculator instructions

An Introduction to Maple This lab is adapted from a lab created by Bob Milnikel.

General MATLAB Information 1

What is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment

ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu

Appendix H: Introduction to Maple

Section 5: Functions: Defining, Evaluating and Graphing

ü 1.1 Getting Started

Introduction to Mathcad

Learning the Language - V

Contents 20. Trigonometric Formulas, Identities, and Equations

1.1 evaluating expressions 2017 ink.notebook. August 18, page 7 page 8 Unit 1 Basic Equations and Inequalities. 1.1 Order of Operations.

MAT 003 Brian Killough s Instructor Notes Saint Leo University

1.1 Numbers system :-

Variables are used to store data (numbers, letters, etc) in MATLAB. There are a few rules that must be followed when creating variables in MATLAB:

Lecture 2 FORTRAN Basics. Lubna Ahmed

Name: Dr. Fritz Wilhelm Lab 1, Presentation of lab reports Page # 1 of 7 5/17/2012 Physics 120 Section: ####

1 Introduction to Matlab

FreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx

AP Calculus Summer Review Packet School Year. Name

Introduction to MATLAB

The Bisection Method versus Newton s Method in Maple (Classic Version for Windows)

Name: Teacher: Pd: Algebra 2/Trig: Trigonometric Graphs (SHORT VERSION)

MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras

Mathcad Lecture #1 In-class Worksheet Mathcad Basics

Dr. Relja Vulanovic Professor of Mathematics Kent State University at Stark c 2008

VARIABLES Storing numbers:

Welcome. Please Sign-In

Mathematica Basics. Exponential Functions Exp[expression] Natural Logarithms (ln) Log[expression]

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

2 Maple for APPL. 2.1 Numerical Computations

PART 1 PROGRAMMING WITH MATHLAB

Physics 251 Laboratory Introduction to Spreadsheets

Graphical Scientific CALCULATOR

Using the Equation Palette

Algebraic Expressions

Maple to Accompany Differential Equations. Douglas Hundley Department of Mathematics and Statistics Whitman College

C A S I O f x S UNIVERSITY OF SOUTHERN QUEENSLAND. The Learning Centre Learning and Teaching Support Unit

PROGRAMMING WITH MATLAB DR. AHMET AKBULUT

INTRODUCTION TO DERIVE - by M. Yahdi

Lesson 4: Numerical Computations; Newton's method

To start using Matlab, you only need be concerned with the command window for now.

Microsoft Excel 2010 Handout

Graphing Calculator Scientific Calculator Version 2.0

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

TABLE OF CONTENTS CHAPTER 1 LIMIT AND CONTINUITY... 26

Math 2250 MATLAB TUTORIAL Fall 2005

Casio fx-cg20. Calculator Instructions A B C D E F G. Contents:

Applied Calculus. Lab 1: An Introduction to R

Casio fx-cg20. Calculator Instructions A B C D E F G. Contents:

A Maple Tutorial. David Guichard. July 11, (modified by Albert Schueller, Jan 2011) (modified by Douglas Hundley, Jan 2013) 1 Getting Started 2

MATLAB Project: Getting Started with MATLAB

Transcription:

Maple Worksheets for rdinary Differential Equations Complimentary software to accompany the textbook: Differential Equations: Concepts, Methods, and Models (00-00 Edition) Leigh C. Becker Department of Mathematics Christian Brothers University 650 East Parkway South Memphis, TN 3804 Telephone: (90) 3-3443 FAX: (90) 3-3494 E-mail: lbecker@cbu.edu http://www.cbu.edu/~lbecker Getting to Know Maple Use the mouse to place the blinking cursor after the "greater than" symbol ( > ), immediately after this paragraph, unless it is already there. The symbol, >, is the Maple prompt. Then hit ENTER after you have read this paragraph. To keep reading more text or to execute a command, simply hit ENTER as many times as necessary. Make sure that you execute all commands and in the order in which they appear; for otherwise you may get responses that will not make sense. INTRDUCING MAPLE WITH ARITHMETIC. We begin this first worksheet with some commands to show you how to do arithmetic with Maple. To use one of the following arithmetic operations, use the symbol to its right. addition + subtraction - multiplication * division / exponentiation ^ or ** factorial! absolute value abs( ) The following are some Maple commands. Before you execute each of the following commands, predict how you think Maple will respond. Then execute the command by hitting ENTER to see the actual output that appears in the middle of the next line. -; $ -+3; -(+3); 00-0/4; (00-0)/4; 00-0/4+*3-; 0/4; 0/4+/3; $4 95 0 00 5 3

Note the order in which Maple carried out the previous operations. If you are not sure about the order of operations when writing Maple commands, use parenthesis. -^4; $6 (-)^4; abs(-^4); 5!; 0/+; Note that we have used a semicolon after each of the previous commands. In fact, every command in Maple must end with either a semicolon or a colon. The difference between these two endings is that the semicolon displays the output whereas the colon suppresses the output, even though the command is still carried out. For example, compare the responses to the following commands: *; *3: We can refer to the previous product of times 3 without having to type it again by using the ditto operator. It is represented by the percentage sign ( %). To see that the multiplication has actually been carried out, we place a semicolon after the percentage sign. %; 6 This particular text that you are now reading is a Maple paragraph. Note the facing-right bracket on the left that encloses this particular paragraph. This paragraph contains three sentences. More than one command may appear in the same line after a Maple prompt; for example, the next Maple prompt has three commands after it. +4/8+; ++3: ((^)^)^; 7 r, we may simply type just one command after each Maple prompt: +4/8+; ++3; ((^)^)^; 7 6 6 0 6 56 6 56

An execution group is either one command or several commands grouped together by a bracket. An execution group is easy to recognize--one or more Maple prompts are enclosed by a facing-right bracket. Up to now, all of the previous execution groups contained only one command, except for the last two. They each contained three commands. PREDEFINED CNSTANTS. Well-known mathematical constants are obtained by executing the following commands: Pi; *Pi/6; Note that the number sign ( # ) allows a comment to be made on the same line as a Maple command; in other words, Maple does not echo the commentary after #. I; I I represents a complex number whose square is -, as the following command verifies. I^; $ letter (, lower case) of the Greek alphabet. PI is capital ; that is:. Case sensitivity is shown by the following commands. In the next section, it will be shown how to evaluate predefined constants. pi; PI; alpha; Alpha; omega; mega; Infinity; InFiNiTy; infinity; 3 exp(); # The Euler's number of calculus,that is,.788... e Maple is case sensitive. Pi results in the irrational number ( that is, 3.459 to five decimal place); whereas pi is the 6th EXACT NUMBERS AND ARITHMETIC VERSUS DECIMAL APPRXIMATINS. Unlike calculators, Maple does exact arithmetic instead of using decimal approximations. This is illustrated by the following commands. Infinity InFiNiTy N 0/48; %-/; %+Pi+*Pi; 5

%+5*exp(3); To change this to a decimal approximation, called a floating-point number in Maple, we use the evalf command, which stands for "evaluate using floating-point arithmetic". evalf(%); evalf(+3*pi+5*exp(3));.85466 If we wish a decimal approximation for 0/48, we use the following command: evalf(0/48);.500000000 More examples: evalf(pi); evalf(exp()); The next command evaluates to 50 decimal places: evalf(pi,50); 3.459653589793384664338379508849769399375 Another way to force Maple to use decimal approximations is to use decimal places. Compare the responses to the following commands. /36;./36;./36.;.00/36.0; 3 *Pi/0; *Pi/0.; 0*exp(); 0*exp(.); C 3 C 3 C 5 e 3.85466 3.459654.78888 0.3333333333 0.3333333333 0.3333333333 5 0.000000000 0 e 7.8888 THE CMMAND: RESTART. The command restart should be one of the very first, and probably the very first, Maple command of every worksheet. The reason for this is that restart clears Maple's internal memory and allows the user to start calculations all over again without having to exit the worksheet, thereby losing the text and commands that have already been written. In other words, all past calculations and previously defined variables will be cleared from Maple's memory and will not interfere with future calculations. It is similar to writing down formulas on a whiteboard, assigning values to the variables and performing calculations, and then deciding that some of the variable assignments or calculations, or both, need to be changed. The command restart is like erasing all calculations and the values assigned to all of the variables from the board--but not the formulas and accompanying text--and then redoing the calculations. Let's execute the command by hitting ENTER.

restart: Even though it may seem as if nothing has happened after hitting ENTER, everything has been cleared from Maple's memory. To convince you of this, let's try the following experiment. First the letter x has been typed followed by a semicolon. x; x Note that "x" is the response. A response to a command, such as this one, is called an output. This particular output results in the variable called x. To assign a value to a variable, we use the assignment operator, which consists of the colon followed by the equal sign ( := ). The command name := value assigns "value" to "name". For example, to assign "x" the value "0", we use the command: x:=0; x := 0 Now whenever the command "x;" is executed, the response will be 0. x; 0 At any time, we are free to reassign the variable x another value or even an expression. Notice the outputs of the following commands. x:=p+q+5; x := p C q C 5 x; x-7; Now observe what happens when we execute the command restart followed by x; restart; x; x Note that Maple no longer remembers any of the previous values of x. The command restart removes the values of all the variables. What if we only wanted to reset the value of x but nothing else? This can be done by typing: x :='x'. bserve the output of the following commands: x:=; x := x; x:='x'; x; p C q C 5 p C q $ x := x x

ALGEBRA. Let's experiment with Maple's ability to handle algebra. Again before you execute each of the following commands, predict how Maple will respond. (x+y)^; x C y expand((x+y)^); (x+)*(y+4); expand((x+)*(y+4)); Note that Maple does not automatically multiply out the product of algebraic expressions; but the expand command will force Maple to carry out multiplications. Let's try another one. (3*x+*y)^4*(x+y); 3 x C y 4 x C y the ditto operator again (%). So, instead of typing: expand ( 3 x C y 4 x C y ), we can merely type: expand (%). Let's try it. expand (%); 8 x 5 C 97 x 4 y C 43 x 3 y C 3 x y 3 C x y 4 C 6 y 5 There is also the reverse of the expand command, namely, the factor command. factor(%); 3 x C y 4 x C y factor(*x^-x-5); BUILT-IN FUNCTINS. Some built-in functions along with the corresponding Maple name are the following: trigonometric functions: cos, sin, tan, sec, csc, cot inverse trigonometric functions: arccos, arcsin, arctan, arcsec, arccsc, arccot natural exponential function: exp natural logarithm function: ln or log square root function: sqrt Examples. sin(pi/4); tan(3); x C x y C y x C y C 4 x y C 4 x C y C 8 It is cumbersome to have to retype the expression again as the argument of the expand command. This is where we can use x C 5 x $ 3 tan(pi/); Error, (in tan) numeric exception: division by zero ln(); evalf(%); log(.); ln tan 3 0.69347806

USER-DEFINED FUNCTINS. We end this worksheet by showing how to define functions using functional operators, which are created with arrow notation: an arrow is made by typing a minus sign (-) followed by the greater than sign (>). An arrow is placed between the variable and an algebraic expression. We illustrate with some examples. Examples. restart: First we define the function f x = x C 5 and then evaluate at various values of x and expressions. f:=x->x+5; f := x/x C 5 f(); f(4); f(pi); f(pi); f(t); f(y+h+); Now we define another function: g:=s->s^-3*s+sin(s); g(0); g(pi/); evalf(%); f(0)+5*g(); evalf(%,4); Another way in which to define functions is to use the unapply command, which returns a function from an algebraic expression. We illustrate with the above algebraic expressions. restart: A:= x+5; A := x C 5 f:= unapply(a,x); f(4); f(pi); f(pi); f(t); f(y+h+); 0.69347806 7 9 C 5 C 5 t C 5 y C h C 6 g := s/s $ 3 sc sin s 0 4 $ 3 C $.44987880 5 C 5 sin 9.08 f := x/x C 5 9 C 5

Now for the second function: B:= s^-3*s+sin(s); g:= unapply(b,s); g(0); g(pi/); evalf(%); f(0)+5*g(); evalf(%,4); C 5 t C 5 y C h C 6 B := s $ 3 sc sin s g := s/s $ 3 sc sin s (b) Use the unapply command to define the function in Maple. Evaluate f to 0 decimal places at x =. ** End of "Getting to Know Maple" ** 0 4 $ 3 C $.44987880 5 C 5 sin 9.08 Exercise. x e Define the function f by f x = $ 4 sin 3 x x 5. (a) Use the arrow notation to define the function in Maple. Evaluate f at x =.5.