kill(all);

fluid : How to find differentation unit vector(cylindrical coordinates),version 1.0
peter.vlasschaert@gmail.com,15/05/2019

load :packages

load(lrats)$
load(vect)$

application to use : 'vector packages'.   A ~ B ,vectorproduct.
--------------------------------------------------------------------------------------------
1e) declare : nonscalar
2e)  use : express

cylindrical coordinates :
====================

given :
=====

assume(r > 0);

p1a: x= r*cos(φ);
p1b: y= r*sin(φ);
p1c: z=z;

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

find : r ? f1(x,y,z)

p2a:solve(p1a,r);
p2b:solve(p1b,r);

1e) step

p3a:solve(p1a,cos(φ))[1];
p3b:solve(p1b,sin(φ))[1];

2e) step

p4a:(p3a)^2+(p3b)^2;

p4b:trigsimp(p4a);

3e) step

p5a:solve(p4b,r);

p5b:p5a[2];

r = f1(x,y,z) only from , r = f2(x,y).

find : φ ? 

p6a:solve(p1a,φ);
p6b:solve(p1b,φ);

other relation : φ

p7a:p3b/p3a;

'use trigreduce' , introduction of tan.

p7b:trigreduce(p7a);

p7c:solve(p7b,φ)[1];

relation between : 'cartesian' and 'cylindrical '
--------------------------------------------------------------------
result  : (ex,ey,ez)  <=>   (er,eφ,ez)

start :  (er,eφ,ez)

er : vector 'xy' plane
=================

p8a:er= cos(φ)*ex+sin(φ)*ey + 0*ez;

eφ : vector 'xy' plane ( φ =φ+π/2)
===========================

p8b:eφ = subst([φ =φ+π/2],rhs(p8a));

ez : vector 'above', 'xy' plane 
=========================
 properties all  er,eφ,ez are mutual perpendicular.
( use : right hand rule : vector product)

to find : ez ,use 'vectorial product'

?  How to construct vector product
-----------------------------------------------------

declare([A,B],nonscalar);

p9a:express(A);
p9b:express(B);

vector product: 'package: vect'
=>  ez = vectorproduct( er to eφ)

p9c:express(A~B);

? How to find A,B components
----------------------------------------------

1e) from 'er' , find  : A[x],A[y],A[z]
============================
use :  'p8a'

p10a:A[x]=coeff(rhs(p8a),ex);
p10b:A[y]=coeff(rhs(p8a),ey);
p10c:A[z]=coeff(rhs(p8a),ez);

p10d:[p10a,p10b,p10c];

2e) from 'eφ' , find  : B[x],B[y],B[z]
============================
use :  'p8b'

p11a:B[x]=coeff(rhs(p8b),ex);
p11b:B[y]=coeff(rhs(p8b),ey);
p11c:B[z]=coeff(rhs(p8b),ez);

p11d:[p11a,p11b,p11c];

3e) from 'ez' , use  'p9c'
============================

p12a:subst(p10d,p9c);
p12b:subst(p11d,p12a);

p12c:trigsimp(p12b);

find : check 
==========

p13:ez= p12c[3]*ez;

result : unit vector. 'cylindrical coordinates'
====================================

1e)  (er,eφ,ez)
============

p14a:p8a;
p14b:p8b;
p14c:p13;

p14a1:rhs(p14a) = lhs(p14a);
p14a2:rhs(p14b) = lhs(p14b);
p14a3:rhs(p14c) = lhs(p14c);

2e)  (ex,ey,ez)
============

p15a:solve([p14a,p14b,p14c],[ex,ey,ez]);

p15b:subst([%r1=ez],p15a)[1];

p16a:p15b[1],expand;
p16b:p15b[2],expand;
p16c:p15b[3],expand;

p17a:lhs(p16a) = trigsimp(rhs(p16a));
p17b:lhs(p16b) = trigsimp(rhs(p16b));
p17c:lhs(p16c) = trigsimp(rhs(p16c));

derivatives ?
===========

from above: er function φ , p8a.
from above: eθ function φ, p8b.

=========================================
rem : ex,ey,ez  ? don't change in time or position
=========================================

p20a: 'diff(er,φ) = diff(rhs(p8a),φ);
p20b: 'diff(eθ,φ) = diff(rhs(p8b),φ);

simplification : ?

p21a:lratsubst([p14a1,p14a2],p20a);
p21b:lratsubst([p14a1,p14a2],p20b);

'-----------------------------------------------------------------------------------'