#ch-10 page 379 pb-1
from __future__ import division
import math
r=275;
t=24;
l=1320.5;
tl=r*math.tan((t/2)*(math.pi/180));
print('Tangent length =',tl);
llc=2*r*math.sin((t/2)*(math.pi/180));
print('Length long of cord=',llc);
loc=(math.pi*r*t/180);
print('Length of curve =',loc)
coc=l-tl;
ct=coc+loc;
print('chainage of commencement =',coc);
print('chainage of tangency =',ct);
k=math.cos((t/2)*math.pi/180);
ad=r*((1/k)-1);
print('apex distance =',ad)
k1=math.cos((t/2)*(math.pi/180))
vsc=r*(1-k1);
print('versed sine of curve is',vsc);
#ch-10 page 379,380 pb-2
from __future__ import division
import math
ac=45.5;cb=75.5;
#a
t=cb-ac;
l1=1719;
l=2760;
#b
r=l1/3;
print('radius of curve ',r);
#c
tl=r*math.tan((t/2)*(math.pi/180));
print('Tangent length =',tl);
#d
loc=(math.pi*r*t/180);
print('Length of curve =',loc)
#e
llc=2*r*math.sin((t/2)*(math.pi/180));
print('Length long of cord=',llc);
#f,g
coc=l-tl;
ct=coc+loc;
print('chainage of commencement =',coc);
print('chainage of tangency =',ct);
#h
half=0.5*llc;
print('length of each half =',half);
ini=30;
k=math.sqrt(r*r-(half*half));
o=r-k
k1=r-o;
O30=(math.sqrt(r*r-(ini*ini)))-k1;
O60=(math.sqrt(r*r-(2*ini*2*ini)))-k1;
O90=(math.sqrt(r*r-(3*ini*3*ini)))-k1;
O120=(math.sqrt(r*r-(4*ini*4*ini)))-k1;
Oh=(math.sqrt(r*r-(half*half)))-k1;
print('O30=',O30,'O60=',O60,'O90=',O90,'O120=',O120,'O148.3=',Oh);
from __future__ import division
import math
a=126.8;
t=180-a;
r=300;
#b
tl=r*math.tan((t/2)*(math.pi/180));
print('Tangent length =',tl);
#c
loc=(math.pi*r*t/180);
print('Length of curve =',loc)
#d
l=510.23;
ct1=l-tl;
ct2=ct1+loc;
print('chainage of T1=',ct1);
print('chainage of T2=',ct2);
#f
n=9;
b=30;
cc=ct1+270;
lfsc=ct2-cc;
print('chainage covered=',cc);
print('Length of final sub cord=',lfsc);
O1=(b*b)/(2*r);
O2=(b*b)/r;
O10=(lfsc*(b+lfsc))/(2*r);
print('first ofset=',O1);
print('second ofset=',O2);
print('tenth ofset=',O10);
from __future__ import division
import math
ab=30;bc=90;cd=140;
l1=250;l2=150;l3=325;
abc=210-bc;
t1=0.5*abc;
bcd=270-cd;
t2=0.5*bcd;
t3=180-(t1+t2);
k=(math.sin(t2*(math.pi/180)))/(math.sin(t3*(math.pi/180)));
OB=l2*k;
k1=(math.sin(t1*(math.pi/180)))/(math.sin(t3*(math.pi/180)));
OC=l2*k1;
print(OB,OC);
R=OB*(math.sin(t1*(math.pi/180)));
print('Radius R=',R);
BT1=OB*(math.cos(t1*(math.pi/180)));
CT1=OC*(math.cos(t2*(math.pi/180)));
print('Tangent length BT1=',BT1);
print('Tangent length CT1=',CT1);
from __future__ import division
import math
r=400;
t1=15;t2=30;t3=60;
ct=900;
l=320;
BT2=r*(math.tan((t1)*math.pi/180));
CT2=l-BT2;
r1=(CT2)/(math.tan((t2)*math.pi/180));
print('R1=',r1);
t1t2=(math.pi*r*t2)/(180);
t2t3=(math.pi*r1*t3)/(180);
print('length of arc T1T2=',t1t2);
print('length of arc T2T3=',t2t3);
ct1=ct-BT2;
ct3=ct1+t1t2+t2t3;
print('chainage of T1=',ct1);
print('chainage of T3=',ct3);
from __future__ import division
import math
r1=400;
t1=30;d=200;
ct1=1500;
k=1-(math.cos(t1*(math.pi/180)))
T1G=r1*(k);
r2=(d-T1G)/k;
print('R2=',r2);
t1t2=(math.pi*r1*t1)/180;
t2t3=(math.pi*r2*t1)/180;
print('length of arc T1T2=',t1t2);
print('length of arc T2T3=',t2t3);
ct2=ct1+t1t2;
ct3=ct2+t2t3;
print('chainage of point of reverse curvature =',ct2);
print('chainage of finishing point T3=',ct3);
from __future__ import division
import math
a1=135;a2=145;
t1=180-a1;
t2=180-a2;
t3=180-(t1+t2);
r1=400;r2=200;
ct=1000;
ED=r1*(math.tan((t1/2)*(math.pi/180)));
FD=r2*(math.tan((t2/2)*(math.pi/180)));
EF=ED+FD;
print('EF=',EF);
BE=EF*(math.sin(t2*(math.pi/180)))/(math.sin(t3*(math.pi/180)));
BF=EF*(math.sin(t1*(math.pi/180)))/(math.sin(t3*(math.pi/180)))
ct1=ct-(BE+ED);
cd=ct1+((math.pi*r1*t1)/(180));
ct2=cd+((math.pi*r2*t2)/(180));
print('chainage of T1=',ct1);
print('chainage of D=',cd);
print('chainage of T2',ct2);
from __future__ import division
import math
t1=30.5;
t2=40.5;
EF=175;
cb=1500;
k1=math.tan((t1/2)*(math.pi/180));
k2=math.tan((t2/2)*(math.pi/180));
r=EF/(k1+k2);
print('Radius R=',r);
et1=r*k1;
ft2=r*k2;
t3=180-(t1+t2);
print('angle Theta=',t3);
k3=(math.sin(t2*(math.pi/180)))/(math.sin(t3*(math.pi/180)));
k4=(math.sin(t1*(math.pi/180)))/(math.sin(t3*(math.pi/180)));
be=EF*k3;
bf=EF*k4;
t1d=(math.pi*r*t1)/180;
dt2=(math.pi*r*t2)/180;
print('curve length T1D=',t1d);
print('curve length DT2=',dt2);
ct1=cb-(be+et1);
ct2=ct1+t1d+dt2;
print('chainage of T1=',ct1);
print('chainage of T2=',ct2)
from __future__ import division
import math
t1=80-70;
l=50;
k=1/(math.cos(20*(math.pi/180)));
k1=k*(math.sin(t1*(math.pi/180)));
t3=math.asin(k1);
t3=t3*(180/(math.pi));
print('theta 3=',t3);
t3=180-t3;
t2=180-(t3+t1);
r=l*(math.sin(t1*(math.pi/180)))/(math.sin(0.6*(math.pi/180)));
print('Radius R=',r);
from __future__ import division
import math
sp=80;
v=(sp*1000)/(60*60);
cr=(1/8);
g=9.81;
a=60;
#a
r=(v*v)/(g*cr);
print('radius of circular curvature=',r);
#b
k=0.3;
l=(v*v*v)/(k*r);
print('length of transistion curve =',l);
sa=l/(2*r);
sa=sa*(180/(math.pi));
print('spiral angle=',sa);
ca=a-(2*sa);
print('central angle=',ca);
lcc=(math.pi*r*ca)/180;
print('length of circular curve =',lcc);
s=(l*l)/(24*r);
print('shift of curve =',s);
ag=a/2;
t=(r+s)*(math.tan(ag*(math.pi/180)))+(l/2);
print('tangent length =',t);
#c
cip=1150;
c1t=cip-t;
c1j=c1t+l;
c2j=c1j+lcc;
c2t=c2j+l;
print('chainage of 1st tangent point =',c1t);
print('chainage of 2nd tangent point =',c2t);
print('chainage of 1st junction point =',c1j);
print('chainage of 2nd junction point =',c2j);
from __future__ import division
import math
a=145;
cpi=1580;
de=5;
pi=30;
lct=0.00555;
da=180-a;
r=(1719)/5;
print('radius =',r);
#a
tl=r*(math.tan((da/2)*(math.pi/180)));
print('tangent length =',tl);
#b
cl=(math.pi*r*da)/180;
print('curve length =',cl);
#c
c1t=cpi-tl;
print('chainage of 1st point =',c1t);
#d
c2t=c1t+cl;
print('chainage of 2nd point =',c2t);
#e
lisc=1480-c1t;
print('length of final sub chord =',lisc);
#f
n=6;
ini=30;
cc=1480+(n*30);
print('chainage covered=',cc);
#g
lfsc=c2t-cc;
print('length of final sub chord',lfsc);
#h
dasc=((c2t+100)*lisc)/(r);
print('deflection angle for initial sub chord =',dasc,'min');
#i
dafc=((c2t+100)*pi)/r;
print('deflection angle for full chord',dafc/60,'min');
#j
dafsc=((c2t+100)*lfsc)/r;
print('deflection angle for final sub chord',dafsc/60,'min');
#k
tda=da/2;
print('total deflection angle=',tda);
#l
k=1/(math.cos(tda*(math.pi/180)));
ad=r*(k-1);
print('apex distance =',ad);
vs=r*(1-(math.cos(tda*(math.pi/180))));
print('versed sine of curve =',vs);
from __future__ import division
import math
pi=20;
cb=550;
rlb=375.5;
g1=0.5;
g2=-0.7;
#a
vc=((g1-g2)*20)/0.1;
print('length of vertical curve =',vc);
#b,c
ca=cb-(vc/2);
cc=ca+vc;
print('chainage of A',ca);
print('chainage of C',cc);
#d,e,f,g
rla=rlb-((g1*0.5*vc)/100);
rlc=rlb-((-g2*0.5*vc)/100);
rle=0.5*(rla+rlc);
rlf=0.5*(rlb+rle);
print('Rl of A',rla);
print('Rl of C',rlc);
print('Rl of E',rle);
print('Rl of F',rlf);
#h
tc=rlb-rlf;
print('tangent correction at the apex =',tc);
#i
tc1=((g1-g2)*(pi*pi))/(400*0.5*vc);
tc2=((g1-g2)*(2*pi*2*pi))/(400*0.5*vc);
tc3=((g1-g2)*(3*pi*3*pi))/(400*0.5*vc);
tc4=((g1-g2)*(4*pi*4*pi))/(400*0.5*vc);
tc5=((g1-g2)*(5*pi*5*pi))/(400*0.5*vc);
tc6=((g1-g2)*(6*pi*6*pi))/(400*0.5*vc);
print('tangent correction at 1st,2nd,3rd,4th,5th,6th, points',tc1,tc2,tc3,tc4,tc5,tc6);
#j
rp=(g1*pi)/100;
rl1=rla+rp;
rl2=rl1+rp;
rl3=rl2+rp;
rl4=rl3+rp;
rl5=rl4+rp;
rl6=rl5+rp;
print('RL of the points on grade');
print(rl1,rl2,rl3,rl4,rl5,rl6)
#k
rlc1=rl1-tc1;
rlc2=rl2-(tc2);
rlc3=rl3-(tc3);
rlc4=rl4-(tc4);
rlc5=rl5-(tc5);
rlc6=rl6-(tc6);
print('RL of the points on curve');
print(rlc1,rlc2,rlc3,rlc4,rlc5,rlc6);
#l
fp=0.14;
rlg5=rlb-fp;
rlg4=rlg5-fp;
rlg3=rlg4-fp;
rlg2=rlg3-fp;
rlg1=rlg2-fp;
print('Rls of points on the grade right side');
print(rlg5,rlg4,rlg3,rlg2,rlg1);
from __future__ import division
import math
cb=400;
rlb=250.5;
pi=30;
g1=-1.0;
g2=0.5;
g=0.1;
ga=20;
#a
vc=(g1-g2)/g;
vc=-vc*ga;
print('length of vertical curve',vc);
#b,c
ca=cb-(0.5*vc);
cc=ca+vc;
#d,e,f,g
rla=rlb+((0.5*vc)/100);
rlc=rlb+((0.5*0.5*vc)/100);
rle=0.5*(rla+rlc);
rlf=0.5*(rle+rlb);
print('RL of A=',rla);
print('RL of C=',rlc);
print('RL of E=',rle);
print('RL of F=',rlf);
#h
fp=pi/100;
rl1=rla-fp;
rl2=rl1-fp;
rl3=rl2-fp;
rl4=rl3-fp;
print('RL on the grade on the side AB ');
print(rl1,rl2,rl3,rl4);
#i
rp=(0.5*pi)/100;
rls4=rlb+rp
rls3=rls4+rp
rls2=rls3+rp
rls1=rls2+rp
print('RL on grade on side BC');
print(rls4,rls3,rls2,rls1);
#j
y1=((g1-g2)*(pi*pi))/(cb*0.5*vc);
y2=((g1-g2)*(2*pi*2*pi))/(cb*0.5*vc);
y3=((g1-g2)*(3*pi*3*pi))/(cb*0.5*vc);
y4=((g1-g2)*(4*pi*4*pi))/(cb*0.5*vc);
print('tangent correction from expression ');
print(y1,y2,y3,y4);