2250maplel1 S2009
2250maplel1 S2009
Due date: See the internet due dates. Maple lab 1 has four problems L1.1, L1.2, L1.3, L1.4.
Submitted work. Please submit one stapled package, the top sheet handwritten. The final pages are appendices made
by printing one or more maple work sheets. Hand work should do the steps shown in examples below. Maple code is
expected to parallel the code given in the examples below.
Tutorials. Students without maple exposure should attend one of the maple tutorials held for 2250 in the second week
of the semester. The brave may start their own tutorial by attempting this lab unaided or by starting with the maple
online tutorial; see Example 3 below.
References: Code in maple appears in 2250mapleL1-S2009.txt at URL http://www.math.utah.edu/~gustafso/s2009/.
This document: 2250mapleL1-S2009.pdf.
dy (x − 1)2
(A) ,y= 3 + xe−2x + cos(ln(x2 + 1))
dx x +1
(B) ∂x z, ∂y z, z = cosh x sinh 2y + ey tan 3x
(C) ∂c1 u, ∂c2 u, ∂c3 u, u = c1 x2 + c2 + c3 xe2x
(D) ∂x ∂y w, w = esin(xy) tan(ln(x2 y 2 + 1))
Start the hand solution on this page. Staple this page on top of the maple work sheets.
Examples on the next page . . .
Hint on L1.2: Investigate the help panels for cos , abs , exp , sinh and sin . See Example 3 for details on how
to do this. The constant π is coded in maple as Pi , the upper and lowercase letters being significant. A common
error is to code c=Pi; instead of the correct c:=Pi; . The error message empty plot can mean that a variable name
is undefined. For example, plot(x+PI,x=0..1); will not plot. To see why, use p:=plot(x+PI,x=0..1); to display
the plot data. The offending undefined variable name is PI, which is different than Pi or pi.
eq:=2*x^2+8*x+12:
ans:=[solve(eq=0,x)];
eq1:=2*(x-ans[1])*(x-ans[2])=0;
expand(eq1);
Notation: Square brackets delimit an array, e.g., F:=[-1,3,5]; defines array F with three elements −1, 3, 5. Symbol
F[1] extracts the first element from array F, while F[2] extracts the second element.
The construct f:=unapply(xˆ2+5*x+6,x) is an inline function definition. Subsequent use of the symbol f requires
two parentheses and a function argument, e.g., f(x), f(-1.1) are valid.
The inline function definition f:=x->xˆ2+5*x+6 uses a minus sign − and a greater than sign > to separate the
variable name x from the function definition xˆ2+5*x+6 . This alternative construction may appear in later maple
code. In this elementary example, there is no difference between the two constructs. The maple function unapply is
more robust and produces fewer surprises for novice maple users.
3x4
Example 3. Compute the derivative of y = + sin 2x + ex cos 3x and check the answer in maple.
(x + 1)2
Solution: The hand solution uses the quotient rule, chain rule and product rule. Let y = y1 + y2 + y3 , where
3x4
y1 = , y2 = sin 2x and y3 = ex cos 3x. Then
(x + 1)2
(top)0 (bot) − (top)(bot)0
y10 =
(bot)2
12x (x + 1)2 − 6x2 (x + 1)
2
=
(x + 1)4
y20 = 2 cos 2x by the chain rule
y30 = (first)0 (second) + (first)(second)0
= ex cos 3x − 3ex sin 3x.
The code for maple:
2
The displayed answer for y 0 :
x3 x4
12 2 −6 3 + 2 cos (2 x) + ex cos (3 x) − 3 ex sin (3 x)
(x + 1) (x + 1)
∂z ∂z
Example 4. Given z = 2y + xy + (3x + 4y)2 , compute and and check the answer.
∂x ∂y
∂z ∂z
Solution: By hand, using the chain rule, = 0 + y + 6(3x + 4y) and = 2 + x + 8(3x + 4y). The maple answer
∂x ∂y
check:
z:=2*y+x*y+(3*x+4*y)^2:
dzdx:=diff(z,x);dzdy:=diff(z,y);
!
∂x z1 ∂y z1 ∂x z1 ∂y z1
Example 5. Compute the Jacobian matrix and its determinant at x = y = 0:
∂x z2 ∂y z2 ∂x z2 ∂y z2
z1 = (3x + y + 1)2 , z2 = xy + 2x + 3y
z1:=(3*x+y+1)^2: z2:=x*y+2*x+3*y:
J:=VectorCalculus[Jacobian]([z1,z2],[x,y]);
DJ:=LinearAlgebra[Determinant](J);
subs(x=0,y=0,J);
subs(x=0,y=0,DJ);
unapply, plot, expand, factor, ifactor, solve, fsolve, array, set, for, do, parse, plot3d,
dsolve, int, diff, newuser, exp, sin, cos, tan, sinh, cosh, ln, log