Post Reply 
del operators ( ∇ × A , ∇ ⋅ A, ∇f) in (polar coordinates )
09-10-2016, 10:09 PM (This post was last modified: 09-11-2016 06:03 PM by toshk.)
Post: #1
del operators ( ∇ × A , ∇ ⋅ A, ∇f) in (polar coordinates )
gradc(f)==gradient in cylindrical ∇f
grads(f)==gradient in spherical
divc(f)==divergence in cylindrical ∇ ⋅ f,
divs(f)==divergence in spherical
curlc(f)==curl in cylindrical ∇ × f
curls(f)==curl in spherical

notation: standard == prime input
(ρ, φ, z) ==> (r,x,z)--------cylindrical
(r, θ, φ) ==> (r,x,z)--------spherical

curls([r*cos(x), sin(x)*z, r*z*cos(x)])

Code:

#pragma mode( separator(.,;) integer(h32) )
#cas
//(ρ, φ, z)==(r,x,z)
gradc(f):=
BEGIN
local tem1,tem2,tem3;
tem1:=diff(f,r);
tem2:=(1/r)*diff(f,x)
tem3:=diff(f,z);
return [tem1,tem2,tem3];
END;

//(r, θ, φ)==(r,x,z)
grads(f)
BEGIN
local tem1,tem2,tem3;
tem1:=diff(f,r);
tem2:=(1/r)*diff(f,x);
tem3:=(1/(r*sin(x)))diff(f,z);
return [tem1,tem2,tem3];
END;

//(ρ, φ, z)==(r,x,z)
divc(f)
BEGIN
local tem1,tem2,tem3;
tem1:=(1/r)*diff((r*f[1]),r);
tem2:=(1/r)*diff(f[2],x);
tem3:= diff(f[3],z);
return [tem1,tem2,tem3];  
END;

//(ρ, φ, z)==(r,x,z)
divs(f)
BEGIN
local tem1,tem2,tem3;
tem1:=(1/r^2)*diff((r^2)*f[1],r);
tem2:=(1/(r*sin(x)))*diff(sin(x)*f[2],x);
tem3:=(1/(r*sin(x)))*diff(f[3],z);
return [tem1,tem2,tem3];  
END;

curlc(f)
//(ρ, φ, z)==(r,x,z)
BEGIN
local tem1,tem2,tem3;
tem1:=(1/r)*diff(f[3],x)-diff(f[2],z);
tem2:=diff(f[1],z)-diff(f[3],r);
tem3:= (1/r)*(diff(r*f[2],r)-diff(f[1],x));
return [tem1,tem2,tem3];   
END;

curls(f)
BEGIN
local tem1,tem2,tem3;
tem1:=(1/(r*sin(x)))*(diff(sin(x)*f[3],x)-diff(f[2],z));
tem2:=(1/r)*(((1/sin(x))*diff(f[1],z))-diff(r*f[3],r));
tem3:= (1/r)*(diff(r*f[2],r)-diff(f[1],x));
return [tem1,tem2,tem3];   
END;

#end
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
del operators ( ∇ × A , ∇ ⋅ A, ∇f) in (polar coordinates ) - toshk - 09-10-2016 10:09 PM



User(s) browsing this thread: 1 Guest(s)