Laplacian 2-D polar form
- To: mathgroup at smc.vnet.net
- Subject: [mg6906] Laplacian 2-D polar form
- From: sergio at scisun.sci.ccny.cuny.edu (Sergio Rojas)
- Date: Fri, 25 Apr 1997 14:00:37 -0400 (EDT)
- Organization: City College Of New York - Science
- Sender: owner-wri-mathgroup at wolfram.com
(****
Hello folks,
Using Mathematica 2.2 for DEC OSF/1 Alpha, I wrote a few lines
to find the Laplacian 2-D polar form starting from its expression
in rectangular coordinates:
****)
R = Sqrt[ x^2 + y^2];
THETA = ArcTan[y/x];
Dx[f_] := Dt[f,x];
DfDx = Expand[Together[ Dx[f[r /. r -> R,theta /. theta -> THETA]]
/. R -> r /. THETA -> theta /. Dt[y, x] -> 0 ]];
DDfDxDx = Expand[Together[ Dx[ DfDx /. r -> R /. theta -> THETA]
/. R -> r /. THETA -> theta /. Dt[y, x] -> 0 ]];
Dy[f_] := Dt[f,y];
DfDy = Expand[Together[ Dy[f[r /. r -> R,theta /. theta -> THETA]]
/. R -> r /. THETA -> theta /. Dt[x, y] -> 0 ]];
DDfDyDy = Expand[Together[ Dy[ DfDy /. r -> R /. theta -> THETA]
/. R -> r /. THETA -> theta /. Dt[x, y] -> 0 ]];
Laplacian2Dpolarform =
(Expand[Simplify[DDfDxDx + DDfDyDy /. {x -> r*Cos[theta], y -> r*Sin[theta]}]]
/. Sqrt[r^2] -> r);
Print["Laplacian2Dpolarform = ", Laplacian2Dpolarform];
(****
However, I am not satisfied with this code. Can somebody show a better way
of doing it?
On the other hand, let's say one want to start from the last mathematica
output :
(0,2) (1,0)
f [r, theta] f [r, theta] (2,0)
---------------- + ---------------- + f [r, theta]
2 r
r
with InputForm[%] =
****)
Derivative[0, 2][f][r, theta]/r^2 + Derivative[1, 0][f][r, theta]/r + \
Derivative[2, 0][f][r, theta];
(****
How can one tells to mathematica: now substitute f[r,theta] by the function
g[r,theta] := r*Cos[theta^2 + r^2]. I tried the form:
****)
g[r_,theta_] := r*Cos[theta^2 + r^2];
Laplacian2Dpolarform /. [f] -> [g]
(****
but the error:
Syntax::sntxf: "Laplacian2Dpolarform /. " cannot be followed by "[f] -> [g]".
is outputed
Salut,
Sergio
e-mail: sergio at scisun.sci.ccny.cuny.edu
****)