from __future__ import division
import math
l1=75.5;
l2=180.5
l3=60.25
t1=30.4;t2=69.4;t3=30.5;
t2=180-t2;
t3=180-t3;
Lc1=l1*math.cos(t1*(math.pi/180))
Lc2=l2*math.cos(t2*(math.pi/180))
Lc3=l3*math.cos(t3*(math.pi/180))
Ls1=l1*math.sin(t1*(math.pi/180))
Ls2=l2*math.sin(t2*(math.pi/180))
Ls3=-l3*math.sin(t3*(math.pi/180))
print(Lc1,Lc2,Lc3);
print(Ls1,Ls2,Ls3);
Lc4=-Lc1-Lc2-Lc3;
Ls4=-Ls1-Ls2-Ls3;
print(Lc4,Ls4);
t4=-math.atan(Ls4/Lc4);
t4=t4*(180/math.pi);
l4=math.sqrt(Lc4*Lc4+Ls4*Ls4);
print('distance DA=',l4);
print('bearing of DA=',t4);
from __future__ import division
import math
l1=100;
l2=80;
l3=60;
t2=39.5;t3=40.5;t4=49.75;
L2=l2*math.cos(t2*(math.pi/180));
L3=l3*math.cos(t3*(math.pi/180));
D2=l2*math.sin(t2*(math.pi/180));
D3=l3*math.sin(t3*(math.pi/180));
l41=(157.86+math.sqrt(157.86*157.86-4*1757.5))/2;
l42=(157.86-math.sqrt(157.86*157.86-4*1757.5))/2;
print('length of DA is',l41,'or',l42);
print('when length of DA ,L=145.8')
k=math.cos(t4*(math.pi/180))
k1=(L2+L3-(k*l41))/100;
t1=math.acos(k1);
t1=t1*(180/(math.pi))
print('bearing at AB is=N',t1)
print('when length of DA ,L=12.04')
k=math.cos(t4*(math.pi/180))
k1=(L2+L3-(k*l42))/100;
k1=k1+0.004;
t11=math.acos(k1);
t11=t11*(180/(math.pi))
print(k1)
print('bearing at AB is=N',t11)
#ch-9 page 305 pb-3
from __future__ import division
import math
l1=100.5;l3=75;l4=50.5;
t1=30.5;t2=45;t3=40.5;t4=60;t5=40.25;
L1=l1*math.cos(t1*(math.pi/180))
L3=-l3*math.cos(t3*(math.pi/180))
L4=-l4*math.cos(t4*(math.pi/180))
print('latitude of AB,CD,DE are',L1,L3,L4);
D1=l1*math.sin(t1*(math.pi/180))
D3=-l3*math.sin(t3*(math.pi/180))
D4=-l4*math.sin(t4*(math.pi/180))
print('Depature of AB,CD,DE are',D1,D3,D4);
L2_L5=-(L1+L3+L4);
D2_D5=-(D1+D3+D4);
print(L2_L5,D2_D5)
k=0.117;
l5=(L2_L5+D2_D5)/(k);
k1=0.763;
l2=(k1*l5)-L2_L5;
l2=l2/0.707;
print('length of BC=',l2);
print('length of EA=',l5);
#ch-9 page 307 pb-4
from __future__ import division
import math
l1=75.5;l2=80.25;l3=75;
t1=30.25;t2=40.5;t3=60.5;
L1=l1*math.cos(t1*(math.pi/180))
L2=-l2*math.cos(t2*(math.pi/180))
L3=-l3*math.cos(t3*(math.pi/180))
print('latitudes of AQ,QR,RB are',L1,L2,L3);
D1=l1*math.sin(t1*(math.pi/180))
D2=l2*math.sin(t2*(math.pi/180))
D3=-l3*math.sin(t3*(math.pi/180))
print('Depature of AQ,QR,RB are',D1,D2,D3);
L4=-(L1+L2+L3);
D4=-(D1+D2+D3);
l4=math.sqrt(L4*L4+(D4*D4));
print('length of AB=',l4,'meters');
#ch-9 page 308 pb-5
from __future__ import division
import math
l1=150.5;l2=200;l3=125;
t1=50.25;t2=30.5;t3=60.5;
L1=-l1*math.cos(t1*(math.pi/180))
L2=-l2*math.cos(t2*(math.pi/180))
L3=-l3*math.cos(t3*(math.pi/180))
print('latitudes of BQ,QP,PA are',L1,L2,L3);
D1=l1*math.sin(t1*(math.pi/180))
D2=-l2*math.sin(t2*(math.pi/180))
D3=-l3*math.sin(t3*(math.pi/180))
print('Depature of BQ,QP,PA are',D1,D2,D3);
L4=-(L1+L2+L3);
D4=-(D1+D2+D3);
l4=math.sqrt(L4*L4+(D4*D4));
print('length of AB=',l4,'meters');
t4=math.atan(D4/L4);
t4=t4*(180/math.pi);
print('bearing of AB=',t4);
PAB=t3-t4;
QBA=t1+t4;
print('PAB=',PAB,'QBA=',QBA);
#ch-9 page 308 pb-6
from __future__ import division
import math
l1=130;l2=215;l3=155.5;l4=120;
t1=20.5;t2=60.25;t3=30.5;t4=80.5;
L1=l1*math.cos(t1*(math.pi/180))
L2=l2*math.cos(t2*(math.pi/180))
L3=-l3*math.cos(t3*(math.pi/180))
L4=l4*math.cos(t4*(math.pi/180))
print('latitudes of AB,BC,CD,DE are',L1,L2,L3,L4);
D1=l1*math.sin(t1*(math.pi/180))
D2=l2*math.sin(t2*(math.pi/180))
D3=l3*math.sin(t3*(math.pi/180))
D4=l4*math.sin(t4*(math.pi/180))
print('Depature of AB,BC,CD,DE are',D1,D2,D3,D4);
L5=-(L1+L2+L3+L4);
D5=-(D1+D2+D3+D4);
l5=math.sqrt(L5*L5+(D5*D5));
print('length of EA=',l5,'meters');
t5=math.atan(D5/L5);
t5=t5*(180/math.pi);
print('bearing of EA=',t5);
FA=l5/2;
l6=FA;
t6=t5;
L6=-l6*math.cos(t6*(math.pi/180))
D6=-l6*math.sin(t6*(math.pi/180))
L7=-(L1+L2+L6)
D7=-(D1+D2+D6)
t7=math.atan(D7/L7);
t7=t7*(180/math.pi);
print('bearing from F to C is =',t7);
l7=math.sqrt(L7*L7+(D7*D7));
print('distance from F to C is =',l7);
#ch-9 page 308 pb-7
from __future__ import division
import math
l1=725;l2=1050;l3=1250;l4=950;l5=575;
t1=60;t4=55.5;t5=2.75;
L1=l1*math.cos(t1*(math.pi/180))
L4=-l4*math.cos(t4*(math.pi/180))
L5=-l5*math.cos(t5*(math.pi/180))
print('latitudes of AB,DE,EA are',L1,L4,L5);
D1=l1*math.sin(t1*(math.pi/180))
D4=-l4*math.sin(t4*(math.pi/180))
D5=-l5*math.sin(t5*(math.pi/180))
print('Depature of AB,DE,EA are',D1,D4,D5);
t2_t3=math.acos(0.1750);
t2_t3=180-(t2_t3*(180/math.pi));
print('t2-t3=',t2_t3);
t3=math.asin(0.6035);
t3=t3*(180/math.pi);
t2=t2_t3-t3;
t2=math.ceil(t2);
print('Bearing of BC is',t2);
print('Bearing of CD is',t3);