kill(all)$
load(lrats)$
load(vect)$

Polar coordinates and Normal-Tangential Coordinates( = velocity),version 1.0
peter.vlasschaert@gmail.com,                          02/09/2018

three systems
============

declare([e],nonscalar);

rem : use load(vect)
================

Cartesian :  (x,y,z)
=========

unit vectors :

e[x] perpendicular e[y] : plane, above the plane : e[z]

p1:express(e);

Polar coordinates : (θ,r,z)
===============

unit vectors :

e[θ] perpendicular e[r] : plane, above the plane : e[z]

p2:subst([x=θ,y=r],p1);

vec_r = vector : radial direction :    e[r]
---------------------------------------------------------

p2a: vec_r = r*p2[2];

(N)ormal -(t)angential  : (t,n,z)
================

unit vectors :

e[t] perpendicular e[n] : plane, above the plane : e[z]

p3:subst([x=t,y=n],p1);

vec_v = vector : velocity direction : e[t]
-----------------------------------------------------------

p3a: vec_v = v*p3[1];

rem : rotational are in the direction : e[z], 'above the plane'
=================================================
=>    v = ω*r

relation beween :  unit vectors , use 'p1,p2'
=>  rotation : green to pink system
====================================
====================================

rem : simple mathematics ,point polar coordinates
==========================================
           x = r*cos(θ)
           y = r*sin(θ)
(cos(θ))^2+(sin(θ))^2 = 1
==========================================
=> end-point , e[r] , such a point
==========================================

e[r] => e[θ]  : angle between : θ  =>  θ + π/2

p4: p2[2] = cos(θ)*p1[1]+sin(θ)*p1[2];

p4a:p2[1]=cos(θ+π/2)*p1[1]+sin(θ+π/2)*p1[2];

velocity : use '  p2a '
==================

depends([θ,r],t);

1e) differentation  (p4,p4a)
==============

p5:'diff(lhs(p4),t) =diff(rhs(p4),t);
p5a:factor(p5);

p5b: lratsubst([rhs(p4a)=lhs(p4a)],p5a);

p6:'diff(lhs(p4a),t) =diff(rhs(p4a),t);
p6a:factor(p6);

p6b: lratsubst([rhs(p4)=lhs(p4)],p6a);

2e) velocity   (p5b,p6b)  and (p2a)
==========

p7:'diff(lhs(p2a),t) = 'diff(rhs(p2a),t);

rem : d(f*g) /dt= f*dg/dt+g*df/dt  : rule differentation, see ' p7a'
-------------------------------------------------------------------------------------------
rule use : ' letsimp' , 'see , rules, patterns'
-------------------------------------------------------------------------------------------

p7a:let('diff(f*g,t),'diff(f,t)*g+f*'diff(g,t));

rem :again with use combination : 'subst'

p7b: subst([f=part(rhs(p2a),1),g=part(rhs(p2a),2)],p7a);

p7c1 :part(p7b,1);
p7c2 :part(p7b,2);
p7c3 :part(p7b,3);

p7d:[p7c1 = p7c3];
p7e:subst(p7d,p7);

  final :result : 'velocity'
====================

p8:subst([p5b],p7e);

coef : e[θ] , see 'p8a' :
-------------------------------

p8a:ratcoeff(rhs(p8),p2[1]);

coef : e[r] , see 'p8' :
-----------------------------

p8b:ratcoeff(rhs(p8),p2[2]);

rem : rule from let also , next relation.

relation : e[θ],e[r],β  

components V = velocity (u,v) Figure 2
================================

      part u : figure 2 : e[r], 'direction'
-----------------------------------------------------

p9:V*sin(β);

      part v : figure 2 : e[θ], 'direction'
------------------------------------------------------

p9a:V*cos(β);

p9b:lhs(p7) = p9*p2[2]+p9a*p2[1];

relation : (p8a,p8b) and (p9b).
============================

relation : e[r] : ?
------------------------

p10a:p8b=p9;

relation : e[θ] : ?
------------------------

p10b:p8a =p9a;

p10b1:solve(p10b,('diff(θ,t,1)));
p10b2:p10b1[1];

formula : rocket launch
-----------------------------------

p11a: p10a;
p11b:p10b2;

rem : vec_ω = 'diff(θ,t,1)*e[z], e[z], 'vector above the plane'
---------------------------------------------------------------------------------------

p11c:vec_ω = lhs(p11b)*p1[3];

p11d:lhs(p11c)=rhs(p11b)*p1[3];

relation beween :  unit vectors , use 'p2,p3'
=>  rotation : pink to orange system
====================================
====================================

        e[θ],e[r] => e[t],e[n]

1e) find : relation e[θ]  =>  α1*e[t] +α2*e[n]
2e) find : relation e[r]   =>  α3*e[t] +α4*e[n]

from 1e ; e[θ],from Figure 3 , e[t]  : a   =>   cos(β) = α1
                                                      e[n]  : b => - sin(β) = α2

p12:p2[1] = cos(β) *p3[1] - sin(β)*p3[2];

from 2e ;e[r] ,from Figure 3 , e[t]  : d => sin(β) = α3
                                                    e[n]  : c =>  cos(β) = α4

p12a:p2[2] =sin(β) *p3[1] +cos(β)*p3[2];

p12b:coefmatrix([p12,p12a],[e[t],e[n]])*(-1);

extra : differentation unit vectors

depends([β],t);

'diff(e[θ],t,1) :  ?
-----------------------

p13:'diff(lhs(p12),t) =diff(rhs(p12),t);
p13a:factor(p13);
p13b:lratsubst([rhs(p12a)=lhs(p12a)],p13a);

'diff(e[r],t,1) :  ?
-----------------------

p14:'diff(lhs(p12a),t) =diff(rhs(p12a),t);
p14a:factor(p14);
p14b:lratsubst([rhs(p12)=lhs(p12)],p14a);

formula :
========

p15:p12a;
p15a:p12;

use : coefmatrix  'maxima',column vector , unknowns
find 'p16'  => (-1)*p15
                          (-1)*p15a
why : multiply by *(-1).

rem : rotation matrix ?

p16:coefmatrix([p15,p15a],[e[t],e[n]])*(-1);

calculation : determinant of a 'rotation matrix'
======================================

p16a:determinant(p16);

p16b:abs(p16a);

p16c:trigsimp(p16b);

find : inverse matrix  : p16   => transpose (p16);
=======================================

p16d:transpose(p16);

find : e[t]  as function( e[r],e[θ]) ?
          e[n]  as function( e[r],e[θ]) ?
============================

rem : augcoefmatrix 'maxima'
          ====================

p18:augcoefmatrix([p15,p15a],[e[t],e[n]])*(-1);

last column : known values , system equations.
same : rem for multiply by one. 'see above '

--------------------------------------------------------------------------------------------------------------------------------------------------------------------