This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ) → −
> x(1,1); 28 527 − 7t − u 13 13 −646 13 You can create the functions y and z in the same manner.
> eval(y,s2); 635 70 + 12 t + u 13 13
> y := unapply(%,u,t); y := (u, t) → 635 70 + 12 t + u 13 13 3.1 The Maple solve Command > eval(z,s2); • 51 − 59 70 − 7t − u 13 13 > z := unapply(%, u, t); z := (u, t) → −
> y(1,1), z(1,1); 70 59 − 7t − u 13 13 861 −220 , 13 13 The assign Command
The assign command allocates values to unknowns. For example, instead of deﬁning x, y , and z as functions, assign each to the expression on the righthand side of the corresponding equation. > assign( s2 ); > x, y, z; − 28 635 70 70 59 527 − 7t − u, + 12 t + u, − − 7 t − u 13 13 13 13 13 13 Think of the assign command as turning the “=” signs in the solution set into “:=” signs. The assign command is convenient if you want to assign expressions to names. While this command is useful for quickly assigning solutions, it cannot create functions. This next example incorporates solving diﬀerential equations, which section 3.6 Solving Diﬀerential Equations Using the dsolve Command discusses in further detail. To begin, assign the solution.
> s3 := dsolve( {diff(f(x),x)=6*x^2+1, f(0)=0}, {f(x)} ); s3 := f(x) = 2 x3 + x 52 • Chapter 3: Finding Solutions > assign( s3 ); However, you have yet to create a function.
> f(x); 2 x3 + x produces the expected answer, but despite appearances, f(x) is simply a name for the expression 2x3 + x and not a function. Call the function f using an argument other than x.
> f(1); f(1) The reason for this behavior is that the assign command performs the following assignment
> f(x) := 2*x^3 + x; f(x) := 2 x3 + x which is not the same as the assignment
> f := x > 2*x^3 + x; f := x → 2 x3 + x • The former deﬁnes the value of the function f for only the special argument x. • The latter deﬁnes the function f : x → 2x3 + x so that it works whether you say f (x), f (y ), or f (1). To deﬁne the solution f as a function of x, use unapply.
> eval(f(x),s3); 2 x3 + x
> f := unapply(%, x); 3.1 The Maple solve Command • 53 f := x → 2 x3 + x
> f(1); 3 The RootOf Command
Maple occasionally returns solutions in terms of the RootOf command. The following example demonstrates this point.
> solve({x^5  2*x + 3 = 0},{x}); {x = RootOf(_Z 5 − 2 _Z + 3, index = 1)}, {x = RootOf(_Z 5 − 2 _Z + 3, index = 2)}, {x = RootOf(_Z 5 − 2 _Z + 3, index = 3)}, {x = RootOf(_Z 5 − 2 _Z + 3, index = 4)}, {x = RootOf(_Z 5 − 2 _Z + 3, index = 5)} RootOf(expr ) is a placeholder for all the roots of expr. This indicates that x is a root of the polynomial z 5 − 2z + 3, while the index parameter numbers and orders the solutions. This can be useful if your algebra is over a ﬁeld diﬀerent from the complex numbers. By using the evalf command, you obtain an explicit form of the complex roots.
> evalf(%); {x = 0.9585321812 + 0.4984277790 I }, {...
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