kill(all)$

fluid : unit vector ,'spherical','cylindrical' coordinates,version 1.0
peter.vlasschaert@gmail.com,05/05/2019

load packages

load(vect)$

load(lrats)$

use :rad ( use : π/2  for  90)
=======

p2:cos(π/2+θ);

p2a:ev(trigexpand(p2));

p2b:[θ =θ+π/2];

relation between (x,y,z) and (r,θ,Φ)
=============================

relation between :(i,j,k) and (eR,eθ,eΦ)
================================

p3a: i=cos(Φ)*sin(θ);
p3b:j= sin(Φ)*sin(θ);
p3c:k= cos(θ);

point P : (x,y,z)
============
point : P : Figure 1
x : coordinate
y : coordinate
z  :coordinate

p3a1:x=R*rhs(p3a);
p3b1:y=R*rhs(p3b);
p3c1:z=R*rhs(p3c);

rem :  vector components (i,j,k)  set  R = 1
           in x,y,z.

relation : eR and eθ
=================

p:eR=[rhs(p3a),rhs(p3b),rhs(p3c)];

p1a:rhs(p)[1];
p1b:rhs(p)[2];
p1c:rhs(p)[3];

q:eθ =subst(p2b,rhs(p));

nonscalar : vector 
================

declare(p,nonscalar,q,nonscalar)$

eΦ: by vector product (eR,eθ)
=========================

p4:eΦ=express(rhs(p)~ rhs(q));

p4a:trigsimp(p4);

vecr = r*er + z*ez,vector 
OP  vector = vecr

vecr=x*i+y*j+z*k;

relation : general vector. 'a'
=======================
a = i*ax+j*ay+k*az;
a = eR*aR + eΦ*aΦ + eθ *aθ

p4a1:aR = rhs(p)[1]*ax+ rhs(p)[2]*ay+ rhs(p)[3]*az;
p4b1:aθ = rhs(q)[1]*ax+ rhs(q)[2]*ay+ rhs(q)[3]*az;
p4c1:aΦ = rhs(p4a)[1]*ax+ rhs(p4a)[2]*ay+ rhs(p4a)[3]*az;

find : ax,ay,az ; use transpose.
----------------------------------------------
replace: aR=> ax, aθ => ay,aΦ => az,visa versa.

p4a1:ax = rhs(p)[1]*aR+ rhs(q)[1]*aθ+ rhs(p4a)[1]*aΦ;
p4b1:ay = rhs(p)[2]*aR+ rhs(q)[2]*aθ+ rhs(p4a)[2]*aΦ;
p4c1:az = rhs(p)[3]*aR+ rhs(p)[2]*aθ+ rhs(p4a)[3]*aΦ;

relation between (x,y,z) and (r,θ,z)
=============================

relation between :(i,j,k) and (er,eθ,ez)
================================

p5a: i= cos(θ);
p5b:j=  sin(θ);
p5c:k= 1;

point P : (x,y,z)
============
point : P : Figure 3
x : coordinate
y : coordinate
z  :coordinate

p5a1:x= r*cos(θ);
p5b1:y= r* sin(θ);
p5c1:k= z;

declare([pp,qq],nonscalar)$

relation : er and eθ
=================

rem : er only projection on x-axis and on y-axis

pp:er=[rhs(p5a),rhs(p5b),0];

qq:eθ=subst(p2b,rhs(pp));

ez: by vector product (er,eθ)
=========================

p6:ez=express(rhs(pp)~ rhs(qq));

p6a:trigsimp(p6);

vecr = r*er + z*ez,vector 
OP  vector = vecr

p6b:vecr= r*er + z*ez;

relation : general vector. 'b'
=======================
b= i*bx+j*by+k*bz;
b= er*bR + eΦ*bΦ + eθ *bθ

p6a1:bR = rhs(pp)[1]*bx+ rhs(pp)[2]*by+ rhs(pp)[3]*bz;
p6b1:bθ = rhs(qq)[1]*bx+ rhs(qq)[2]*by+ rhs(qq)[3]*bz;
p6c1:bz= rhs(p6a)[1]*bx+ rhs(p6a)[2]*by+ rhs(p6a)[3]*bz;

find :bx,by,bz ; use transpose.
----------------------------------------------
replace: bR=> bx, bθ => by,bΦ => bz,visa versa.

p6a2:bx = rhs(pp)[1]*bx+ rhs(qq)[1]*by+ rhs(p6a)[1]*bz;
p6b2:by = rhs(pp)[2]*bx+ rhs(qq)[2]*by+ rhs(p6a)[2]*bz;
p6c2:bz= rhs(pp)[3]*bx+ rhs(qq)[3]*by+ rhs(p6a)[3]*bz;

how to find unit vector
===================

general :c ,transformed unit vector.
=============================

given : vector 'c'
------------------------

p7:[2,3,4];χ;

abs(c)
---------

p7a:absc=sqrt((p7[1])^2+(p7[2])^2+(p7[3])^2);

p7b:unitc=[p7[1]/rhs(p7a),p7[2]/rhs(p7a),p7[3]/rhs(p7a)];

check : result

p7b1:rhs(p7b)[1];
p7b2:rhs(p7b)[2];
p7b3:rhs(p7b)[3];

ppp:(p7b1)^2+(p7b2)^2+(p7b3)^2;

p unit vector ? ,from above.
=======================

p8:p;

p8a:rhs(p8);

abs(p)
---------

p8b:absp=sqrt((p8a[1])^2+(p8a[2])^2+(p8a[3])^2);

p8b1:trigsimp(rhs(p8b));

check : result

p9b1:rhs(p8)[1];
p9b2:rhs(p8)[2];
p9b3:rhs(p8)[3];

qqq:(p9b1)^2+(p9b2)^2+(p9b3)^2;

qqq:trigsimp(qqq);

p : unit vector.