Partial Derivative Calculations

Math 241 Lab Demo
W eek of April 20
Partial Derivative Calculations
The following examples illustrate how M aple can be used to handle some of the partial derivative problems
in Chapter 15, Section 5. See page 975.
The font for the output has been reduced to 10 points to
make the longer outputs easier to understand.
Exercise 47
Begin by defining the variable u as a function of x and t of the form given in the problem. Do not use z
because that letter should be reserved for the 3rd space dimension.
u d f xCa t Cg xKa t
f xCa t Cg xKa t
To verify u satisfies the wave equation:
v2 u
vt
2
= a2
vu
vx 2
(1)
, make the following entry.
diff u, t, t Ka 2 diff u, x, x
D
2
f
x C a t a2 C D
2
g
x K a t a2 K a2 D
2
f
xCa t CD
2
g
xKa t
(2)
The output should simplify to 0. Apply the simplify procedure to output (2).
simplify (2)
0
(3)
This can be done in one math entry, as illustrated below.
diff u, t, t K a 2 diff u, x, x ; simplify %
D
2
f
x C a t a2 C D
2
g
x K a t a2 K a2 D
2
f
xCa t CD
2
g
xKa t
0
Look out for this maneuver in the rest of the examples.
Exercise 48
Begin by defining u as a generic function of x and y. Terminate with a colon to suppress output.
u d f x, y :
Replace x and y with their equivalents in terms of the exponential and cosine and sine. M aple will
appreciate it if we change the name of the dependent variable to w.
w d f es cos t , es sin t
:
(4)
Math 241 Lab Demo
W eek of April 20
Now enter the right side of the identity equation and then simplify the output.
eK2 s diff w, s, s C diff w, t, t
eK2 s
es cos t , es sin t
f
D
1, 1
1, 2
es cos t C D
es cos t , es sin t
f
1, 2
es cos t , es sin t
f
C D
; simplify %
es cos t C D
2, 2
es sin t
es cos t , es sin t
f
es sin t
es cos t
es sin t K
KD
f
es cos t , es sin t
es sin t C D
f
es cos t , es sin t
es cos t
es sin t C
KD
f
es cos t , es sin t
es sin t C D
f
es cos t , es sin t
es cos t
es cos t
1, 1
1, 2
1, 2
2, 2
es cos t , es sin t
f
D
1, 1
CD
2, 2
es cos t , es sin t
f
(5)
Do you recognize output (5) as the left side of the identity in the text?
Exercise 51 (The Laplacian in polar coordinates)
Assume that
u d f r, q :
then express u in terms of x and y by replacing r and theta with their equivalents in rectangular coordinates.
This is done using the subs procedure. At the same time we change the dependent variable from u to w.
x 2 C y 2 , q = arctan
w d subs r =
y
,u
x
x 2 C y 2 , arctan
f
y
x
(6)
Enter and simplify the Laplacian of w.
diff w, x, x C diff w, y, y : simplify %
1
x 2 C y 2 3 /2
C
x2
x2 C y2 D
1, 1
x2 C y2 D
CD f
1
x 2 C y 2 , arctan
x 2 C y 2 , arctan
f
2, 2
f
x 2 C y 2 , arctan
y
x
y
x
C
y
x
x 2 C y 2 , arctan
y
x
x 2 C y 2 , arctan
y
x
C x2 D f
1
x2 C y2 D
1, 1
f
(7)
y2
y2
Convert output (7) to polar coordinates and simplify.
subs x = r cos q , y = r sin q , (7) : simplify %
1
csgn r
r2
CD f
1
csgn r D
2, 2
f
csgn r r, arctan
csgn r r, arctan
sin q
cos q
sin q
cos q
C csgn r r 2 D
1, 1
r
2
f
csgn r r, arctan
sin q
cos q
(8)
Math 241 Lab Demo
W eek of April 20
Question: What is going on with "csgn"?
Answer: The substitution changed x 2 C y 2 into r 2 cos2 q C r 2 sin2 q . This simplifies to
and then to csgn r r because Maple assumes that r is a complex variable.
r2 ,
Read "csgn(r)" as the "complex sign of r".
Fix this by applying simplify with the assumption that all variables are positive.
subs x = r cos q , y = r sin q , (7) : simplify % assuming positive
D
2, 2
f
r, arctan
sin q
cos q
C r2 D
1, 1
f
r, arctan
sin q
cos q
Cr D f
1
r, arctan
sin q
cos q
r2
(9)
To finish the simplification use an algebraic substitution (algsubs) to coax M aple into replacing
sin q
arctan
with q . (This is officially valid only when theta is betweenKp / 2 and p / 2 .)
cos q
Follow the algebraic substitution with an application of the expand procedure.
algsubs arctan
sin q
cos q
= q , (9) ; expand %
D
2, 2
r, q C r 2 D
f
r, q C r D f
f
1, 1
1
r, q
r2
D
2, 2
f
r2
r, q
CD
1, 1
r, q C
f
r, q
D f
1
r
Output (11) is the right side of the identity in Exercise 51: The Laplacian in polar coordinates.
3
(10)