4 Trigonometry and Complex Numbers

Trigonometry developed from the study of triangles, particularly right triangles, and the relations between the lengths of their sides and the sizes of their angles. The trigono- metric functions that measure the relationships between the sides of similar triangles have far-reaching applications that extend far beyond their use in the study of triangles. Complex numbers were developed, in part, because they complete, in a useful and ele- gant fashion, the study of the solutions of polynomial equations. Complex numbers are useful not only in mathematics, but in the other sciences as well.

Trigonometry

Most of the trigonometric computations in this chapter use six basic trigonometric func- tions The two fundamental trigonometric functions, sine and cosine, can be de¿ned in terms of the unit circle—the set of points in the Euclidean plane of distance one from the origin. A point on this circle has coordinates +frv w> vlq w,,wherew is a measure (in radians) of the angle at the origin between the positive {-axis and the ray from the ori- gin through the point measured in the counterclockwise direction. The other four basic trigonometric functions can be de¿ned in terms of these two—namely, vlq { 4 wdq { @ vhf { @ frv { frv { frv { 4 frw { @ fvf { @ vlq { vlq { 3 ?w? For 5 , these functions can be found as a ratio of certain sides of a right triangle that has one angle of radian measure w.

Trigonometric Functions

The symbols used for the six basic trigonometric functions—vlq, frv, wdq, frw, vhf, fvf—are abbreviations for the words cosine, sine, tangent, cotangent, secant, and cose- cant, respectively.You can enter these trigonometric functions and many other functions either from the keyboard in mathematics mode or from the dialog box that drops down when you click or choose Insert + Math Name. When you enter one of these functions from the keyboard in mathematics mode, the function name automatrically turns gray when you type the ¿nal letter of the name. 90 Chapter 4 Trigonometry and Complex Numbers

Note Ordinary functions require parentheses around the function argument, while trigonometric functions commonly do not. The default behavior of your system allows trigonometric functions without parentheses. If you want parentheses to be required for all functions, you can change this behavior in the Maple Settings dialog. Click the Def- inition Options tab and under Function Argument Selection Method, check Convert Trigtype to Ordinary. For further information see page 126.

To ¿nd values of the trigonometric functions, use Evaluate or Evaluate Numeri- cally.

L Evaluate s s 6 4 4 vlq 7 @ 5 5 vlq +4, @ vlq 4 vlq 93 @ 5 6

L Evaluate Numerically

6 vlq 7 @ = :3:44 vlq +4, @ = ;747: vlq 93 @ = ;9936

The notation you use determines whether the argument is interpreted as radians or degrees: vlq 63 @ =<;;36 and vlq 63 @ =8. The degree symbol can be either a small green or red circle. The small green circle is entered from the Insert + Unit Name dialog. The small red circle appears on the Common Symbols toolbar and on the Binary Operations symbol panel, and must be entered as a superscript. With no symbol, the argument is interpreted as radians, and with either a green or red degree symbol, the argument is interpreted as degrees. All operations will convert angle measure to radians. See page 91 for a discussion of conversion. See page 37 for a discussion of units that can be used for plane angles. Your choice for Digits Used in Display in the Maple + Settings dialog determines the number of places displayed in the response to Evaluate Numerically.

Expression Evaluates Evaluate Numerically 4 vlq 7 5 5 =:3:44 ;:: vlq 476:3 vlq =58568 43;33 oq +vlq {, orj vlq { =7675< oq +vlq {, 43 oq5.oq8 46 6873 9=;39; 43Ã5 933

Solving Trigonometric Equations

You can use both Exact and Numeric from the Solve submenu to ¿nd solutions to trigonometric equations. These operations also convert degrees to radians. Use of deci- mal notation in the equation gives you a numerical solution, even with Exact. Trigonometry 91

Equation Solve +s Exact Solve + Numeric 4 { @ vlq 7 { @ 5 5 { @ =:3:44 47 47 vlq 55 @ f @ f @6:=6:6 f 44 vlq <3 Ã5 orj43 vlq { @ 4=49:< { @9=:<;; 43 { @6=3:69 3 46 Ã5 { @6 87 { @ 933 {@9=;39; 43

Note that the answers are different for the equation orj43 vlq { @ 4=49:<.Thisdif- ference occurs because there are multiple solutions and the two commands are ¿nding different solutions. The Numeric command from the Solve submenu offers the ad- vantage that you can specify a range in which you wish the solution to lie. Enter the equation and the range in different rows of a display or a one-column matrix.

L Solve + Numeric { @ 43 vlq { i{ @:=39;5j { 5 +8> 4, ,Solutionis:

The interval +8> 4, was speci¿ed for the solution in the preceding example. By specifying other intervals, you can ¿nd all seven solutions: i{ @3j, i{ @ 5=;856j, i{ @ :=39;5j, i{ @ ;=7565j, as depicted in the following graph. The Exact com- mand for solving equations gives only the solution { @3for this equation.

10

5

-10 -50 5 10 x

-5

-10

When any operation is applied to an angle represented in degrees by a mathematics superscript, such as 7;, degrees are automatically converted to radians. To go in the other direction, replace 5 radians with 693 and convert other angles proportionately. You can also solve directly for the number of degrees. Both methods follow.

L To convert radians to degrees (using ratios)

{ @ { 1. Write the equation 693 5 ,where represents radians. 2. Leave the insertion point in this equation.

3. From the Solve submenu, choose Exact or Numeric. 92 Chapter 4 Trigonometry and Complex Numbers

4. Name as the Variable to Solve for. 4;3 @ { 5. Choose OK to get .

L To convert radians to degrees (directly)

1. Write an equation such as [email protected] ,or(usingInsert + Unit Name) [email protected] .

2. Leave the insertion point in this equation.

693 3. From the Solve submenu, choose Exact or Numeric,toget @ or @447= 8<

46 { @ Example 17 Convert 933 radians to degrees as follows. 46 @ 933 1. Write the equation 693 5 . 2. Leave the insertion point in this equation.

6< 3. From the Solve submenu, choose Exact to get @ 43 degrees, or choose Numeric to get @6=< degrees=

-or- 46 @ 1. Write the equation 933 2. Leave the insertion point in this equation

6< 3. From the Solve submenu, choose Exact to get @ 43 , or choose Numeric to get @6=<.

See page 43 for additional examples of converting units.

L To change 3=< degrees to minutes

Apply Evaluate to 3=< 93 to get 3=< 93 @ 87=3 -or- Enter degree and minute symbols from the Unit Name dialog. Apply Solve to 3=< @ { 3 to get { @87=3 Trigonometry 93

To check these results, apply Evaluate to 6873 or 6 87 3 to get 46 6873 @ 6 87 3 @9= ;39 ; 43Ã5 udg 933 or

Trigonometric Identities

This section illustrates the effects of some operations on trigonometric functions. First, simpli¿cations and expansions of various trigonometric expressions illustrate many of the familiar trigonometric identities.

De¿nitions in Terms of Basic Trigonometric Functions Apply Simplify to the secant, and cosecant to ¿nd their de¿nition in terms of the sine and cosine functions.

L Simplify

4 4 vhf { @ fvf { @ frv { vlq {

Pythagorean Identities

L Simplify

vlq5 { .frv5 { @ 4 wdq5 { vhf5 { @ 4 frw5 { fvf5 { @ 4

Addition Formulas

L Expand

vlq +{ . |, @ vlq { frv | .frv{ vlq | frv +{ . |, @ frv { frv | vlq { vlq | wdq { .wdq| wdq +{ . |,@ 4 wdq { wdq |

Apply Combine + Trig Functions to the expansions of vlq +{ . |, and frv +{ . |, to return them to their original form and to change the expansion of wdq +{ . |, to the vlq+{.|, form frv+{.|, . 94 Chapter 4 Trigonometry and Complex Numbers

Double-Angle Formulas

L Expand

vlq 5 @ 5 vlq frv frv 5 @ 5 frv5 4 frv wdq 5 @ 5 +vlq , 5frv5 4

You can uncover other multiple-angle formulas with Expand. Following are some examples.

L Expand

vlq 9 @65vlq frv8 65 vlq frv6 .9vlq frv

vlq 57 @ ;6;;93; vlq frv56 7946:677 vlq frv54 . 4434337;3 vlq frv4< 47<7553;3 vlq frv4: . 45:33;:9; vlq frv48 :34;<389 vlq frv46 . 5867937; vlq frv44 8;8:5;3 vlq frv< . ;569;3 vlq frv: 97397 vlq frv8 .55;;vlq frv6 57 vlq frv

vlq+5d .6e, @ ; vlq d frv d frv6 e 9vlqd frv d frv e . ; frv5 d vlq e frv5 e 5 frv5 d vlq e 7 vlq e frv5 e . vlq e

Combining and Simplifying Trigonometric Expressions

Products and powers of trigonometric functions and hyperbolic functions are combined into a sum of trigonometric functions or hyperbolic functions whose arguments are in- tegral linear combinations of the original arguments.

L Combine + Trig Functions

4 4 5 4 4 vlq { vlq | @ 5 frv +{ |, 5 frv +{ . |,vlq{ @ 5 5 frv 5{ 4 4 5 4 4 vlq { frv | @ 5 vlq +{ . |,. 5 vlq +{ |,frv{ @ 5 frv 5{ . 5 8 8 4 8 8 vlq { frv { @ 845 vlq 43{ . 589 vlq 5{ 845 vlq 9{ 6 6 4 6 4 vlqk { frvk { @ 65 vlqk 9{ 65 vlqk 5{ vlqk { frvk { @ 5 vlqk 5{

The command Simplify combines and simpli¿es trigonometric expressions, as in the Trigonometry 95

following examples.

L Simplify

5 4 5 5 5 5 5 frv { . 7 vlq 5{ vlq { frv { . 5 vlq { @ frv { .5 +frv 6w . 6 frv w, vhf w @ 7 frv5 w vlq 6d . 7 vlq6 d @ 6 vlq d wdq 5 vlq 5 . frv 5 5 fvf vlq 5 @3

You may need to apply repeated operations to get the result you want. The order in which you apply the operations is not necessarily critical. You achieve the ¿rst of the following examples by applying Simplify followed by Expand. For the second example, apply Expand followed by Simplify.

L Simplify, Expand 4 +vhf w,+4.frv5w,@ +4 . frv 5w,@ 5frvw frv w

L Expand, Simplify

+vhf w,+4.frv5w, @ 5 vhf w frv5 w @ 5 frv w

Solution of Triangles

To solve a triangle means to determine the lengths of the three sides and the measures (in degrees or radians) of the three angles.

Solving a Right Triangle You can solve a right triangle with sides d> e> f and opposite angles > > , respectively, if you know the value of one side and one acute angle, or the value of any two sides.

Example 18 To solve the right triangle with one side of length f @5and one angle @ < ,

1. Choose New De¿nition from the De¿ne menu for each of the given values @ < and f @5.

: 2. Apply Evaluate to @ 5 to get @ 4; . 4 3. Apply Evaluate (or Evaluate Numerically)tod @ f vlq to get d @ 5 vlq < [email protected] =9;737,.

4 4. Apply Evaluate to e @ f frv to get e @ 5 frv < [email protected] 4=;:<7,.

Example 19 To solve a right triangle given two sides, say d @4

1. Apply De¿ne to each of the given values, d @4

2. Place the insertion point in the equation d5 . e5 @ f5. s 3. From the Solve submenu, choose Exact to get e @5 75. d d vlq @ frv @ 4. Place the insertion point in each of the equations f , f in turn.

4< 4< 5. From the Solve submenu, choose Exact to get @ dufvlq 56 , @ duffrv 56 = For a numerical result, evaluate these functions numerically, or choose Numeric rather than Exact from the Solve submenu in the ¿nal step. Youneed to specify intervals vlq @ [email protected] frv @ [email protected] for and ,suchas 5 +3>@5, and 5 +3>@5, , before applying Solve + Numeric or you may get a solution greater than 5 . Specifying these intervals gives the solution e @45=<9>@ =<:54 > @ =8<;:

Solving General Triangles The law of sines d e f @ @ vlq vlq vlq enables you to solve a triangle if you are given one side and two angles, or if you are given two sides and an angle opposite one of these sides. γ

b a

α

β c

Example 20 To solve a triangle given one side and two angles,

5 1. Use New De¿nition on the De¿ne submenu to de¿ne @ < , @ < ,andf @5 5 2. Evaluate @ to get @ 6 . 5 3. Use New De¿nition on the De¿ne submenu to de¿ne @ 6 . d f e f @ @ 4. Apply Solve + Exact to vlq vlq and to vlq vlq to get 7s 4 7s 5 d @ 6 vlq e @ 6 vlq 6 < and 6 < Trigonometry 97

You can apply Solve + Numeric to get numerical solutions, or you can evaluate the preceding solutions numerically. Using both the law of sines and the law of cosines, d5 . e5 5de frv @ f5 you can solve a triangle given two sides and the included angle, or given three sides.

Example 21 To solve a triangle given two sides and the included angle,

5< 1. De¿ne each of d @5=67, e @6=8:,and @ 549 . 2. Apply Solve + Exact to d5 . e5 5de frv @ f5 to get f @4=:588.

3. De¿ne f @4=:588. d f e f @ @ @ =8;;8< 4. Apply Solve + Exact to both vlq vlq and vlq vlq to get and @4=3437.

A triangle with three sides given is solved similarly: interchange the actions on and f in the steps just described.

Example 22 To solve a triangle given three sides,

1. De¿ne d @5=86, e @7=48,andf @9=4<.

2. Apply Solve + Exact to d5 . e5 5de frv @ f5 to get @5=678;.

3. De¿ne @5=678;. d f e f @ @ =5<965 @ 4. Apply Solve + Exact to vlq vlq to get ,andtovlq vlq to get @ =7<<7;.

Inverse Trigonometric Functions and Trigonometric Equations

The following type of question arises frequently when working with the trigonometric functions: for which angles { is vlq { @ |? There are many correct answers to these questions, since the trigonometric functions are periodic. The inverse trigonometric functions provide answers to such questions that lie within a restricted domain. The inverse sine function, for example, produces the angle { between 5 and 5 that satis¿es vlq { @ |. This solution is denoted by dufvlq { or vlqÃ4 {. The inverse trigonometric functions and a number of other functions are available in the dialog box that comes up when you click the Math Name buttonontheMath toolbar. They can also be entered from the keyboard in mathematics mode.

Example 23 To ¿nd the angle { (between 5 and 5 ) for which wdq { @433, 98 Chapter 4 Trigonometry and Complex Numbers

Leave the insertion point in the expression dufwdq 433= Apply Evaluate Numerically

This gives dufwdq 433 @ 4=893:<999

You can also ¿nd an angle satisfying wdq { @433by applying Solve + Numeric to the equation. This technique does not necessarily ¿nd the solution between 5 and 5 . In this case, in fact, it gives the solution { @435=3<4:9, which is 4=893:<999 . 65. You can specify the interval for the solution, as follows.

L Solve + Numeric

wdq { @433 , Solution is : i{ @4=893:<999j { 5 5 > 5

Using this technique, you can ¿nd solutions to a variety of trigonometric equations in speci¿ed intervals. Following are some examples of equations that you can solve with Solve + Exact and Solve + Numeric.

Equation Solve + Exact Solve + Numeric vlq w @ vlq 5w iw @3j > w @ 4 w @8=569 6 s ;wdq{ 46.8wdq5 { @6 { @ dufwdq 7 7 9 { @ 5=5;57 8 s 8 s 5 5 4 wdq { frw { @4 { @ dufvlq 5 5 5 8 { @5=56:

Note that Solve + Exact gives multiple solutions in these examples, whereas Solve + Numeric returns only one solution. In general, applying Evaluate Numerically to the exact solutions gives numerical solutions different from those produced by Solve + Numeric. This is a good place to experiment with a plot to visualize the complete solution. You can see in the following plot, for example, the pattern of crossings of the graphs of | @ wdq5 { frw5 { and | @4, depicting the solutions of the equation wdq5 { frw5 { @4.

10

5

-8 -6 -4 -20 2 4 6 8 x

-5

-10

| @wdq5 { frw5 {, | @4 Solutions can be found in a speci¿ed range with Solve + Numeric, as demonstrated Complex Numbers 99

in the following example. Enter the equation and the range in different rows of a one- column matrix.

L Solve + Numeric

5 ; wdq{ 46.8wdq { @6 , Solution is : i{ @ =;8<49j { 5 5 > 5

Complex Numbers

For a review of the arithmetic of complex numbers, see page 32.

DeMoivre’s Theorem

Any pair +d> e, of real numberss can be represented in polar coordinates with d @ u frv and e @ u vlq where u @ d5 . e5 is the distance from the point +d> e, to the origin d and is an angle satisfying wdq @ e . Thus any complex number can be written in polar form } @ u +frv . l vlq , where u @ m }m. DeMoivre’s Theorem says that if } @ u +frv . l vlq , and q is a positive integer, then }q @+u +frv w . l vlq w,,q @ uq +frv qw . l vlq qw, You can obtain this result for small values of q by the sequence of operations Expand followed by Combine + Trig Functions and then Factor.

L Expand, Combine + Trig Functions, Factor

+u +frv w . l vlq w,,6 @ u6 frv6 w .6lu6 frv5 w vlq w 6u6 frv w vlq5 w lu6 vlq6 w @ u6 frv 6w . lu6 vlq 6w @ u6 +frv 6w . l vlq 6w,

Or, you can use Simplify followed by Combine + Trig Functions and Factor.

L Simplify, Combine + Trig Functions, Factor

+u +frv w . l vlq w,,6 @7u6 frv6 w .7lu6 frv5 w vlq w 6u6 frv w lu6 vlq w @ u6 frv 6w . lu6 vlq 6w @ u6 +frv 6w . l vlq 6w,

uhlw You can get the same results in complete generality by working with , since uhlw q @ uqhlwq You can get the identity uhlw @ u +frv w . l vlq w, 100 Chapter 4 Trigonometry and Complex Numbers

lw with Evaluate.(Youwill¿nd that CTRL +E has no effect on the expression uh . This is one circumstance where Evaluate and CTRL +E produce a different result.)

L Evaluate, Factor

uhlw @ u frv w . lu vlq w @ u +frv w . l vlq w,

Another way to convert a complex number to polar form is to observe that { . l| @ m{ . l|m +frv +duj +{ . l|,, . l vlq +duj +{ . l|,,,

Example 24 The following sequence of operations will change the complex number 8.9l to polar form. s 1. Take the absolute value m8.9lm @ 94 to ¿nd the magnitude u,sothat s 8.9l @ 94 s8 . s9 l s 94 94 @ 94 frv duffrv s8 . l vlq dufvlq s9 94 94 duffrv s8 dufvlq s9 duj+8.9l, 2. Apply Evaluate Numerically to 94 (or 94 or ) to get the angle =;:939.

Thus, s 8.9l 94 +frv =;:939 . l vlq =;:939, =

3. Apply Evaluate Numerically to verify this result.

This produces s 94 +frv =;:939 . l vlq =;:939, @ 8=3.9=3l

Exercises

1. De¿ne the functions i+{,@{6 . { vlq { and j+{, @ vlq {5 . Evaluate i+j+{,,, j+i+{,,, i+{,j+{,,andi+{,.j+{,.

2. At Metropolis Airport, an airplane is required to be at an altitude of at least ;33 iw above ground when it has attained a horizontal distance of 4plfrom takeoff. What must be the (minimum) average angle of ascent?

3. Experiment with expansions of vlq q{ in terms of vlq { and frv { for q @4> 5> 6> 7> 8> 9 and make a conjecture about the form of the general expansion of vlq q{.

4. Experiment with parametric plots of +frv w> vlq w, and +w> vlq w,. Attach the point +frv 4> vlq 4, to the ¿rst plot and +4> vlq 4, to the second. Explain how the two graphs are related. Solutions 101

5. Experiment with parametric plots of +frv w> vlq w,, +frv w> w,,and+w> frv w,, together with the point +frv 4> vlq 4, on the ¿rst plot, +frv 4> 4, on the second, and +4> frv 4, on the third. Explain how these plots are related.

Solutions

¿ i+{,@{6 . { vlq { j+{, @ vlq {5 1. De ning functions and and evaluating gives i+j+{,, @ vlq6 {5 .vlq{5 vlq vlq {5 j+i+{,, @ vlq {6 . { vlq { 5 i+{,j+{,@ {6 . { vlq { vlq {5 i+{,.j+{,@ {6 . { vlq { . vlq {5

2. You can ¿nd the minimum average angle of ascent by considering the right triangle with legs of length ;33 iw and 85;3 iw. The angle in question is the acute angle with s ;33 sine equal to ;335.85;35 . Find the answer in radians with Evaluate Numerically: ;33 dufvlq s @ =4836: ;335 .85;35 You can express this angle in degrees by using the following steps: =4836: 693 @;=948: 5 3=948: 93 @ 69=<75 6: @; 6: 3 or by solving the equation =4836: udg @ ,Solutionis: i @;= 9489j

3. Note that vlq 5{ @5vlq{ frv { vlq 6{ @7vlq{ frv5 { vlq { vlq 7{ @;vlq{ frv6 { 7 vlq { frv { vlq 8{ @ 49 vlq { frv7 { 45 vlq { frv5 { . vlq { vlq 9{ @ 65 vlq { frv8 { 65 vlq { frv6 { .9vlq{ frv { It appears that in general, vlq q{ @5qÃ4 vlq { frvqÃ4 { where the remaining terms are of the form vlq { frvqÃ+5n.4, {.

4. The ¿rst ¿gure shows a circle of radius 4 with center at the origin. The graph is drawn by starting at the point +4> 3, and is traced in a counter-clockwise direction. The second ¿gure shows the |-coordinates from the ¿rst ¿gure as the angle varies from 3 to 5. The point +frv 4> vlq 4, is marked with a small circle in the ¿rst ¿gure. The corresponding point +4> vlq 4, is marked with a small circle in the second ¿gure. 102 Chapter 4 Trigonometry and Complex Numbers

1 1

0.5 0.5

-1 -0.50 0.5 1 0 123456

-0.5 -0.5

-1 -1

+frv w> vlq w, +w> vlq w,

5. The ¿rst ¿gure shows a circle of radius 4 with center at the origin. The graph is drawn by starting at the point +4> 3, and is traced in a counter-clockwise direction. The second ¿gure shows the {-coordinates of the ¿rst ¿gure as the angle varies from 3 to 5. The point +frv 4> vlq 4, is marked with a small circle in the ¿rst ¿gure. The corresponding point +frv 4> 4, is marked with a small circle in the second ¿gure. The third ¿gure shows the graph from the second ¿gure with the horizontal and vertical axes interchanged. The third ¿gure shows the usual view of | @ frv {.

1 6

5 0.5 4

-1 -0.50 0.5 1 3

2 -0.5 1

-1 -1 -0.50 0.5 1 +frv w> vlq w, +frv w> w,

1

0.5

0 123456

-0.5

-1

+w> frv w, 5 Function De¿nitions

The De¿ne options provide a powerful tool, enabling you to de¿neasymboltobe a mathematical object, and to de¿ne a function using an expression or a collection of expressions.

Function and Expression Names

A mathematical expression is a collection of valid expression names (see pge 103) com- bined in a mathematically correct way. The notation for a function consists of a valid function name (see page 103) followed by a pair of parentheses containing a list of vari- ables, called arguments. (Certain “trigtype” functions do not always require the paren- theses around the argument. See page 126.) The argument of a function can also occur as a subscript (see page 104). 6 Ã5 Examples of mathematical expressions: {, d e f, { vlq | . 6 frv }, d4d5 6e4e5

Examples of ordinary function notation: d +{,, J +{> |> },, i8 +d> e,, dq.

Valid Names for Functions and Expressions (Variables)

A variable or function name must be either

1. a single character (other than a standard constant), with or without a subscript -or-

2. a custom Math Name (see page 104), with or without a subscript. Expression names, but not function names, may include an arbitrary number of primes. Variables named with primed characters should be used with caution, as they are open to misinterpretation in certain contexts.

33 Examples of valid expression names include d, [ , i456, j, 4, h5, u , Zdogr (custom name), Mrkq6 (custom name with subscript).

Examples of valid function names include d, [ , i456, j, 4, h5, vlq, Dolfh (cus- tom name), Odqd5 (custom name with subscript). Examples of invalid function names include I (two characters), , h (standard 3 constants), ide (two-character subscript), u (reserved for derivative). 104 Chapter 5 Function De¿nitions

In the example of function names, the subscript on i456 is properly regarded as the number one hundred twenty three, not “one, two, three.”

Note Subscripts on expression or function names must be numbers or single charac- ters.

Subscripts As Function Arguments

A subscript can be interpreted either as part of the name of a function or variable, or as a function argument. In the examples above, the subscripts that appear are part of the name.

1. De¿ne dl @6l.IntheInterpret Subscript dialog that appears, choose Afunction argument.

2. De¿ne el @6l.IntheInterpret Subscript dialog that appears, choose Part of the name. Then Evaluate produces dl @6lel @6ld5 @9 e5 @ e5 Choose Show De¿nitions and you will see that these de¿nitions are listed as dl @6l (variable subscript)

el @6l Thus dl denotes a function with argument l,andel is only a subscripted variable.

Note A function cannot have both subscripted and in-line variables. For example, if you de¿ne id +|,@6d|, then d is part of the name and | is the function argument: id +8, @ 48di5 +8, @ 8i5 When you de¿ne id +|,@6d|, you will note that the Interpret Subscript dialog does not appear.

Custom Names

In general, function or expression names must be single characters or subscripted char- acters. However, the system includes a number of prede¿ned functions with names that appear to be multicharacter—such as jfg, lqi,andofp—but that behave like a single character in the sense that they can be deleted with a single backspace. You can create custom names with similar behavior that are legitimate function or expression names.

L To create a custom name

1. Click the Math Name icon, or from the Insert menu choose Math Name. Function and Expression Names 105

2. Type your custom name in the text box under Name.

3. Check Function or Variable for Name Type.

4. Choose OK.

The gray custom name appears on the screen at the insertion point. You can use this name to de¿ne a function or expression. You can copy and paste, or click and drag, this grayed name on the screen, or you can recreate it with the Math Name dialog. YouS canU choose Name Type to be Operator, in which case the custom name behaves like or with regard to Operator Limit Placement, or you can choose Name Type to be Function or Variable, in which case it behaves like an ordinary character with regard to subscripts and superscripts. S U q 4 e m g in-line operators: [email protected] , 3 , rshudwrud in-line function or variable: dn, yduldeohf displayed operators, and displayed function or variable: q ]4 [ e m g rshudwru dn yduldeohf d [email protected] 3

Automatic Substitution

L To make a custom name automatically gray

1. From the Tools menu, choose Automatic Substitution.

2. Enter the keystrokes that you wish to use. (This may be an abbreviated form of the custom name.) 106 Chapter 5 Function De¿nitions

3. Click the Substitution box to place the cursor there and, leaving Automatic Sub- stitution open, click the Math Name button .

4. Enter the custom name in the Name text box in the Math Name dialog.

5. Choose OK. (The custom name appears in the Auto Substitution box, in gray.)

6. Choose Save.

7. Choose OK.

De¿ning Variables and Functions

When you choose De¿ne on the Maple menu, the submenu that comes up has seven items: New De¿nition, Unde¿ne, Show De¿nitions, Clear De¿nitions, Save De¿- nitions, Restore De¿nitions, and De¿ne Maple Name. The choice New De¿nition can be applied both for de¿ning functions and for naming expressions.

Assigning Values to Variables, or Naming Expressions

You can assign a value to a variable with De¿ne + New De¿nition.Therearetwo options for the behavior of the de¿ned variable. The default behavior is “deferred eval- uation,” meaning the de¿nition is stored exactly as you make it. The alternate behavior is “full evaluation,” meaning the de¿nition that is stored takes into account earlier de¿- nitions in force that might affect it. See page 107 for a discussion of this option.

L To assign the value 58 to }

1. Type } @58in mathematics. De¿ning Variables and Functions 107

2. Leave the insertion point in the equation.

3. Click the New De¿nition button on the Compute toolbar or, from the De¿ne submenu, choose New De¿nition. Thereafter, until you exit the document or unde¿ne the variable, the system recog- nizes } as 58. For example, evaluating the expression “6.}” returns “@5;.” Another way to describe this operation is to say that an expression such as {5 .vlq{ can be given a name. Enter | @ {5 .vlq{, leave the insertion point anywhere in the expression, and then from the De¿ne submenu choose New De¿nition. Now, whenever you operate on an expression containing |, every occurrence of | is replaced by the expression {5 . vlq {. For example, Evaluate applied to |5 . {6 produces |5 . {6 @+{5 .vlq{,5 . {6 Note that these variables or names are single characters. See page 104 for information on multicharacter names. The value assigned can be any mathematical expression. For example, you could de¿ne a variable to be A number: d @578 A polynomial: s @ {6 8{ .4 {5 4 e @ A quotient of polynomials: {5 .4 de } @ Amatrix: fg U An integral: g @ {5 vlq {g{ You will ¿nd this feature useful for a variety of purposes.

Note The symbol s de¿ned previously represents the expression {6 8{ .4.Itisnot a function, so, for example, s+5, is not the polynomial evaluated at 5, but rather is twice s: s+5, @ 5s @5{6 43{ .5.

Compound De¿nitions It is legitimate to de¿ne expressions in terms of other expressions. For example, you can de¿ne u @6s ft and then v @ qu . t. Evaluating v will then give you v @ q +6s ft,.t.Rede¿ning u will change the evaluation of v.

Full Evaluation and Assignment With full evaluation, variables previously de¿ned are evaluated before the de¿nition is stored. Thus, de¿nitions of expressions can depend on the order in which they are made. Use an equals sign preceded by a colon to make an assignment for full evaluation.

L To assign the value 58 to } 108 Chapter 5 Function De¿nitions

1. Type } [email protected] 58d in mathematics.

2. Leave the insertion point in the equation.

3. Click the New De¿nition button on the Compute toolbar or, from the De¿ne submenu, choose New De¿nition. Thereafter, until you exit the document or unde¿ne the variable, if d has not been previously de¿ned, the system recognizes } as 58d.Ifd has previously been de¿ned to be { . |, then the system recognizes } as 58 +{ . |, = Try the following examples that contrast the two types of assignments, and look at the list displayed under De¿ne + Show De¿nitions for each case.

Example 25 Make the assignments d @4, { [email protected] d, | @ d,andd @5(in that order), and evaluate { and |. { @4 | @5

Example 26 Make the assignments d @ e, { [email protected] d5, | @ d5,andd @9(in that order), and evaluate { and |. { @ e5 | @69

Functions of One Variable

By using function notation, you can use the same general procedure to de¿ne a function as was described for de¿ning a variable.

L To de¿ne the function i whose value at { is d{5 . e{ . f

1. Enter the equation i +{,@d{5 . e{ . f.

2. Place the insertion point in the equation.

3. Click the New De¿nition button on the Compute toolbar or, from the De¿ne submenu, choose New De¿nition. Now the symbol i represents the de¿ned function and it behaves like a function. For example, apply Evaluate to i+w, to get i+w,@dw5 . ew . f and apply Evaluate to i 3+w, to get i 3+w,@5dw . e.

Compound De¿nitions If j and k are previously de¿ned functions (other than piecewise-de¿ned functions), then the following equations are examples of legitimate de¿nitions: De¿ning Variables and Functions 109

i+{,@5j+{, i+{,@j+{,.k+{, i+{,@j+{,k+{, i+{,@j+k+{,, i+{,@+j k,+{, Once you have de¿ned both j+{, and i+{,@5j+{,, then changing the de¿nition of j+{, will rede¿ne i+{,.

Note The algebra of functions includes objects such as i . j,i j, i j, ij,and i Ã4. For the value of i . j at {, write i+{,.j+{, for the value of the composition of two de¿ned functions i and j,writei+j+{,, or +i j,+{, and for the value of the product of two de¿ned functions, write i+{,j+{,. You can obtain the inverse (or inverse relation) for some functions i+{, by applying Solve + Exact to the equation i+|,@{ and specifying | as the Variable to Solve for.

Functions of Several Variables

De¿ne functions of several variables by writing an equation such as i+{> |> },@d{ . |5 .5} or j+{> |,@5{ . vlq 6{|, placing the insertion point in the equation, and choosing New De¿nition from the De¿ne submenu. Just as in the case of functions of one variable, the system always operates on expressions that it obtains from evaluating the function at a point.

Piecewise-De¿ned Functions

You can de¿ne functions that are described by different expressions on different parts of their domain, and you can evaluate, plot, differentiate, and integrate these functions. These are called piecewise-de¿ned functions or “case” functions. Note that there are strict conditions concerning the piecewise de¿nition of functions. They must be speci¿ed in a two- or three-column matrix with at least two rows, with the function values in the ¿rst column, “if” or “li” in the second column of a three-column matrix (and “if,” or any text, or no text, in the second column of a two-column matrix), followed by the range condition in the last (second or third) column. Also, the matrix must be fenced with a left brace and null right delimiter, as in the following examples. The range for the function value in the bottom row is always interpreted as “rwkhuzlvh,” so it is not necessary to cover the entire number line in the ranges you specify.

L To form the matrix for a piece-wise de¿nition

1. From the Brackets list below , choose for the left bracket and the null 110 Chapter 5 Function De¿nitions

delimiter (dashed vertical line) for the right bracket. (The dashed vertical line does not normally appear in a printed document. It appears on screen as a dashed red line, but only when View + Helper Lines is turned on.)

2. Click or choose Insert + Matrix.

3. Set the numbers for Rows (number of conditions) and Columns (3 or 2).

4. Click OK.

Functions should be entered as in the following examples. (When entering such functions, check Helper Lines on the View submenu, to see important details.) ; ? { .5 if {?3 i+{,@ 5 3 { 4 = if [email protected]{ if 4 ?{ ; A w w?3 A if ?A 3 if 3 w?4 j+w,@ 4 4 w?5 A if A 5 5 w?6 =A if 9 w if 6 w { .5 li { ? 4 k+{,@ [email protected]{ li 4 { { .5 {?4 n +{,@ [email protected]{ 4 {

L To de¿ne a piecewise-de¿ned function

1. Type the function values in a matrix enclosed in brackets as described.

2. Leave the insertion point in the function de¿nition.

3. Click or, from the De¿ne submenu, choose New De¿nition.

4 You can then choose Evaluate to get results such as i+4, @ 4, i+ 5 ,@5, i+5, @ 4, k+4, @ 4 and ; A { .5 {?3 A if ?A xqghqhg if { @3 i 3+{,@ 5 3 ?{?4 A if A xqghqhg { @4 =A if [email protected]{ if 4 ?{

Note To operate on piecewise-de¿ned functions, such as to evaluate, plot, differen- tiate, or integrate such a function, you can make the de¿nition and then work with the De¿ning Variables and Functions 111

function name i or the expression i+{,. You can also place the insertion point in the de¿ning matrix to carry out such operations.

L To plot a piecewise-de¿ned function

1. De¿ne a function i+{, as described above.

2. Select the expression i+{, or the function name i or select the de¿ning matrix.

3. Click or choose Plot 2D + Rectangular. For piecewise-de¿ned functions that are not continuous, the choices of the expression i+{, or only the function name i, can have different results. For the function | @ j+{, de¿ned above, which is not continuous, you can plot with or without vertical connecting lines by using either the expression j+{, or the function name j to generate the plot.

3 3

2 2

1 1 x -4 -2 2 4 -4 -2 2 4 0 0 -1 -1

-2 -2

-3 -3

-4 -4

-5 -5 j+{, j See page 154 for guidelines to plotting piecewise-de¿ned functions.

De¿ning Generic Functions

You can use De¿ne + New De¿nition to declare an expression of the form i+{, to be a function without specifying any of the function values or behavior. Thus you can use the function name as input when de¿ning other functions or performing various operations on the function.

L De¿ne + New De¿nition i+{, j+{,@{5 6{

L Evaluate i+j+{,, @ i {5 6{ j+i+{,, @ i 5 +{, 6i +{, 112 Chapter 5 Function De¿nitions

De¿ning Generic Constants

You can use De¿ne + New De¿nition to declare any valid expression name to be a constant. Such names will then be ignored under certain circumstances. For example, when identifying dependent and independent variables for implicit differentiation, a de- ¿ned constant is not considered as a variable. Observe the difference below, where d is ade¿ned variable and e is not.

L De¿ne + New De¿nition d

L Calculus + Implicit Differentiation

d{| @vlq| Solution: d| . d{|3 @ +frv +|,, |3 e{| @ vlq | Solution: e3{| . e| . e{|3 @+frv+|,, |3

Handling De¿nitions

The choices on the De¿ne submenu, in addition to New De¿nition, include Unde¿ne, Show De¿nitions, Clear De¿nitions, Save De¿nitions, Restore De¿nitions, and De¿ne Maple Name. The two choices New De¿nition and Show De¿nitions also appear on the Compute toolbar as and .

Showing De¿nitions

You view the complete list of currently de¿ned variables and functions for the document that is open by choosing Show De¿nitions from the De¿ne submenu or clicking on the Compute toolbar. A window comes up showing the de¿nitions that are active in the open document. The de¿ned variables and functions are listed in the order in which the de¿nitions were made.

Removing a De¿nition

You can remove from a document a de¿nition that you created with De¿ne + New De¿nition (or an assumption that you have created with dvvxph) in any of the following ways. Select the de¿ning equation, or select the name of the de¿ned expression or function, and from the De¿ne submenu choose Unde¿ne. From the De¿ne submenu, choose Clear De¿nitions (to cancel all de¿nitions dis- played under Show De¿nitions that were created with De¿ne + New De¿nition). Handling De¿nitions 113

Make another de¿nition with the same name. On the De¿nition Options page of Maple Settings, check Do Not Save.Closethe document. (See the next section, Saving and Restoring De¿nitions, for more detail on this option.) For the ¿rst option, you can select the equation or name by placing the insertion point within or on the right side of the equation or name that you wish to remove, or you can select the entire equation, expression, or function name by using the mouse. You can copy the de¿ning equation from the list of de¿nitions in the Show De¿nitions window and paste it into the document if you do not have a copy readily at hand.

Saving and Restoring De¿nitions

For each document, you can set the system

1. not to save or restore de¿nitions automatically (in which case you must actively choose to save or restore de¿nitions when you wish to do so),

2. to give you a prompt when you enter or exit the document asking whether you wish to save or restore de¿nitions, or

3. to save or restore de¿nitions automatically. To set the system to one of these options, from the Maple menu choose Settings, De¿nition Options, and make your choices in the dialog box.

The default for each new document is Always Save and Always Restore. You can override the default setting with Save De¿nitions and Restore De¿nitions from the De¿ne submenu. Choosing Save De¿nitions from the De¿ne submenu has the effect of storing all the currently active de¿nitions in the working copy of the current document. When the document is saved, the de¿nitions are saved with it. Restore 114 Chapter 5 Function De¿nitions

De¿nitions does the reverse—it takes any de¿nitions stored with the current document and makes them active.

Important If you change the default setting for a document in Maple Settings to Do Not Restore and you open, modify, and close the document without ¿rst choosing De¿ne + Restore De¿nitions, then any de¿nitions previously saved with the document will be lost and not recoverable.

Formulas

The Formula dialog provides a way to enter an expression and a Maple operation. What appears on the screen is the result of the operation and depends upon active de¿nitions of variables that appear in the formula. Formulas remain active in your document—that is, changing de¿nitions of relevant variables will change the data on the screen. When Helper Lines are turned on, a Formula is identi¿ed by a yellow background.

L To insert a formula

1. Click on the Field toolbar -or- From the Insert menu, choose Field and then choose Formula.

2. In the Formula area, enter a mathematics expression.

3. In the Operation area, enter the operation you want to perform on the expression. (Click the arrow to the right for a list of available operations.) Formulas 115

4. Choose OK. The results of the operation will be displayed on your screen.

Example 27 Choose Insert + Field + Formula.IntheFormula box, type d,and under Operations choose evaluate. Choose OK. The d will appear on your screen at the position of the insertion point. Now, at any point in your document, de¿ne d @ vlq {. The formula d will be replaced by the expression vlq {. Make another de¿nition for d. The formula will again be replaced by the new de¿nition everywhere the formula d appears in the document.

Example 28 Insert a 5 5 matrix. With the insertion point in the ¿rst input box, click .IntheFormula box, type d.UnderOperations, choose evaluate. Choose OK. 5 Repeat for each matrix entry, typing e, d .5e,and+d e, respectively in the formula box to get the following matrix: de d .5e +d e,5 Now de¿ne d @ vlq { and e @ frv {. The matrix will be replaced by the following matrix. vlq { frv { vlq { . 5 frv { +vlq { frv {,5 ¿ d @oq{ e @ h{ De ne and . The matrix will be replaced by the following matrix. oq {h{ oq { .5h{ +oq { h{,5

Example 29 Insert a table with 2 columns and 5 rows. Insert formulas {, |,and{ . | . } in the columns on the right. Date Income 1/31/96 { 2/28/96 | 3/31/96 } Total { . | . } De¿ne { @53=89, | @4;=<5, } @56=78 to get the table Date Income 1/31/96 53=89 2/28/96 4;=<5 3/31/96 56=78 Total 95= <6

Example 30 Multiple choice examinations with variations can be constructed using formulas. This example outlines a way for constructing them manually. For more infor- mation on an automatic way for creating such examinations, look for references to on- line quizzes in the Welcome document. (See Help Contents, What’s New, or choose Help + Search + Exam Builder.) 116 Chapter 5 Function De¿nitions

The questions depend on de¿nitions that are made globally for each document—they are not local to each question or variant. This means that you should use Math Names (see page 104) instead of single character names for variables. A sample question is shown below. The variables d4 and e4 shown in this question are math names. They should be entered as formulas—use Insert + Field + Formula followed by Insert + Math Name, or click and then click . You can create an examination with variations by making different de¿nitions for the variables such as the d4 and e4 shown in the following question. Turn on Helper Lines to check that all appropriate entries are formulas.

1. For which values of the variable { is d4 { e4 ? 3?

a. {?e4 @ d4 b. {Ae4 @ d4 c. {Ae4 d. {?e4 e. None of these

First variation:De¿ne d4 @ 5 and [email protected] placing the insertion point in each equation and choosing De¿ne + New De¿nition.

1. For which values of the variable { is 5{ 8 ? 3?

a. {[email protected] b. {[email protected] c. {A8 d. {?8 e. None of these

After printing a quiz, make different de¿nitions for d4 and e4 to obtain additional variations of the quiz.

Maple Functions

You can access Maple functions that do not appear as a menu item.

Accessing Maple Functions

L To access the Maple function pivot and to name it S

1. From the De¿ne submenu, choose De¿ne Maple Name.

2. Respond to the dialog box as follows. Maple Functions 117

Maple Name: pivot(x,i, j) Scienti¿c WorkPlace [Notebook] Name: S+{> l> m, File: (Leave blank.) Maple Packages Needed: (Check Linear Algebra Library.)

3. Check OK. This procedure de¿nes a function S +{> l> m, that performs a pivot on the l> m entry of a matrix {. 5 6 ;8 88 6: 68 Example 31 De¿ne { @ 7 <: 83 :< 89 8.De¿ne S +{> l> m,@pivot(x,i,j) 7< 96 8: 8< S+{> 5> 5, as described above. Then, evaluate5 to get 6 54: 3 7<< 466 9 43 43 8 : S+{> 5> 5, @ 7 <: 83 :< 89 8 6994 545: 656< 83 3 83 58 An extensive Maple library is included with your system. Here is a short list from the many examples that are available using the De¿ne Maple Name dialog. Maple Name Sample VQE Name Maple Packages Needed Heaviside(x) K+{, none nextprime(x) s+q, none isprime(n) t+q, none phi(n) *+q, numtheory legendre(a,b) O+d> e, numtheory galois(f) j+i, none interp(x,y,v) S+{> |> y, none Psi(x) #+{, none resultant(a,b,x) u+d> e> {, none ¿nduni(x,F) x+{> I , grobner gbasis(F,X) J+I> [, grobner Multiple notations for vectors are possible, including row or column matrices, and q-tuples enclosed by either parentheses or square brackets. However, to work with a Maple-de¿ned function, you must use appropriate Maple syntax for the function argu- ments. For example, gbasis from the Grobner library accepts a list entered with square brackets, such as ^d> e> f> g`, or a set entered with curly braces, such as i{5 .6{> 8{|j.

Example 32 Use De¿ne + De¿ne Maple Name to de¿ne a function J+[> \ , from the Maple function gbasis(X,Y) in the Grobner library. Apply Evaluate to get each of the following. J+^[ .4>\ .4>[\ . ]`> ^[> \> ]`, @ ^\ .4> 4.]> [ .4` 5 5 5 5 5 5 6 J+^\ ] .4>[ . \ >[] .4`> ^[> \> ]`, @ ] . [> \ . ] > 4.] 5 5 5 5 5 5 6 J+^ \ ] .4>[ . \ >[] .4`> ^]> \> [`, @ [ . \ >]. [> 4.[ J+ \ 5] .4>[5 . \ 5>[]5 .4 > ^\> [> ]`, @ ] . [> \ 5 . ]5> 4.]6 118 Chapter 5 Function De¿nitions

See page 397 for another example. In that section, the Maple function nextprime is used. Maple functions de¿ned in this way can be saved with and restored to a document with Save De¿nitions and Restore De¿nitions as described previously for de¿ned functions (see page 113). These functions, with their Maple name correspondences, appear in the Show De¿nitions window but they are not removed by Clear De¿nitions. To remove a Maple function, select the function name and choose Maple + De¿ne + Unde¿ne. The guidelines for valid function and expression names (see page 103) apply to the names that can be entered in the De¿ne Maple Name dialog box. You can give a multicharacter name to a Maple function as follows. With the De¿ne Maple Name dialog box open and the insertion point in the Scienti¿c WorkPlace (Notebook) Name box, click the Math Name icon , enter the desired function name, and click OK.

Adding User-De¿ned Maple Functions

You can access user-de¿ned functions written in the Maple language. Save the function to a ¿le ¿lename.m in a Maple session. While in a document, from the De¿ne submenu, choose De¿ne Maple Name. To access the function “myfunc” and name it “P,” respond to the dialog box as follows. Maple Name: myfunc(x) Scienti¿c WorkPlace (Notebook) Name: P+{, File: /dirname/subdirname/myfunc.m Maple Packages Needed: (Check the name of all pertinent Maple libraries. Leave blank if nothing special is called for.) Note the forward slashes in the subdirectory speci¿cation for the location of the .m ¿le. This syntax must be closely followed. It will be read in Maple as read ‘/dirname/subdirname/myfunc.m‘ This procedure de¿nes a function P+{, that behaves according to your Maple pro- gram. The guidelines at the beginning of this appendix for valid function and expression names apply to the names that can be entered in the De¿ne Maple Name dialog box. Maple functions accessed through the De¿ne Maple Name dialog can be saved with and restored to a document with Save De¿nitions and Restore De¿nitions,as described earlier for de¿ned functions. The Maple functions accessed through the De- ¿ne Maple Name dialog appear in the Show De¿nitions window, but they are not removed by Clear De¿nitions. To remove such a Maple function, select the function name and choose Maple + De¿ne + Unde¿ne.

Tables of Equivalents

Maple constants and functions are available either as items on the Maple menu or Tables of Equivalents 119 through evaluating mathematical expressions.

Maple Constants

The common Maple constants can be expressed in ordinary mathematical notation.

Maple V Htxlydohqw E h s I l or 4 (or m, see page 32) Pi Sq 4 gamma jdppd or olp p oq q q$4 [email protected]

Maple Menu Items

Following is a summary of equivalents for some of the common Maple functions and procedures together with the equivalent Maple menu item.

Algebra

Maple V Maple Menu eval Evaluate evalc Evaluate evalf Evaluate Numerically simplify Simplify combine Combine + Exponentials combine Combine + Logs combine Combine + Powers combine Combine + Trig Functions

Maple V Maple Menu factor Factor ifactor Factor expand Expand evalb Check Equality solve Solve + Exact fsolve Solve + Numeric isolve Solve + Integer rsolve Solve + Recursion 120 Chapter 5 Function De¿nitions

Maple V Maple Menu collect Polynomials + Collect Polynomials + Divide convert + parfrac Polynomials + Partial Fractions roots Polynomials + Roots sort Polynomials + Sort linalg[companion] Polynomials + Companion Matrix

Calculus Maple V Maple Menu student[intparts] Calculus + Integrate by Parts student[changevar] Calculus + Change Variables convert + parfrac Calculus + Partial Fractions student[leftsum] Calculus + Approximate Integral student[rightsum] Calculus + Approximate Integral student[middlesum] Calculus + Approximate Integral student[leftbox] Calculus + Plot Approx. Integral student[rightbox] Calculus + Plot Approx. Integral student[middlebox] Calculus + Plot Approx. Integral student[extrema] Calculus + Find Extrema Calculus + Iterate map + diff Calculus + Implicit Differentiation Power Series

Differential Equations

Maple V Maple Menu pdesolve Solve PDE dsolve + explicit Solve ODE + Exact dsolve + laplace Solve ODE + Laplace dsolve + numeric Solve ODE + Numeric dsolve + series Solve ODE + Series

Vector Calculus Maple V Maple Menu linalg[jacobian] Vector Calculus + Jacobian linalg[hessian] Vector Calculus + Hessian linalg[potential] Vector Calculus + Scalar Potential linalg[vecpotent] Vector Calculus + Vector Potential Vector Calculus + Set Basis Variables Tables of Equivalents 121

Matrices

Maple V Maple Menu linalg[adj] Matrices + Adjugate linalg[concat] Matrices + Concatenate linalg[charpoly] Matrices + Characteristic Polynomial linalg[colspace] Matrices + Column Basis linalg[cond] Matrices + Condition Number linalg[de¿nite] Matrices + De¿niteness Tests linalg[det] Matrices + Determinant linalg[eigenvals] Matrices + Eigenvalues linalg[eigenvects] Matrices + Eigenvectors Matrices + Fill Matrix linalg[ffgausselim] Matrices + Fraction-free Gaussian Elimination linalg[htranspose] Matrices + Hermitian Transpose

Maple V Maple Menu linalg[inverse] Matrices + Inverse linalg[jordan] Matrices + Jordan Form linalg[minpoly] Matrices + Minimum Polynomial linalg[norm] Matrices + Norm linalg[kenel] Matrices + Nullspace Basis linalg[orthog] Matrices + Orthogonality Test linalg[permanent] Matrices + Permanent linalg[LUdecomp] Matrices + PLU Decomposition linalg[QRdecomp] Matrices + QR Decomposition linalg[randmatrix] Matrices + Random Matrix linalg[rank] Matrices + Rank

Maple V Maple Menu Frobenius Matrices + Rational Canonical Form linalg[rref] Matrices + Reduced Row Echelon Form Matrices + Reshape linalg[rowspace] Matrices + Row Basis linalg[singularvals] Matrices + Singular Values Svd Matrices + SVD linalg[smith] Matrices + Smith Normal Form linalg[trace] Matrices + Trace linalg[transpose] Matrices + Transpose Edit + Insert Column(s) Edit + Insert Row(s) Edit + Merge Cells 122 Chapter 5 Function De¿nitions

Simplex Maple V Maple Menu simplex[dual] Simplex + Dual simplex[feasible] Simplex + Feasible simplex[maximize] Simplex + Maximize simplex[minimize] Simplex + Minimize simplex[standardize] Simplex + Standardize

Statistics Maple V Maple Menu stats[regression] Statistics + Fit Curve to Data + Multiple Regression stats[multiregress] Statistics + Fit Curve to Data + Multiple Regression stats[linregress] Statistics + Fit Curve to Data + Multiple Regression linalg[leastsqrs] Statistics + Fit Curve to Data + Polynomial of Degree n

Maple V Maple Menu stats[RandBeta] Statistics + Random Numbers + Beta stats[random[binomiald]] Statistics + Random Numbers + Binomial stats[random[cauchy]] Statistics + Random Numbers + Cauchy stats[RandChiSquare] Statistics + Random Numbers + Chi-Square stats[RandExponential] Statistics + Random Numbers + Exponential stats[RandFdist] Statistics + Random Numbers + F stats[RandGamma] Statistics + Random Numbers + Gamma stats[RandNormal] Statistics + Random Numbers + Normal stats[RandPoisson] Statistics + Random Numbers + Poisson stats[RandStudentsT] Statistics + Random Numbers + Student’s t stats[RandUniform] Statistics + Random Numbers + Uniform stats[random[weibull]] Statistics + Random Numbers + Weibull

Maple V Maple Menu stats[average] Statistics + Mean stats[median] Statistics + Median stats[mode] Statistics + Mode stats[correlation] Statistics + Correlation stats[covariance] Statistics + Covariance stats[describe,mean deviation] Statistics + Mean Deviation stats[describe,moment] Statistics + Moment stats[describe,quantile] Statistics + Quantile stats[sdev] Statistics + Standard Deviation stats[variance] Statistics + Variance Tables of Equivalents 123

Plot 2D

Maple V Maple Menu plot Plot 2D

Plot 3D

Maple V Maple Menu plot3d Plot 3D

Equivalents for Maple Expressions

The following tables give Maple examples with equivalent examples that can be evalu- ated with Maple + Evaluate or CTRL + E.

Algebra

Maple V Equivalent s sqrt(x) {or {[email protected] abs(x) m{m max(a,b,c) pd{+d> e> f, or d b e b f min(a,b,c) plq+d> e> f, or d a e a f gcd(x^2+1,x+1) jfg+{5 .4>{.4, 5 lcm(x^2+1,x+1) ofp+{ .4>{.4, À 456 oor(123/34) 67 456 ceil(123/34) 67

Maple V Equivalent 9 binomial(6,2) 5 factorial(x) or x! {$ 123 mod 17 456 prg 4: a&^nmodm dq prg p rem(3*x^3+2*x,x^2+1,x) 6{6 .5{ prg {5 .4 {a,b}union{b,c} id> ej^ie> fj {a,b}intersect{b,c} id> ej_ie> fj 4 if { 3 signum(x) vljqxp +{, 4 if {?3 124 Chapter 5 Function De¿nitions

Trigonometry

Maple V Equivalent sin(x) vlq { or vlq+{, ( See page 126.) cos(x) frv { or frv+{, tan(x) wdq { or wdq+{, cot(x) frw { or frw +{, sec(x) vhf { or vhf +{, csc(x) fvf { or fvf +{, arcsin(x) dufvlq { or vlqÃ4 { or dufvlq+{, or vlqÃ4+{, arccos(x) duffrv { or frvÃ4 { or duffrv+{, or frvÃ4+{, arctan(x) dufwdq { or wdqÃ4 { or dufwdq+{, or wdqÃ4+{, arccot(x) duffrw { or frwÃ4 { or duffrw +{, or frwÃ4 +{, arcsec(x) dufvhf { or vhfÃ4 { or dufvhf +{, or vhfÃ4 +{, arccsc(x) duffvf { or fvfÃ4 { or duffvf +{, or fvfÃ4 +{,

Exponential, Logarithmic, and Hyperbolic Functions

Maple V Equivalent exp(x) h{ or h{s+{, log(x) or ln(x) orj { or oq { or orj +{, or oq +{, ( See page 90.) log10(x) orj43 { or orj43+{, (See page 78) sinh(x) vlqk { or vlqk+{, cosh(x) frvk { or frvk+{, tanh(x) wdqk { or wdqk+{, coth(x) frwk { or frwk +{, Ã4 Ã4 arccosh(x) frvk { or frvk +{, Ã4 Ã4 arcsinh(x) vlqk { or vlqk +{, Ã4 Ã4 arctanh(x) wdqk { or wdqk +{,

Calculus

Maple V Equivalent g diff(x*sin(x),x) g{ +{ vlq {, D(f) i 3>Gi>G 3 D(f)(3) Ui +6, { vlq {g{ int(x*sin(x),x) U 4 { vlq {g{ int(x*sin(x),x = 0..1) 3 vlq { limit(sin(x)/x,x=0) olp{$3 { S4 l5 sum(i^2,2^i, i = 1..in¿nity) [email protected] 5l Tables of Equivalents 125

Complex Numbers

Maple V Equivalent Re(z) Uh +}, Im(z) Lp +}, abs(z) m}m 4 if Uh +}, A 3 or Uh +},@3and Lp +}, 3 csgn(z) fvjq+},, 4 if Uh +}, ? 3 or Uh +},@3and Lp +}, ? 3 + } if } [email protected] signum(z) vljqxp +},, m}m 3 if } @3 conjugate(z) }Æ

Linear Algebra

Maple V Equivalent DE multiply(A,B) 45Ã4 inverse(matrix(2,2,[1,2,3,4]) 67 45W transpose(matrix(2,2,[1,2,3,4]) 67 A D prg 4: map(x - x mod 17,A) 4 l .4 K htranspose(matrix(2,2,[1,I+1,-I,2]) l 5 multiply(A,inverse(B)) DEÃ4 map(x -A x mod 17,inverse(A)) DÃ4 prg 4: linalg[norm(x,n)] n{nq linalg[norm(x,frobenius)] n{nI linalg[norm(x,in¿nity)] n{n4

Vector Calculus

Maple V Equivalent grad(x*y*z,[x,y,z]) u{|} n+4> 6> 7,n norm(array([1,-3,4]),p) 5 6 5s 6 4 5 crossprod(array([1,-3,4]),array([2,2,-5])) 7 6 8 7 5 8 7 8 diverge(vector([x,x*y,y-z]),vector([x,y,z])) u+{> {|> | }, curl(vector([x,x*y,y-z]),vector([x,y,z])) u +{> {|> | }, laplacian(x^2*y*z^3,[x,y,z]) u5 {5|}6 126 Chapter 5 Function De¿nitions

Special Functions Maple V Equivalent BesselI(v,z) EhvvhoLy +}, or Ly+}, (See page 343 for notation.) BesselK(v,z) EhvvhoNy +}, or Ny+}, (See page 343 for notation.) BesselJ(v,z) EhvvhoMy +}, or My+}, (See page 343 for notation.) BesselY(v,z) Ehvvho\y +}, or \y+}, (See page 343 for notation.) +{,.+|, Ehwd +{> |, Beta(x,y) +{ . |, n S4 +4, Catalan Catalan’s constant [email protected] +5n .4,5 U oq w glorj +{, { gw dilog(x) 4 4 w 5 S hxohu +q, hxohu +q, @ 4 wq euler(n) hw . hÃw [email protected] q$ 5h{w S hxohu +q> {, hxohu +q> {, @ 4 wq euler(n,x) hw .4 [email protected] q$ U { 5 hui+{, s5 hÃw gw erf(x) error function: 3 erfc(x) 4 hui+{, complementary error function LambertW(x) OdpehuwZ+{,OdpehuwZ+{, hOdpehuwZ+{, @ {

Maple V Equivalent AiryAi(x) Dlu|Dl+{, Airy wave function (a solution to |33 |{ @3) AiryAi(n,x) Dlu|Dl+q> {, qth derivative of Dlu|Dl function AiryBi(x) Dlu|El+{, Airy wave function (a solution to |33 |{ @3) AiryBi(n,x) Dlu|El+q> {, qth derivative of Dlu|El function U Fl+{, jdppd . oq { { 4Ãfrv w gw Ci(x) cosine integral: U 3 w Hl+{, { hw gw Ei(x) exponential integral:U Ã4 w +{, 4 hÃww{Ã4gw GAMMA gamma function:U 3 { vlq w Si(x) Vl+{, sine integral: 3 w gw g Psi(x) Svl+{, Psi function: # +{,@ g{ oq+{, Psi(n,x) Svl+q> {, qth derivative of Psi function S 4 +{, +{,@ 4 vA4 Zeta(x) Zeta function: [email protected] qv for Zeta(n,s) +q> {, qth derivative of Zeta function

Trigtype Functions

Your system recognizes two types of functions—ordinary functions and trigtype func- tions. The gamma and exponential functions +{, and h{s +{, are examples of ordinary functions, and vlq { and oq { are examples of trigtype functions. The distinction is that the argument of an ordinary function is always enclosed in parentheses and the argument of a trigtype function often is not. Twenty six functions are interpreted as triptype functions: the six trig functions, the corresponding hyperbolic functions, the inverses of these functions written as “arc” Trigtype Functions 127

functions (e.g. dufwdq +{, ), and the functions orj and oq. These functions were identi- ¿ed as trigtype functions because they are commonly printed differently from ordinary functions in books and journal articles. There is no ambiguity in determining the argument of an ordinary function because it is always enclosed in parentheses. Consider +d . e, { for example. It is clear that the writer intends that be evaluated at d . e and then the result multiplied by {.However, with the similar construction vlq +d . e, {, it is quite likely that the sine function is intended to be evaluated at the product +d . e, {. If this is not what is intended, the expression is normally written as { vlq +d . e,,oras+vlq +d . e,, {. To ascertain how an expression you enter will be interpreted, place the insertion point in the expression and press CTRL +?.

L CTRL +?.

{ vlq {@[email protected]

You can reset your system to require that all functions be written with parentheses around the argument.

L To disable the trigtype function option

1. In the Maple Settings dialog, choose the De¿nitions Options page.

2. Check Convert Trigtype to Ordinary.

3. Choose OK.

Your system will then not interpret vlq { as a function with argument {, but will still recognize vlq +{,.

Determining the Argument of a Trigtype Function

Roughly speaking, the algorithm that decides when the end of the argument of a trigtype function has been reached stops when it ¿nds a . or sign, but tends to keep going as long as things are still being multiplied together. There many exceptions, some of which are shown in the following examples.

L CTRL +?

vlq { . 8 @ vlq { .8 It didn’t write vlq +{ .8,so { is the argument of vlq. vlq+d . e,{ @ vlq +d . e, { It didn’t write +vlq +d . e,, { ,so+d . e, { is the argument. vlq {+d . e, @ vlq { +d . e, It didn’t write +vlq {,+d . e, ,so{ +d . e, is the argument. vlq { frv { @vlq{ frv { It didn’t write vlq +{ frv {, so { is the argument of vlq. 128 Chapter 5 Function De¿nitions

vlq {+frv {.wdq{, @ vlq { +frv { . wdq {, It didn’t write +vlq {, +frv { .wdq{, so { +frv { .wdq{, is the argument of vlq. +vlq {, +frv { .wdq{, @ +vlq {, +frv { .wdq{, Here { is the argument of vlq. vlq +{,+d .frve, @ +vlq {,+d . frv e, Here { is the argument of vlq.

The algorithm stops parsing the argument of one trigtype function when it comes to another vlq { frv +d{ . e, @ +vlq {, +frv +d{ . e,, except when the second trigtype function is part of an expression inside expanding parentheses: vlq { +frv +d{ . e,, @ vlq +{ +frv +d{ . e,,,

Some examples with the ordinary function h{s +{,@h{ are included for compari- son.

vlq { frv +d{ . e, @ vlq { frv +d{ . e, In this case, frv +d{ . e, is not part of the argument. vlq { h{s +{, @ vlq +{ h{s +{,, In this case, h{s +e, is part of the argument. vlq { +frv +d{ . e,, @ vlq { +frv +d{ . e,, In this case, frv +d{ . e, is part of the argument. +vlq {, +frv +d{ . e,, @ +vlq {, +frv +d{ . e,, In this case, frv +d{ . e, is not part of the argument. vlq +{, +frv +d{ . e,, @ +vlq {, +frv +d{ . e,, In this case, frv +d{ . e, is not part of the argument. vlq { +d . h{s +e,, @ vlq { +d . h{s +e,, In this case, d . h{s +e, is part of the argument. +vlq {,+d . h{s +e,, @ +vlq {,+d . h{s +e,, In this case, d .h{s+e, is not part of the argument. vlq +{,+d . h{s +e,, @ +vlq {,+d . h{s +e,, In this case, d .h{s+e, is not part of the argument.

Division using ‘@’ is treated much like multiplication.

{ vlq { vlq { vlq {@5 @ vlq 5 but vlq+{,@[email protected] 5 and +vlq {, @[email protected] 5 vlq { vlq { { vlq {@ frv { @ frv { and +vlq {, @ frv { @ frv { but vlq +{@ frv {, @ vlq frv { | {| vlq {| vlq {|@5 @ vlq { 5 and vlq+{|,@5 @ vlq 5 but +vlq {|, @[email protected] 5

As the examples above show, parentheses enclosing both the function and its argu- ment will remove any ambiguity. If you write +vlq {|, }, the product {| will be taken as the argument of vlq. Exercises 129

Exercises

s 1. De¿ne d @8. De¿ne e @ d5. Evaluate e.NowDe¿ne d @ 5. Guess the value of e and check your answer by evaluation.

2. De¿ne i+{,@{5 .6{ .5. Evaluate i+{ . k, i+{, k and Simplify the result. Do computations in place to show intermediate steps in the simpli¿cation. 3. Rewrite the function i+{,@pd{ {5 4> : {5 as a piecewise-de¿ned function.

4. Experiment with the Euler phi function *+q,, which counts the number of positive integers n q such that jfg+n> q,@4. Use De¿ne + De¿ne Maple Name to open a dialog box. Type phi(n) as the Maple name, *+q, as the Vflhqwlf ZrunSodfh2Qrwherrn Name,andchecktheMaple Library Numtheory box. Test the statement “If jfg+q> p,@4then *+qp,@*+q,*+p,” for several speci¿c choices of q and p.

5. De¿ne g+q, by typing divisors(n) as the Maple name, g+q, as the Vflhqwlf ZrunSodfh2Qrwherrn Name, and check the Maple Library Numtheory box. Ex- plain what the function g+q, produces. (This is an example of a set-valued function, since the function values are sets instead of numbers.)

Solutions

s 1. If d @8then de¿ning e @ d5 produces e @58= Now de¿ne d @ 5. The value of e is now e @5.

2. Evaluate followed by Simplify yields i+{ . k, i+{, +{ . k,5 .6k {5 @ k k @5{ . k .6 +{.k,5.6kÃ{5 Select the expression @ k and with the CTRL keydowndragtheexpres- 5 sion to create a copy. Select the expression +{ . k, and with the CTRL key down choose Expand. Add similar steps (use Factor to rewrite 5{k . k5 .6k) until you have the following: i+{ . k, i+{, +{ . k,5 .6k {5 @ k k {5 .5{k . k5 .6k {5 @ k 5{k . k5 .6k @ k 130 Chapter 5 Function De¿nitions k +5{ . k .6, @ k @5{ . k .6 3. To rewrite i+{, @ pd{ {5 4> : {5 as a piecewise-de¿ned function, ¿rst note that the equation {5 [email protected]: {5 has the solutions { @ 5 and { @5. The function i is given by ; ? {5 4 if {?5 j+{,@ : {5 5 { 5 = if {5 4 if {A5 As a check, note that i+8,@57, j+8,@57, i+4,@9, j+4,@9, i+6,@;,and j+6, @ ;.

4. Construct the following table: q*+q, q*+q, q*+q, 4 4 44 43 54 45 5 4 45 7 55 43 6 5 46 45 56 55 7547957; 8 7 48 ; 58 53 9 5 49 ; 59 45 : 9 4: 49 5: 4; ; 7 4; 9 5; 45 < 9 4< 4; 5< 5; 43 7 53 ; 63 ; Notice, for example, that *+7 8, @ ; @ *+7,*+8, *+7 :, @ 45 @ *+7,*+:, *+6 ;, @ ; @ *+6,*+;,

5. We have the following table: qg+q, qg+q, qg+q, 4 i4j 44 i4> 44j 54 i4> 6> :> 54j 5 i4> 5j 45 i4> 5> 6> 7> 9> 45j 55 i4> 5> 44> 55j 6 i4> 6j 46 i4> 46j 56 i4> 56j 7 i4> 5> 7j 47 i4> 5> :> 47j 57 i4> 5> 6> 7> 9> ;> 45> 57j 8 i4> 8j 48 i4> 6> 8> 48j 58 i4> 8> 58j 9 i4> 5> 6> 9j 49 i4> 5> 7> ;> 49j 59 i4> 5> 46> 59j : i4> :j 4: i4> 4:j 5: i4> 6> <> 5:j ; i4> 5> 7> ;j 4; i4> 5> 6> 9> <> 4;j 5; i4> 5> 7> :> 47> 5;j < i4> 6>