{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "# Chapter 9: Theodolite Traversing"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### ch-9 page 302   pb-1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(65.11978202514794, -63.50741753704864, -51.91315691660193)\n",
      "(38.20554919114786, 168.9587462008847, -30.579186368382416)\n",
      "(50.300792428502625, -176.58510902365015)\n",
      "('distance DA=', 183.60955979422673)\n",
      "('bearing of DA=', 74.10023981818601)\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "l1=75.5;\n",
    "l2=180.5\n",
    "l3=60.25\n",
    "\n",
    "t1=30.4;t2=69.4;t3=30.5;\n",
    "t2=180-t2;\n",
    "t3=180-t3;\n",
    "\n",
    "Lc1=l1*math.cos(t1*(math.pi/180))\n",
    "Lc2=l2*math.cos(t2*(math.pi/180))\n",
    "Lc3=l3*math.cos(t3*(math.pi/180))\n",
    "\n",
    "Ls1=l1*math.sin(t1*(math.pi/180))\n",
    "Ls2=l2*math.sin(t2*(math.pi/180))\n",
    "Ls3=-l3*math.sin(t3*(math.pi/180))\n",
    "\n",
    "print(Lc1,Lc2,Lc3);\n",
    "print(Ls1,Ls2,Ls3);\n",
    "Lc4=-Lc1-Lc2-Lc3;\n",
    "Ls4=-Ls1-Ls2-Ls3;\n",
    "\n",
    "print(Lc4,Ls4);\n",
    "\n",
    "t4=-math.atan(Ls4/Lc4);\n",
    "t4=t4*(180/math.pi);\n",
    "\n",
    "l4=math.sqrt(Lc4*Lc4+Ls4*Ls4);\n",
    "\n",
    "print('distance DA=',l4);\n",
    "print('bearing of DA=',t4);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### ch-9 page 304   pb-2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('length of DA is', 145.80634036039953, 'or', 12.053659639600497)\n",
      "when length of DA ,L=145.8\n",
      "('bearing at AB is=N', 82.44640641462031)\n",
      "when length of DA ,L=12.04\n",
      "0.999661660714\n",
      "('bearing at AB is=N', 1.4904797844587976)\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "l1=100;\n",
    "l2=80;\n",
    "l3=60;\n",
    "\n",
    "t2=39.5;t3=40.5;t4=49.75;\n",
    "\n",
    "L2=l2*math.cos(t2*(math.pi/180));\n",
    "L3=l3*math.cos(t3*(math.pi/180));\n",
    "\n",
    "D2=l2*math.sin(t2*(math.pi/180));\n",
    "D3=l3*math.sin(t3*(math.pi/180));\n",
    "\n",
    "l41=(157.86+math.sqrt(157.86*157.86-4*1757.5))/2;\n",
    "l42=(157.86-math.sqrt(157.86*157.86-4*1757.5))/2;\n",
    "\n",
    "print('length of DA is',l41,'or',l42);\n",
    "\n",
    "print('when length of DA ,L=145.8')\n",
    "\n",
    "k=math.cos(t4*(math.pi/180))\n",
    "k1=(L2+L3-(k*l41))/100;\n",
    "t1=math.acos(k1);\n",
    "t1=t1*(180/(math.pi))\n",
    "print('bearing at AB is=N',t1)\n",
    "\n",
    "\n",
    "print('when length of DA ,L=12.04')\n",
    "\n",
    "k=math.cos(t4*(math.pi/180))\n",
    "k1=(L2+L3-(k*l42))/100;\n",
    "k1=k1+0.004;\n",
    "t11=math.acos(k1);\n",
    "t11=t11*(180/(math.pi))\n",
    "print(k1)\n",
    "print('bearing at AB is=N',t11)\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### ch-9 page 305   pb-3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('latitude of AB,CD,DE are', 86.59373062437335, -57.03044742000232, -25.250000000000007)\n",
      "('Depature of AB,CD,DE are', 51.00760547755076, -48.708603624763775, -43.73428289111415)\n",
      "(-4.313283204371025, 41.43528103832716)\n",
      "('length of BC=', 348.51410778926174)\n",
      "('length of EA=', 317.28203276885586)\n"
     ]
    }
   ],
   "source": [
    "#ch-9 page 305   pb-3\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "l1=100.5;l3=75;l4=50.5;\n",
    "t1=30.5;t2=45;t3=40.5;t4=60;t5=40.25;\n",
    "\n",
    "\n",
    "L1=l1*math.cos(t1*(math.pi/180))\n",
    "L3=-l3*math.cos(t3*(math.pi/180))\n",
    "L4=-l4*math.cos(t4*(math.pi/180))\n",
    "\n",
    "print('latitude of AB,CD,DE are',L1,L3,L4);\n",
    "D1=l1*math.sin(t1*(math.pi/180))\n",
    "D3=-l3*math.sin(t3*(math.pi/180))\n",
    "D4=-l4*math.sin(t4*(math.pi/180))\n",
    "print('Depature of AB,CD,DE are',D1,D3,D4);\n",
    "\n",
    "L2_L5=-(L1+L3+L4);\n",
    "D2_D5=-(D1+D3+D4);\n",
    "print(L2_L5,D2_D5)\n",
    "\n",
    "k=0.117;\n",
    "l5=(L2_L5+D2_D5)/(k);\n",
    "\n",
    "k1=0.763;\n",
    "\n",
    "l2=(k1*l5)-L2_L5;\n",
    "l2=l2/0.707;\n",
    "\n",
    "print('length of BC=',l2);\n",
    "print('length of EA=',l5);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### ch-9 page 307   pb-4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('latitudes of AQ,QR,RB are', 65.21958064293187, -61.02257873940248, -36.93176700776003)\n",
      "('Depature of AQ,QR,RB are', 38.03493526693723, 52.118205878497236, -65.27667719549248)\n",
      "('length of AB=', 41.114514530539196, 'meters')\n"
     ]
    }
   ],
   "source": [
    "#ch-9 page 307   pb-4\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "l1=75.5;l2=80.25;l3=75;\n",
    "t1=30.25;t2=40.5;t3=60.5;\n",
    "\n",
    "\n",
    "L1=l1*math.cos(t1*(math.pi/180))\n",
    "L2=-l2*math.cos(t2*(math.pi/180))\n",
    "L3=-l3*math.cos(t3*(math.pi/180))\n",
    "print('latitudes of AQ,QR,RB are',L1,L2,L3);\n",
    "\n",
    "\n",
    "D1=l1*math.sin(t1*(math.pi/180))\n",
    "D2=l2*math.sin(t2*(math.pi/180))\n",
    "D3=-l3*math.sin(t3*(math.pi/180))\n",
    "print('Depature of AQ,QR,RB are',D1,D2,D3);\n",
    "\n",
    "L4=-(L1+L2+L3);\n",
    "D4=-(D1+D2+D3);\n",
    "\n",
    "l4=math.sqrt(L4*L4+(D4*D4));\n",
    "\n",
    "print('length of AB=',l4,'meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### ch-9 page 308   pb-5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('latitudes of BQ,QP,PA are', -96.23556979807799, -172.32583208830516, -61.552945012933385)\n",
      "('Depature of BQ,QP,PA are', 115.71069572705566, -101.50767259214082, -108.79446199248746)\n",
      "('length of AB=', 343.3992171422471, 'meters')\n",
      "('bearing of AB=', 15.989201746570728)\n",
      "('PAB=', 44.51079825342927, 'QBA=', 66.23920174657073)\n"
     ]
    }
   ],
   "source": [
    "#ch-9 page 308   pb-5\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "l1=150.5;l2=200;l3=125;\n",
    "t1=50.25;t2=30.5;t3=60.5;\n",
    "\n",
    "\n",
    "L1=-l1*math.cos(t1*(math.pi/180))\n",
    "L2=-l2*math.cos(t2*(math.pi/180))\n",
    "L3=-l3*math.cos(t3*(math.pi/180))\n",
    "print('latitudes of BQ,QP,PA are',L1,L2,L3);\n",
    "\n",
    "\n",
    "D1=l1*math.sin(t1*(math.pi/180))\n",
    "D2=-l2*math.sin(t2*(math.pi/180))\n",
    "D3=-l3*math.sin(t3*(math.pi/180))\n",
    "print('Depature of BQ,QP,PA are',D1,D2,D3);\n",
    "\n",
    "L4=-(L1+L2+L3);\n",
    "D4=-(D1+D2+D3);\n",
    "\n",
    "l4=math.sqrt(L4*L4+(D4*D4));\n",
    "\n",
    "print('length of AB=',l4,'meters');\n",
    "\n",
    "t4=math.atan(D4/L4);\n",
    "t4=t4*(180/math.pi);\n",
    "print('bearing of AB=',t4);\n",
    "\n",
    "PAB=t3-t4;\n",
    "QBA=t1+t4;\n",
    "\n",
    "print('PAB=',PAB,'QBA=',QBA);\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### ch-9 page 308   pb-6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('latitudes of AB,BC,CD,DE are', 121.76738460229168, 106.68654829016975, -133.98333444865727, 19.805712703281312)\n",
      "('Depature of AB,BC,CD,DE are', 45.52695956373076, 186.6627451151656, 78.9222154403895, 118.35427218446777)\n",
      "('length of EA=', 444.4100422146986, 'meters')\n",
      "('bearing of EA=', 75.09947760257306)\n",
      "('bearing from F to C is =', 5.818201574554788)\n",
      "('distance from F to C is =', 172.2028708809785)\n"
     ]
    }
   ],
   "source": [
    "#ch-9 page 308   pb-6\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "l1=130;l2=215;l3=155.5;l4=120;\n",
    "t1=20.5;t2=60.25;t3=30.5;t4=80.5;\n",
    "\n",
    "\n",
    "L1=l1*math.cos(t1*(math.pi/180))\n",
    "L2=l2*math.cos(t2*(math.pi/180))\n",
    "L3=-l3*math.cos(t3*(math.pi/180))\n",
    "L4=l4*math.cos(t4*(math.pi/180))\n",
    "print('latitudes of AB,BC,CD,DE are',L1,L2,L3,L4);\n",
    "\n",
    "\n",
    "D1=l1*math.sin(t1*(math.pi/180))\n",
    "D2=l2*math.sin(t2*(math.pi/180))\n",
    "D3=l3*math.sin(t3*(math.pi/180))\n",
    "D4=l4*math.sin(t4*(math.pi/180))\n",
    "print('Depature of AB,BC,CD,DE are',D1,D2,D3,D4);\n",
    "\n",
    "L5=-(L1+L2+L3+L4);\n",
    "D5=-(D1+D2+D3+D4);\n",
    "\n",
    "l5=math.sqrt(L5*L5+(D5*D5));\n",
    "\n",
    "print('length of EA=',l5,'meters');\n",
    "\n",
    "t5=math.atan(D5/L5);\n",
    "t5=t5*(180/math.pi);\n",
    "print('bearing of EA=',t5);\n",
    "\n",
    "FA=l5/2;\n",
    "l6=FA;\n",
    "t6=t5;\n",
    "L6=-l6*math.cos(t6*(math.pi/180))\n",
    "D6=-l6*math.sin(t6*(math.pi/180))\n",
    "\n",
    "L7=-(L1+L2+L6)\n",
    "D7=-(D1+D2+D6)\n",
    "\n",
    "t7=math.atan(D7/L7);\n",
    "t7=t7*(180/math.pi);\n",
    "print('bearing from F to C is =',t7);\n",
    "\n",
    "l7=math.sqrt(L7*L7+(D7*D7));\n",
    "\n",
    "print('distance from F to C is =',l7);\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### ch-9 page 308   pb-7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('latitudes of AB,DE,EA are', 362.50000000000006, -538.0859250785912, -574.3378222288467)\n",
      "('Depature of AB,DE,EA are', 627.8684177437179, -782.9198791909149, -27.587423899772766)\n",
      "('t2-t3=', 100.07865810778766)\n",
      "('Bearing of BC is', 63.0)\n",
      "('Bearing of CD is', 37.12098009569709)\n"
     ]
    }
   ],
   "source": [
    "#ch-9 page 308   pb-7\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "l1=725;l2=1050;l3=1250;l4=950;l5=575;\n",
    "t1=60;t4=55.5;t5=2.75;\n",
    "\n",
    "\n",
    "L1=l1*math.cos(t1*(math.pi/180))\n",
    "L4=-l4*math.cos(t4*(math.pi/180))\n",
    "L5=-l5*math.cos(t5*(math.pi/180))\n",
    "print('latitudes of AB,DE,EA are',L1,L4,L5);\n",
    "\n",
    "\n",
    "D1=l1*math.sin(t1*(math.pi/180))\n",
    "D4=-l4*math.sin(t4*(math.pi/180))\n",
    "D5=-l5*math.sin(t5*(math.pi/180))\n",
    "print('Depature of AB,DE,EA are',D1,D4,D5);\n",
    "\n",
    "t2_t3=math.acos(0.1750);\n",
    "t2_t3=180-(t2_t3*(180/math.pi));\n",
    "\n",
    "print('t2-t3=',t2_t3);\n",
    "\n",
    "t3=math.asin(0.6035);\n",
    "t3=t3*(180/math.pi);\n",
    "t2=t2_t3-t3;\n",
    "t2=math.ceil(t2);\n",
    "\n",
    "print('Bearing of BC is',t2);\n",
    "print('Bearing of CD is',t3);\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}