x y x y y z y z z 5 z 5 maple

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: astype,...) to select the operands of an expression that contain a certain type. > select( hastype, expr, ‘+‘ ); (3 + x) sin(1 + √ π) To find the subexpressions of a certain type rather than the operands that contain them, use the indets command. > indets( expr, ‘+‘ ); {3 + x, 1 + √ π} The two RootOfs in sol above are of type RootOf. Since the two RootOfs are identical, the set that indets returns contains only one element. > indets( sol, RootOf ); {RootOf(_Z 6 − b2 − a _Z 5 )} Not all commands are their own type, as is RootOf, but you can use the structured type specfunc(type, name ). This type matches the function name with arguments of type type. > type( diff(y(x), x), specfunc(anything, diff) ); true You can use this to find all the derivatives in a large differential equation. > DE := expand( diff( cos(y(t)+t)*sin(t*z(t)), t ) ) > + diff(x(t), t); 196 • Chapter 6: Evaluation and Simplification d DE := −sin(t z(t)) sin(y(t)) cos(t) ( dt y(t)) − sin(t z(t)) sin(y(t)) cos(t) d − sin(t z(t)) cos(y(t)) sin(t) ( dt y(t)) − sin(t z(t)) cos(y(t)) sin(t) + cos(t z(t)) cos(y(t)) cos(t) z(t) d + cos(t z(t)) cos(y(t)) cos(t) t ( dt z(t)) − cos(t z(t)) sin(y(t)) sin(t) z(t) d d − cos(t z(t)) sin(y(t)) sin(t) t ( dt z(t)) + ( dt x(t)) > indets( DE, specfunc(anything, diff) ); { d d d x(t), y(t), z(t)} dt dt dt The following operands of DE contain the derivatives. > select( hastype, DE, specfunc(anything, diff) ); d −sin(t z(t)) sin(y(t)) cos(t) ( dt y(t)) d − sin(t z(t)) cos(y(t)) sin(t) ( dt y(t)) d + cos(t z(t)) cos(y(t)) cos(t) t ( dt z(t)) d d − cos(t z(t)) sin(y(t)) sin(t) t ( dt z(t)) + ( dt x(t)) DE has only one operand that is itself a derivative. > select( type, DE, specfunc(anything, diff) ); d x(t) dt Maple recognizes many types. For a list, refer to the ?type help page. For more information on structured types, such as specfunc, refer to the ?type,structured help page. Substitution Often you want to substitute a value for a variable (that is, evaluate an expression at a point). For example, if you need to solve the problem, “If f (x) = ln(sin(xecos(x) )), find f (2),” then you must substitute the value 2 for x in the derivative. The diff command finds the derivative. 6.3 Structural Manipulations • 197 > y := ln( sin( x * exp(cos(x)) ) ); y := ln(sin(x ecos(x) )) > yprime := diff( y, x ); yprime := cos(x ecos(x) ) (ecos(x) − x sin(x) ecos(x) ) sin(x ecos(x) ) Use the eval command to substitute a value for x in yprime. > eval( yprime, x=2 ); cos(2 ecos(2) ) (ecos(2) − 2 sin(2) ecos(2) ) sin(2 ecos(2) ) The evalf command returns a floating-point approximation of the result. > evalf( % ); −0.1388047428 The command makes syntactical substitutions, not mathematical substitutions. This means that you can make substitutions for any subexpression. > subs( cos(x)=3, yprime ); cos(x e3 ) (e3 − x sin(x) e3 ) sin(x e3 ) But you are limited to subexpressions as Maple 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.

Ask a homework question - tutors are online