Post Reply 
del operators ( ∇ × A , ∇ ⋅ A, ∇f) in (polar coordinates )
09-11-2016, 06:02 PM (This post was last modified: 09-12-2016 07:25 AM by toshk.)
Post: #2
RE: del operators ( ∇ × A , ∇ ⋅ A, ∇f) in (polar coordinates )
notation: almost standard , except 'θ' is a reserved real variable on prime...any work around that?
(ρ, φ, z)--------cylindrical
(r, θ, φ) ==> (r,x,φ)--------spherical

Code:

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


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

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

//(r, θ, φ)==(r,x,φ)
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],'φ');
return [tem1,tem2,tem3];  
END;

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

//(r, θ, φ)==(r,x,φ)
curls(f)
BEGIN
local tem1,tem2,tem3;
tem1:=(1/(r*sin(x)))*(diff(sin(x)*f[3],x)-diff(f[2],'φ'));
tem2:=(1/r)*(((1/sin(x))*diff(f[1],'φ'))-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
RE: del operators ( ∇ × A , ∇ ⋅ A, ∇f) in (polar coordinates ) - toshk - 09-11-2016 06:02 PM



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