Sections22-02.mws

Unit 4: Vector Calculus

Chapter 22: Non-Cartesian Coordinates

Sections22.2: vector operators in polar coordinates

Copyright

Copyright * 2001 by Addison Wesley Longman, Inc.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America.

Initializations

> restart;

> with(linalg):
with(plots):
with(plottools):
read(`C:/Program Files/Maple 6.01/pvac.txt`):

Warning, the protected names norm and trace have been redefined and unprotected

Warning, the name changecoords has been redefined

>

Gradient in Polar Coordinates

In cartesian coordinates, the gradient of the scalar u(x,y) is the vector

> grad(u(x,y),[x,y]);

MATRIX([[diff(u(x,y),x)], [diff(u(x,y),y)]])

>

which is interpreted as the vector

u[x] i + u[y] j

where i and j are unit basis vectors for the cartesian system. What does it mean to compute the gradient of the scalar u(r,theta) in polar coordinates? What does Maple give?

> grad(u(r,theta),[r,theta],coords=polar);

MATRIX([[diff(u(r,theta),r)], [diff(u(r,theta),thet...

>

Next, we explore how this vector was obtained, and what it actually means.

>

Gradient in Polar Coordinates - Derivation

Recall the equations defining polar coordinates

> X := r*cos(theta);
Y := r*sin(theta);

X := r*cos(theta)

Y := r*sin(theta)

>

and the equations defining the inverse transformation

> R := sqrt(x^2+y^2);
T := arctan(y/x);

R := sqrt(x^2+y^2)

T := arctan(y/x)

>

Notice the care with which name clashes were avoided.

Write the radius vector R = x i + y j in Maple as Rc , where x = x(r,theta) and y = y(r,theta) , obtaining

> Rc := vector([X,Y]);

Rc := MATRIX([[r*cos(theta)], [r*sin(theta)]])

>

If theta is held constant and r allowed to vary, R = R ( r ), so an r -coordinate curve is traced in the xy -plane. For example, set theta = 1,

> R1 := subs(theta=1,op(Rc));

R1 := MATRIX([[r*cos(1)], [r*sin(1)]])

>

and plot the resulting r -coordinate curve which turns out to be a radial line emanating from the origin.

> plot([R1[1], R1[2], r = 0..1], color=black, labels=[x,y]);

[Maple Plot]

>

Alternatively, set r = 1 and let theta vary, so the radius vector defines the theta -coordinate curve

> R2 := subs(r = 1, op(Rc));

R2 := MATRIX([[cos(theta)], [sin(theta)]])

>

which, when plotted, is, a circle centered at the origin.

> plot([R2[1], R2[2], theta = 0..2*Pi], color=black, labels=[x,y], scaling=constrained);

[Maple Plot]

>

A fundamental idea of vector calculus, now long familiar, is that differentiation of a curve with respect to its parameter yields a vector tangent to that curve. Apply that principle to the radius vector R( r , theta ), first differentiating with respect to r , and then with respect to theta . In the first case, obtain a vector tangent to an r -coordinate curve (a radial line) and in the second, a vector tangent to a theta -coordinate curve, a circle about the origin.

Figure 22.7, created below, shows a sketch of the vectors diff(``,r) R and diff(``,theta) R drawn at ``(x,y) = ``(sqrt(2),sqrt(2)) .

> p1 := circle([0,0],2):
p2 := plot([[0,0],[4*cos(Pi/4),4*sin(Pi/4)]],color=black):
p3 := arrow([sqrt(2),sqrt(2)],vector([1,1]),.1,.3,.2,color=black):
p4 := arrow([sqrt(2),sqrt(2)],vector([-2,2]),.1,.3,.2,color=black):
p5 := textplot([.5,.2,`q`],font=[SYMBOL,10]):
p6 := textplot({[2.25,1.78,`R `],[-1,2.9,`R `]},font=[TIMES,BOLD,12]):
p7 := textplot([2.45,1.72,`r `],font=[TIMES,ITALIC,10]):
p8 := textplot([-.8,2.8,`q `],font=[SYMBOL,10]):
p9 := textplot([.2,3.6,`y`], font=[TIMES,ITALIC,12]):
display([p||(1..9)],scaling=constrained, xtickmarks=5, ytickmarks=[-2,-1,0,1,2,4], view=[-2..3,-2..4], labels=[x,``], labelfont=[TIMES,ITALIC,12]);

[Maple Plot]

>

The vector tangent to the r -coordinate curve is automatically a unit vector. The vector tangent to the theta -coordinate curve needs to be normalized since it does not automatically have unit length. Typical notation for these unit vectors in polar coordinates is

e ``[r] = R ``[r] = cos(theta) i + sin(theta) j

and

e ``[theta] = 1/r R ``[theta] = -sin(theta) i + cos(theta) j

However, to avoid violating Lopez's Large Law (Never use as a name on the left, a variable in use on the right), name these unit tangent vectors E[r] and E[theta] in Maple.

First, differentiate with respect to r .

> E[r] := map(diff,Rc,r);

E[r] := MATRIX([[cos(theta)], [sin(theta)]])

>

Second, differentiate with respect to theta

> Q := map(diff,Rc,theta);

Q := MATRIX([[-r*sin(theta)], [r*cos(theta)]])

>

and normalize, obtaining

> E[theta] := map(simplify,normalize(Q),symbolic);

E[theta] := MATRIX([[-sin(theta)], [cos(theta)]])

>

Solving for i and j in terms of e ``[r] and e ``[theta] , we have

i = cos(theta) e ``[r] -sin(theta) e ``[theta]

and

j = sin(theta) e ``[r]+cos(theta) e ``[theta]

which we obtain in Maple as follows.

Introduce the i and j basis vectors of the cartesian frame by the following device.

> q1 := e[r] = dotprod(E[r],[i,j], orthogonal);
q2 := e[theta] = dotprod(E[theta],[i,j], orthogonal);

q1 := e[r] = cos(theta)*i+sin(theta)*j

q2 := e[theta] = -sin(theta)*i+cos(theta)*j

>

These are now two equations in the two unknowns i and j which can be solved for i and j in terms of the polar coordinate basis vectors e[r] and e[theta] .

> q3 := solve({q1,q2}, {i,j});

q3 := {j = cos(theta)*e[theta]+e[r]*sin(theta), i =...

>

To emphasize this result, induce Maple to write i and j in terms of e[r] and e[theta] .

> i = subs(q3, i);
j = subs(q3, j);

i = -e[theta]*sin(theta)+cos(theta)*e[r]

j = cos(theta)*e[theta]+e[r]*sin(theta)

>

The point here is to discover the proper expressions for the gradient and laplacian of a scalar-valued function, and the divergence of a vector-valued function, when each is given in polar coordinates. Since the expression for the gradient in cartesian coordinates is already known, use that knowledge to deduce the result for polar coordinates.

Start with the expression for the gradient in cartesian coordinates.

> q4 := grad(u(x,y),[x,y]);

q4 := MATRIX([[diff(u(x,y),x)], [diff(u(x,y),y)]])

>

This gradient vector, given explicitly in terms of the fixed cartesian basis vectors i and j , is

> q5 := q4[1]*i + q4[2]*j;

q5 := diff(u(x,y),x)*i+diff(u(x,y),y)*j

>

The conversion process begins by replacing the vectors i and j with their equivalents in terms of e[r] and e[theta] .

> q6 := subs(q3, q5);

q6 := diff(u(x,y),x)*(-e[theta]*sin(theta)+cos(thet...

>

This looks a bit better if the coefficients of the basis vectors e[r] and e[theta] are collected via

> q7 := collect(q6, [e[r], e[theta]]);

q7 := (diff(u(x,y),x)*cos(theta)+diff(u(x,y),y)*sin...

>

Then, we have to transform the partial derivatives by the use of the chain rule.

The second step expresses u(x,y) as U(r(x,y),theta(x,y)) prior to using the chain rule for determining the equivalents of the partial derivatives u[x] and u[y] in polar coordinates. For insight, consider the function

> h := (x,y) -> x*y^2;

h := proc (x, y) options operator, arrow; x*y^2 end...

>

and change to polar coordinates, obtaining h(x(r,theta),y(r,theta)) = H(r,theta) , which is then

> H := unapply(h(X,Y),r,theta);

H := proc (r, theta) options operator, arrow; r^3*c...

>

The introduction of H(r,theta) is essential, since it is a different function of r and theta than h(x,y) was a function of x and y .

In h(x,y) the first variable, x , simply multiplies the square of the second.

In H(r,theta) , the first variable, r , is cubed.

Thus, two different letters, f and F are more than appropriate, they are necessary.

Now, go back the other way by computing H(r(x,y),theta(x,y)) = h(x,y) , obtained in Maple via

> simplify(H(R,T),symbolic);

x*y^2

>

This second identity, namely,

h(x,y) = H(x(r,theta),y(r,theta))

is the starting point for the partial differentiations about to take place.

Thus, start with

u(x,y) = U(r(x,y),theta(x,y))

entered into Maple as

> u := U(R, T);

u := U(sqrt(x^2+y^2),arctan(y/x))

>

Differentiate with respect to x and y to obtain the partials

u[x] = U[r]*r[x]+U[theta]*theta[x]

and

u[y] = U[r]*r[y]+U[theta]*theta[y]

Since

r[x] = cos(theta)

theta[x] = -sin(theta)/r

r[y] = sin(theta)

theta[y] = cos(theta)/r

the gradient in cartesian coordinates becomes

[U[r]*cos(theta)-U[theta]*``(sin(theta)/r)] [ cos(theta) e ``[r]-sin(theta) e ``[theta] ] + [U[r]*sin(theta)+U[theta]*``(cos(theta)/r)] [ sin(theta) e ``[r]+cos(theta) e ``[theta] ]

= U[r] e ``[r]+1/r U[theta] e ``[theta]

To implement these calculations in Maple, begin with the derivatives u[x] and u[y] in the form

> ux := diff(u,x);
uy := diff(u,y);

ux := D[1](U)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(x^...

uy := D[1](U)(sqrt(x^2+y^2),arctan(y/x))*y/(sqrt(x^...

>

These results are nothing more than the chain rule, which in subscript notation would be written as

u[x] = U[r]*r[x]+U[theta]*theta[x]
u[y] = U[r]*r[y]+U[theta]*theta[y]

Use these expressions for u[x] and u[y] in q7 , namely, in

(diff(u(x,y),x)*cos(theta)+diff(u(x,y),y)*sin(theta...

to obtain

> q8 := subs(diff(u(x,y),x)=ux, diff(u(x,y),y)=uy, q7);

q8 := ((D[1](U)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...
q8 := ((D[1](U)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...
q8 := ((D[1](U)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...
q8 := ((D[1](U)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...

>

This represents grad(u) as a vector in the polar coordinate basis vectors e[r] and e[theta] . However, all traces of the variables x and y are to be removed. So, to begin, replace sqrt(x^2+y^2) and arctan(y/x) in the arguments of U with r and theta , respectively.

> q9 := subs(R=r,T=theta,q8);

q9 := ((D[1](U)(r,theta)*x/(sqrt(x^2+y^2))-D[2](U)(...
q9 := ((D[1](U)(r,theta)*x/(sqrt(x^2+y^2))-D[2](U)(...

>

There are still other x 's and y 's left. Replace them with r*cos(theta) and r*sin(theta) respectively,obtaining

> q10 := simplify(subs(x=X,y=Y,q9), assume=positive);

q10 := (D[1](U)(r,theta)*r*e[r]+D[2](U)(r,theta)*e[...

>

A conversion from D-notation to the partials notation yields

> q11 := convert(q10,diff);

q11 := (diff(U(r,theta),r)*r*e[r]+diff(U(r,theta),t...

>

Since this is actually a vector, split the fraction into two parts to isolate each component of the gradient vector now expressed completely in polar coordinates.

> q12 := expand(q11);

q12 := diff(U(r,theta),r)*e[r]+diff(U(r,theta),thet...

>

Expression q12 represents the polar coodinate equivalent to the cartesian gradient vector grad( u ) = u[x] i + u[y] j . Writing the result as the column vector

> vector([coeff(q12,e[r]),coeff(q12,e[theta])]);

MATRIX([[diff(U(r,theta),r)], [diff(U(r,theta),thet...

>

allows a direct comparison with Maple's

> grad(U(r,theta),[r,theta], coords=polar);

MATRIX([[diff(U(r,theta),r)], [diff(U(r,theta),thet...

>

Divergence in Polar Coordinates

In cartesian coordinates, the vector field

> F := vector([f(x,y),g(x,y)]);

F := MATRIX([[f(x,y)], [g(x,y)]])

>

has as its divergence the scalar field

> diverge(F,[x,y]);

diff(f(x,y),x)+diff(g(x,y),y)

>

The divergence of the vector

B = U(r,theta) e ``[r] + V(r,theta) e ``[theta]

that is, of the vector

> U:='U':
B := vector([U(r,theta),V(r,theta)]);

B := MATRIX([[U(r,theta)], [V(r,theta)]])

>

is the scalar

U[r]+1/r U+1/r V[theta]

that is,

> expand(diverge(B,[r,theta],coords=polar));

diff(U(r,theta),r)+U(r,theta)/r+diff(V(r,theta),the...

>

Notice the term without any derivative! There is something to discover here!

>

Divergence in Polar Coordinates - Derivation

To derive the expression for the divergence of the polar vector

B = U(r,theta) e ``[r] + V(r,theta) e ``[theta]

transform B completely to cartesian coordinates, compute the divergence in cartesian coordinates, then transform that result back to polar coordinates. Therefore, in terms of i and j , we have

B = F(r,theta) i + G(r,theta) j

where

F = U*cos(theta)-V*sin(theta)

and

G = U*sin(theta)+V*cos(theta)

Since F and G are functions of r and theta , define

f(x,y) = F(r(x,y),theta(x,y))

and

g(x,y) = G(r(x,y),theta(x,y))

so that the cartesian version of B is really

B = f(x,y) i + g(x,y) j

Then, the partial derivatives f[x] and g[y] , computed by the chain rule, are precisely what are needed for determining the divergence of B .

By the chain rule,

f[x] = F[r]*r[x]+F[theta]*theta[x]

and

g[y] = G[r]*r[y]+G[theta]*theta[y]

so

f[x] = [U[r]*cos(theta)-V[r]*sin(theta)]*cos(theta)...

and

g[y] = [U[r]*sin(theta)+V[r]*cos(theta)]*sin(theta)...

The sum

f[x]+g[y] = U[r]+1/r U+1/r V[theta] = div( B )

is the divergence in polar coordinates.

To implement these calculations in Maple, we begin by writing an arbitrary vector in polar coordinates, using the unit basis vectors e ``[r] and e ``[theta] in polar coordinates.

> B := U*e[r] + V*e[theta];

B := U*e[r]+V*e[theta]

>

The basis vectors e[r] and e[theta] have already been given in terms of the cartesian basis vectors, i and j by

> q1;
q2;

e[r] = cos(theta)*i+sin(theta)*j

e[theta] = -sin(theta)*i+cos(theta)*j

>

Transform the given polar vector completely to cartesian coordinates, compute the divergence in cartesian coordinates, then transform that result back to polar coordinates. That will clarify what replaces div( B ) in polar coordinates.

This is the vector B in terms of i and j .

> Bij := subs(q1, q2, B);

Bij := U*(cos(theta)*i+sin(theta)*j)+V*(-sin(theta)...

>

Collecting the i and j components is helpful.

> Bij_collected := collect(Bij, [i,j]);

Bij_collected := (U*cos(theta)-V*sin(theta))*i+(U*s...

>

Next, extract the i and j components of this vector which is now in cartesian form.

> F := coeff(Bij_collected,i);
G := coeff(Bij_collected,j);

F := U*cos(theta)-V*sin(theta)

G := U*sin(theta)+V*cos(theta)

>

The polar vector B = U e[r] + V e[theta] has become the cartesian vector F i + G j . Unfortunately, F and G are functions of r and theta , so define

f(x,y) = F(r(x,y),theta(x,y))

g(x,y) = G(r(x,y),theta(x,y))

so that the cartesian version of B is really f(x,y) i + g(x,y) j . Then, the partial derivatives f[x] and g[y] are precisely what are needed for determining the divergence of B .

To express F and G , as well as sin( theta ) and cos( theta ), in terms of x and y , define

U(sqrt(x^2+y^2),arctan(y/x)) = u(x,y)

and

V(sqrt(x^2+y^2),arctan(y/x)) = v(x,y)

Efficiency is achieved by setting up these substitutions in a template.

> q13 := {U=U(R,T),V=V(R,T),theta=T};

q13 := {U = U(sqrt(x^2+y^2),arctan(y/x)), V = V(sqr...

>

Making these substitutions in the polar components F and G yields the cartesian components f(x,y) and g(x,y) .

> f := simplify(subs(q13, F), symbolic);
g := simplify(subs(q13, G), symbolic);

f := -(-U(sqrt(x^2+y^2),arctan(y/x))*x+V(sqrt(x^2+y...

g := (U(sqrt(x^2+y^2),arctan(y/x))*y+V(sqrt(x^2+y^2...

>

The partial derivatives f[x] and g[y] can now be taken, yielding

> fx := diff(f,x);
gy := diff(g,y);

fx := -(-(D[1](U)(sqrt(x^2+y^2),arctan(y/x))*x/(sqr...
fx := -(-(D[1](U)(sqrt(x^2+y^2),arctan(y/x))*x/(sqr...
fx := -(-(D[1](U)(sqrt(x^2+y^2),arctan(y/x))*x/(sqr...

gy := ((D[1](U)(sqrt(x^2+y^2),arctan(y/x))*y/(sqrt(...
gy := ((D[1](U)(sqrt(x^2+y^2),arctan(y/x))*y/(sqrt(...
gy := ((D[1](U)(sqrt(x^2+y^2),arctan(y/x))*y/(sqrt(...

>

The sum f[x]+g[y] is div( B ) in cartesian coordinates, the system in which the divergence operator was originally defined. In that sum, begin the process of returning to polar coordinates.

> q14 := subs(R=r,T=theta, fx + gy);

q14 := -(-(D[1](U)(r,theta)*x/(sqrt(x^2+y^2))-D[2](...
q14 := -(-(D[1](U)(r,theta)*x/(sqrt(x^2+y^2))-D[2](...

>

There are yet more x 's and y 's to convert to polar coordinates.

> q15 := simplify(subs(x=X,y=Y,q14),symbolic);

q15 := (r*D[1](U)(r,theta)+U(r,theta)+D[2](V)(r,the...

>

Next, change notation for the derivatives, from the D-notation to the partials notation, obtaining

> q16 := convert(q15,diff);

q16 := (r*diff(U(r,theta),r)+U(r,theta)+diff(V(r,th...

>

Making separate fractions yields the final result.

> q17 := expand(q16);

q17 := diff(U(r,theta),r)+U(r,theta)/r+diff(V(r,the...

>

Once again turning to Maple for a comparison, write the general vector as

> B2 := vector([U(r,theta), V(r,theta)]);

B2 := MATRIX([[U(r,theta)], [V(r,theta)]])

>

and apply the built-in diverge command, obtaining

> `div(B2)` := diverge(B2,[r,theta],coords=polar);

`div(B2)` := (r*diff(U(r,theta),r)+U(r,theta)+diff(...

>

This is the result just derived from first principles. Again creating separate fractions,

> expand(`div(B2)`);

diff(U(r,theta),r)+U(r,theta)/r+diff(V(r,theta),the...

>

the results are seen to agree.

> q17;

diff(U(r,theta),r)+U(r,theta)/r+diff(V(r,theta),the...

>

Laplacian in Polar Coordinates

In rectangular coordinates, the laplacian of f(x,y) is

> unassign('f','F');
laplacian(f(x,y),[x,y]);

diff(f(x,y),`$`(x,2))+diff(f(x,y),`$`(y,2))

>

In polar coordinates, the laplacian of F(r,theta) is

F[rr]+1/r F[r]+1/(r^2) F[theta*theta]

that is,

> expand(laplacian(F(r,theta),[r,theta],coords=polar));

diff(F(r,theta),r)/r+diff(F(r,theta),`$`(r,2))+diff...

>

Example 22.2

For example, the laplacian of the function

> f := x + y^3;

f := x+y^3

>

is

> qc := laplacian(f, [x,y]);

qc := 6*y

>

Converting the function f(x,y) = x+y^3 to polar coordinates gives F(r,theta) = f(x(r,theta),y(r,theta)) , that is,

> F := subs(x = r*cos(theta), y = r*sin(theta), f);

F := r*cos(theta)+r^3*sin(theta)^3

>

In polar coordinates, the laplacian of F(r,theta) is

> qp := laplacian(F, [r,theta], coords = polar);

qp := (cos(theta)+9*r^2*sin(theta)^3+(-r*cos(theta)...

>

an expression which actually simplifies to

> combine(qp,trig);

6*r*sin(theta)

>

If 6*y , the laplacian in rectangular coordinates, were converted to polar coordinates, 6*r*sin(theta) would result, in perfect agreement with the laplacian computed directly in polar coordinates. In fact, this comparison is made in Maple via

> simplify(6*r*sin(theta) - qp);

0

>

Maple Derivation

Instead of the very general F(r,theta) = f(x(r,theta),y(r,theta)) , let x and y be specifically given in polar coordinates. Then,

f(x,y) = F(r(x,y),theta(x,y)) = F(sqrt(x^2+y^2),arctan(y/x))

> unassign('F');
f := F(sqrt(x^2+y^2), arctan(y/x));

f := F(sqrt(x^2+y^2),arctan(y/x))

>

The cartesian derivatives can computed as

> fx := diff(f,x);

fx := D[1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(x^...

> fxx := diff(f,x,x);

fxx := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqr...
fxx := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqr...
fxx := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqr...

> fy := diff(f,y);

fy := D[1](F)(sqrt(x^2+y^2),arctan(y/x))*y/(sqrt(x^...

> fyy := diff(f,y,y);

fyy := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*y/(sqr...
fyy := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*y/(sqr...
fyy := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*y/(sqr...

>

Hence, the laplacian in cartesian coordinates has the following polar equivalent.

> q := fxx + fyy;

q := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...
q := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...
q := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...
q := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...
q := (D[1,1](F)(sqrt(x^2+y^2),arctan(y/x))*x/(sqrt(...

>

This unwieldy expression can be simplified to the much smaller

> q1 := simplify(q);

q1 := (x^2*sqrt(x^2+y^2)*D[1,1](F)(sqrt(x^2+y^2),ar...
q1 := (x^2*sqrt(x^2+y^2)*D[1,1](F)(sqrt(x^2+y^2),ar...

>

Further simplification comes notationally, by expressing the arguments of F as r and theta , rather than as sqrt(x^2+y^2) and arctan(y/x) , respectively. This step is done by making the following replacements.

> q2 := subs(R=r,T=theta,q1);

q2 := (x^2*r*D[1,1](F)(r,theta)+x^2*D[1](F)(r,theta...

>

Still more simplification is achieved by changing the remaining apearances of x and y to their counterparts in polar coordinates, obtaining

> q3 := simplify(subs(x=X,y=Y,q2),symbolic);

q3 := (r^2*D[1,1](F)(r,theta)+D[2,2](F)(r,theta)+r*...

>

Finally, convert from the D-notation for derivatives to the partials notation, getting

> expand(convert(q3,diff));

diff(F(r,theta),`$`(r,2))+diff(F(r,theta),`$`(theta...

>

Comparing this result to Maple's built-in version

> expand(laplacian(F(r,theta),[r,theta],coords=polar));

diff(F(r,theta),`$`(r,2))+diff(F(r,theta),`$`(theta...

>

shows the results to be identical.

>

Traditional Chain Rule Derivation

The Maple derivation above might seem intimidating and complex, but it is actually easier than the traditional derivation based on a direct use of the chain rule. The following is a Maple-implemented version of the traditional computation.

The starting point for the differentiations is the statement

f(x,y) = F(r(x,y),theta(x,y))

An application of the chain rule gives

f[x] = F[r]*r[x]+F[theta]*theta[x]

and

f[y] = F[r]*r[y]+F[theta]*theta[y]

Second derivatives pose a greater challenge unless the dependence of the derivatives F[r] and F[theta] on r(x,y) and theta(x,y) is properly appreciated. Again using the chain rule, the second derivatives become

f[xx] = diff(F[r],x)*r[x]+F[r]*r[xx]+diff(F[theta],...

= [F[rr]*r[x]+F[r*theta]*theta[x]]*r[x]+F[r]*r[xx]+[F...

and

f[yy] = diff(F[r],y)*r[y]+F[r]*r[yy]+diff(F[theta],...

= [F[rr]*r[y]+F[r*theta]*theta[y]]*r[y]+F[r]*r[yy]+[F...

We can represent these derivatives in Maple as

> fxx := (F[rr]*r[x]+F[r*theta]*theta[x])*r[x] + F[r]*r[xx] + (F[r*theta]*r[x] + F[theta,theta]*theta[x])*theta[x] + F[theta]*theta[xx];
fyy := (F[rr]*r[y]+F[r*theta]*theta[y])*r[y] + F[r]*r[yy] + (F[r*theta]*r[y] + F[theta,theta]*theta[y])*theta[y] + F[theta]*theta[yy];

fxx := (F[rr]*r[x]+F[r*theta]*theta[x])*r[x]+F[r]*r...

fyy := (F[rr]*r[y]+F[r*theta]*theta[y])*r[y]+F[r]*r...

>

where we have utilized the equality of the derivatives F[r*theta] and F[theta*r] .

Then, the derivatives r[x], r[xx], r[y], r[yy], theta[x], theta[xx], thet... must all be computed and expressed in terms of the polar coordinate variables r and theta . Thus, the derivatives are computed and converted via

> rx := simplify(subs(x=X,y=Y,diff(R,x)), symbolic);
rxx := simplify(subs(x=X,y=Y,diff(R,x,x)),symbolic);
ry := simplify(subs(x=X,y=Y,diff(R,y)), symbolic);
ryy := simplify(subs(x=X,y=Y,diff(R,y,y)),symbolic);
theta_x := simplify(subs(x=X,y=Y,diff(T,x)), symbolic);
theta_xx := simplify(subs(x=X,y=Y,diff(T,x,x)),symbolic);
theta_y := simplify(subs(x=X,y=Y,diff(T,y)), symbolic);
theta_yy := simplify(subs(x=X,y=Y,diff(T,y,y)),symbolic);

rx := cos(theta)

rxx := -(cos(theta)^2-1)/r

ry := sin(theta)

ryy := cos(theta)^2/r

theta_x := -sin(theta)/r

theta_xx := 2*sin(theta)*cos(theta)/(r^2*(cos(theta...

theta_y := cos(theta)/r

theta_yy := -2*sin(theta)*cos(theta)/(r^2*(cos(thet...

>

Making these substitutions into the sum f[xx]+f[yy] , we get

> expand(simplify(subs(r[x]=rx, r[xx]=rxx, r[y]=ry, r[yy]=ryy, theta[x]=theta_x, theta[xx]=theta_xx, theta[y]=theta_y, theta[yy]=theta_yy, fxx+fyy)));

F[r]/r+F[theta,theta]/(r^2)+F[rr]

>

which we recognize as the equivalent of

> unassign('f');
expand(laplacian(f(r,theta),[r,theta], coords=polar));

diff(f(r,theta),r)/r+diff(f(r,theta),`$`(r,2))+diff...

>