laplace equation : cylindrical coordinates ' version 1.0'
Δ u = 0 , u = u(ρ,phi,z)
rem :Δ u (x,y,z) = 0 -> Δ u(ρ,phi,z) = 0
peter.vlasschaert@gmail.com,18/12/2017 

ref:  schaum's outline series ,theory and problems
         of vector analysis and an introduction to tensor analysis
auth: Murray R.Spiegel 
rem: curvilinear coordinates. (ρ,phi,z)

range : φ : 0  =< φ =< 2*pi
range : ρ : 0  =< ρ < infinity
range : z : 0  =< z < infinity
rem : (x,y,z) => (ρ,φ,z)

restart
=====

kill(all)$

load 'packages'
=============

load("vector3d")$

menu:view :greek letters (make active)
=================================

assume(ρ>=0);

polar coordinates : 2D 
===================
(x,y) -> (ρ1,phi) 
rem : ρ1 = ρ,z1=z,phi1=phi

x11:ρ1*cos(phi1);
y11:ρ1*sin(phi1);
z11:z1;

position :3D, for the point P in the figure 1
===================================

r:[x11,y11,z11];

components from r : rx,ry,rz.
-------------------------------------------

rx:part(r,1);
ry:part(r,2);
rz:part(r,3);

distance : r ' from the origin'
------------------------------------------

dist:sqrt(trigsimp(ratsimp(rx*rx+ry*ry+rz*rz)));

u ,depends on ρ,phi,z
==================

depends(u,[ρ,phi,z]);

depends(x,[ρ,phi]);
depends(y,[ρ,phi]);

p1a:x=ρ*cos(phi);
p2a:y=ρ*sin(phi);
p3a:z;

from above : ρ1^2 =  ρ^2

find :∂ρ/∂x

p2:ρ=sqrt(part(p1a,1)^2+part(p2a,1)^2);

p3:diff(part(p2,2),x);

rem : reduce 

p4:ev(p3,p1a,p2a,p3a);
p5:'diff(ρ,x) =trigsimp(p4);

find:∂phi/∂x   "p8"

p6:p2a/p1a;
p7:diff(part(p6,1),x) =ratsimp(diff(part(p6,2),phi))*p8;
p9:ev(p7,p1a,p2a);
p10:ev(solve(p9,p8),p8='diff(phi,x))[1];
p11:trigsimp(p10);
;

find :∂u/∂x =∂u/∂r*cos(phi)+∂u/∂phi*(-sin(phi)/ρ)

p12:'diff(u,x) ='diff(u,ρ)*part(p5,2)+'diff(u,phi)*part(p11,2);

find :∂(∂u/∂x) /∂x   ' x- part   laplace equation '
diff(u,x,2) =∂/∂x(∂u/∂x) =∂/∂ρ(∂u/∂x )∂ρ/∂x +∂/∂φ(∂u/∂x )∂φ/∂x

p13:'diff(u,x,2) = factor(diff(part(p12,2),ρ)*part(p5,2)+diff(part(p12,2),phi)*part(p11,2));
p14:trigsimp(p13);

find :∂ρ/∂y

p15:diff(part(p2,2),y);

rem : reduce 

p16:ev(p15,p1a,p2a,p3a);
p17:'diff(ρ,y) =trigsimp(p16);

find:∂phi/∂y   "p18"

p19:diff(part(p6,1),y) =ratsimp(diff(part(p6,2),phi))*p18;
p20:ev(p19,p1a,p2a,p2);
p21:solve(p20,p18)[1];
p22:trigsimp(p21);
p23:'diff(phi,y)=rhs(p22);

find :∂u/∂y =∂u/∂r*sin(phi)+∂u/∂phi*(cos(phi)/ρ))

p24:'diff(u,y) ='diff(u,ρ)*part(p17,2)+'diff(u,phi)*part(p23,2);

find :∂(∂u/∂y) /∂y   ' y- part   laplace equation '
diff(u,y,2) =∂/∂y(∂u/∂y) =∂/∂ρ(∂u/∂y )∂ρ/∂y +∂/∂φ(∂u/∂y )∂φ/∂y

p25:'diff(u,y,2) = factor(diff(part(p24,2),ρ)*part(p17,2)+diff(part(p24,2),phi)*part(p23,2));
p26:trigsimp(p25);

laplace equation 2D :    Δ u = 0   : Δ u (x,y)= 0  -> Δ u (ρ,φ)= 0 , "x ,y part  => laplace equation"

p27:'diff(u,x,2) +'diff(u,y,2) =trigsimp(rhs(p14)+rhs(p26));
p28:part(p27,2,1,1)/part(p27,2,2);;
p29:part(p27,2,1,2)/part(p27,2,2);;
p30:part(p27,2,1,3)/part(p27,2,2);;
p31:lhs(p27)=p28+p29+p30;

laplace equation 3D ' cylindrical coordinates ' :    Δ u = 0   : Δ u (x,y,z)= 0  -> Δ u (ρ,φ,z)= 0 

p32:lhs(p27)+'diff(u,z) = rhs(p31) + diff(u,z,2);

                                                 ===============================================