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

Angle between(radius (= r),tangline( = FD)),polar coordinates, 'version 1.0'
peter.vlasschaert@gmail.com, 30/09/20018

 φ = phi ,  φ = θ + ψ

r = function of θ 
=============
notation : r = f(θ) = r(θ)
----------------------------------------------------------
 sum inside angles 'triangle EFDE ' = π
=================================
 notation : θ + (π-φ) +ψ = π

depends([r],θ);

polar coordinates: (x,y) => (r,θ)
==========================

p1:x =r*cos(θ);
p2:y =r*sin(θ);

differentation : 'p1,p2' to θ
======================

p1a:'diff(lhs(p1),θ) =diff(rhs(p1),θ);
p2a:'diff(lhs(p2),θ) =diff(rhs(p2),θ);

relation between angles :ψ,φ,θ
==========================

p3:ψ = φ - θ;

p3a:map(tan,p3);

p3b1:trigexpand(p3a);
p3b2:trigsimp(p3a);

tan(φ) to curve
=============
notation : tan(φ) = dy/dx = dy/dθ/(dx/dθ)

p4:tan(φ)      = 'diff(y,x);
p4a: lhs(p4)  = 'diff(y,θ)/'diff(x,θ);

tan(θ) to  curve
=============
notation :tan(θ) = y/x

p5::tan(θ) = y/x;

calculation  : tan(ψ) , 'p3b1'
=======================

use : 'p5'
-------------

p6:lhs(p3b1) =lratsubst([p5],rhs(p3b1));

use : 'p4a'
---------------

p6a:lhs(p3b1) =lratsubst([p4a],rhs(p6));

p6b:expand(p6a);

p6c:combine(p6b);

use : 'p1,p2'
------------------

p6c1:rhs(p1) = lhs(p1);
p6c2:rhs(p2) = lhs(p2);

parts 'p6c'
========

p6d1:part(rhs(p6c),1);
p6d2:part(rhs(p6c),2);

p6d11:subst([p1,p2],p6d1);
p6d22:subst([p1,p2],p6d2);

p6d111:ev(p6d11,diff);
p6d222:ev(p6d22,diff);

simplify : trignometry

p7a:trigsimp(p6d111);
p7b:trigsimp(p6d222);

final : result  'ψ'

p8:lhs(p6c) = p7a/p7b;

p8a:solve(p8,ψ)[1];

ellipse : r = r(θ)
============

p9:r=a*(1-e^2)/(1+e*cos(θ));

calculation :ψ for ellipse.
-------------------------------------

p9a:subst([p9],p8a);

p9b:ev(p9a,diff);

here we find  : ψ = ψ(θ)

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