This preview shows page 1. Sign up to view the full content.
Unformatted text preview: c function Note: When Maple cannot ﬁnd a simpler form, it leaves the expression as it is rather than convert it to an inexact form.
> ln(Pi); ln(π ) 2.3 Basic Symbolic Computations Maple can work with mathematical unknowns, and expressions which contain them. 2.3 Basic Symbolic Computations > (1 + x)^2; • 17 (1 + x)2
> (1 + x) + (3  2*x); 4−x Note that Maple automatically simpliﬁes the second expression. Maple has hundreds of commands for working with symbolic expressions. For a partial list, see Table 2.2.
> expand((1 + x)^2); 1 + 2 x + x2
> factor(%); (1 + x)2 As mentioned in 2.2 Numerical Computations, the ditto operator, %, is a shorthand notation for the previous result.
> Diff(sin(x), x); d sin(x) dx
> value(%); cos(x)
> Sum(n^2, n); n2
n > value(%); 13 12 1 n− n+ n 3 2 6 18 • Chapter 2: Mathematics with Maple: The Basics Divide one polynomial in x by another.
> rem(x^3+x+1, x^2+x+1, x); 2+x Create a series.
> series(sin(x), x=0, 10); x− 15 1 1 13 x+ x− x7 + x9 + O(x10 ) 6 120 5040 362880 All the mathematical functions mentioned in the previous section also accept unknowns as arguments. 2.4 Assigning Expressions to Names This section introduces the following concepts in Maple. • Naming an object • Guidelines for Maple names • Maple arrow notation (>) • Assignment operator (:=) • Predeﬁned and reserved names Syntax for Naming an Object
Using the ditto operator, or retyping a Maple expression every time you want to use it, is not always convenient, so Maple enables you to name an object. Use the following syntax for naming. name := expression ; You can assign any Maple expression to a name.
> var := x; var := x 2.4 Assigning Expressions to Names > term := x*y; • 19 term := x y You can assign equations to names.
> eqn := x = y + 2; eqn := x = y + 2 Guidelines for Maple Names
Maple names can include any alphanumeric characters and underscores, but they cannot start with a number. Do not start names with an underscore because Maple uses these names for internal classiﬁcation. • Examples of valid Maple names are polynomial, test_data, RoOt_lOcUs_pLoT, and value2. • Examples of invalid Maple names are 2ndphase (because it begins with a number) and x&y (because & is not an alphanumeric character). Maple Arrow Notation in Deﬁning Functions
Deﬁne functions by using the Maple arrow notation (>). This notation allows you to evaluate a function when it appears in Maple expressions. You can do simple graphing of the function by using the plot command.
> f := x > 2*x^2 3*x +4; f := x → 2 x2 − 3 x + 4
> plot (f(x), x= 5..5);
70 60 50 40 30 20 10 –4 –2 0 2 x 4 20 • Chapter 2: Mathematics with Maple: The Basics For more information on the plot command, see chapter 5 or enter ?plot at the Maple prompt. The Assignment Operator
The assignment (:=) operator associates a function name with a function deﬁnition. The name of the function is on...
View
Full
Document
This note was uploaded on 08/27/2012 for the course MATH 1100 taught by Professor Nil during the Spring '12 term at National University of Singapore.
 Spring '12
 NIL
 Math, Division

Click to edit the document details