{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "# Chapter 1: Introduction\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem1, pg 25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "true length= 327.4905\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "l=20;                #chain length\n",
    "e=0.03;              #error\n",
    "l1=l+e;              #L'\n",
    "ml=327;              #measured length\n",
    "truel=(l1/l)*(ml)    #true length\n",
    "print (\"true length=\",truel)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem2, pg 25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "amount of error= 0.20083682008368697\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "l1=20;                  #chain 1 length\n",
    "e=0.05;                 #error\n",
    "l11=l1+e;               \n",
    "ml1=1200;               #measured lenght\n",
    "tl=(l11/l1)*ml1;        #true lenght of line\n",
    "\n",
    "l2=30;                  #chain 2 length\n",
    "ml2=1195;               #measured length\n",
    "\n",
    "l21=(tl/ml2)*l2;        \n",
    "ae=l21-l2;              #amount of error\n",
    "print('amount of error=',ae)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem3, pg 25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "true length1= 901.35\n",
      "true length 2= 678.3750000000001\n",
      "true distance= 1579.7250000000001\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "l1=20\n",
    "e=(0.06/2)                      #consider mean elongation\n",
    "l11=l1+e;\n",
    "ml=900;\n",
    "tl=(l11/l1)*ml;\n",
    "print('true length1=',tl)\n",
    "l2=20;\n",
    "e2=(0.06+0.14)/2;\n",
    "l21=20+e2;\n",
    "ml2=1575-ml;\n",
    "\n",
    "tl2=(l21/l2)*ml2;\n",
    "print('true length 2=',tl2)\n",
    "td=tl+tl2;\n",
    "print('true distance=',td)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem4, pg26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "distance between stations on  map= 35.0 centimeters\n",
      "true distance on ground = 1750.0 meters\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "s=100;\n",
    "dsm=3500;\n",
    "adsm=dsm/s;\n",
    "\n",
    "print('distance between stations on  map=',adsm,'centimeters')\n",
    "\n",
    "actuals=50;\n",
    "td=adsm*actuals;\n",
    "\n",
    "print('true distance on ground =',td,'meters')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 5, pg 26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "actual area present= 132.01840894148586 square cm\n",
      "true area= 212286.9217619987 square meters\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "present=19.5\n",
    "actual=20;\n",
    "cm1=actual/present;\n",
    "cm12=(actual*actual)/(present*present);\n",
    "pm=125.5;\n",
    "apm=pm*cm12;\n",
    "print('actual area present=',apm,'square cm');\n",
    "\n",
    "cm=40;\n",
    "cm2=cm*cm;\n",
    "\n",
    "area=cm2*apm;\n",
    "scale=(20.05*20.05)/(20*20);\n",
    "ta=scale*area;\n",
    "print('true area=',ta,'square meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 6, pg 27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " for n=1\n",
      "the temperature correction is 0.00396 meters\n",
      "the pull corretion is  0.002380952380952381  meters\n",
      "the sag correction is   -0.0026680499999999995 meters\n",
      "the total correction is  0.0036729023809523816 meters\n",
      "the true length  is  780.0954954619046\n",
      " for n=2\n",
      "the temperature correction is 0.00396 meters\n",
      "the pull corretion is  0.002380952380952381  meters\n",
      "the sag correction is   -0.0006670124999999999 meters\n",
      "the total correction is  0.005673939880952382 meters\n",
      "the true length  is  780.1475224369049\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "L=30;\n",
    "t0=20;\n",
    "p0=10;\n",
    "pm=15;\n",
    "tm=32;\n",
    "a=0.03;\n",
    "al=11/(1000000);\n",
    "E=2.1*(1000000);\n",
    "w=0.693;\n",
    "ml=780;\n",
    "n=1;\n",
    "print(' for n=1')\n",
    "ct=al*L*(tm-t0);\n",
    "print('the temperature correction is',ct,'meters');\n",
    "\n",
    "cp=(pm-p0)*L/(a*E);\n",
    "print('the pull corretion is ',cp,' meters');\n",
    "\n",
    "cs=-L*w*w/(24*pm*pm*n*n);\n",
    "print('the sag correction is  ',cs,'meters');\n",
    "\n",
    "e=ct+cp+cs;\n",
    "print('the total correction is ',e,'meters');\n",
    "\n",
    "l1=L+e;\n",
    "\n",
    "truelength=(l1/L)*ml;\n",
    "print('the true length  is ',truelength);\n",
    "\n",
    "n=2;\n",
    "\n",
    "print(' for n=2')\n",
    "ct=al*L*(tm-t0);\n",
    "print('the temperature correction is',ct,'meters');\n",
    "\n",
    "cp=(pm-p0)*L/(a*E);\n",
    "print('the pull corretion is ',cp,' meters');\n",
    "\n",
    "cs=-L*w*w/(24*pm*pm*n*n);\n",
    "print('the sag correction is  ',cs,'meters');\n",
    "\n",
    "e=ct+cp+cs;\n",
    "print('the total correction is ',e,'meters');\n",
    "\n",
    "l1=L+e;\n",
    "\n",
    "truelength=(l1/L)*ml;\n",
    "print('the true length  is ',truelength);\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 7, pg 28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the temperature correction is 0.0021999999999999997 meters\n",
      "the pull corretion is  -0.002380952380952381  meters\n",
      "the sag correction is   -0.0013333333333333335 meters\n",
      "the total correction is  -0.001514285714285715 meters\n",
      "the horizontal distance  is  19.998485714285714\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from __future__ import division\n",
    "\n",
    "L=20;\n",
    "t0=20;\n",
    "p0=15;\n",
    "p=10;\n",
    "tm=30;\n",
    "a=0.02;\n",
    "al=11/(1000000);\n",
    "E=2.1*(1000000);\n",
    "w=0.4;\n",
    "\n",
    "n=1;\n",
    "ct=al*L*(tm-t0);\n",
    "print('the temperature correction is',ct,'meters');\n",
    "\n",
    "cp=(p-p0)*L/(a*E);\n",
    "print('the pull corretion is ',cp,' meters');\n",
    "\n",
    "cs=-L*w*w/(24*p*p*n*n);\n",
    "print('the sag correction is  ',cs,'meters');\n",
    "\n",
    "e=ct+cp+cs;\n",
    "print('the total correction is ',e,'meters');\n",
    "\n",
    "hd=L+e;\n",
    "\n",
    "print('the horizontal distance  is ',hd);\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 8, pg 29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "for p=5 case\n",
      "the temperature correction is 0.00165 meters\n",
      "the pull corretion is  0.0  meters\n",
      "the sag correction is   -0.02178 meters\n",
      "the total correction is  -0.020130000000000002 meters\n",
      "the horizontal distance  is  29.97987\n",
      "for p=11 case\n",
      "the temperature correction is 0.00165 meters\n",
      "the pull corretion is  0.004285714285714286  meters\n",
      "the sag correction is   -0.0045000000000000005 meters\n",
      "the total correction is  0.001435714285714285 meters\n",
      "the horizontal distance  is  30.001435714285716\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from __future__ import division\n",
    "\n",
    "L=30;\n",
    "t0=20;\n",
    "p0=5;\n",
    "tm=25;\n",
    "a=0.02;\n",
    "al=11/(1000000);\n",
    "E=2.1*(1000000);\n",
    "float(E);\n",
    "float(al);\n",
    "w1=22;\n",
    "w=0.66;\n",
    "n=1;\n",
    "\n",
    "p=5;\n",
    "print('for p=5 case');\n",
    "\n",
    "ct=al*L*(tm-t0);\n",
    "float(ct);\n",
    "print('the temperature correction is',ct,'meters');\n",
    "\n",
    "cp=(p-p0)*L/(a*E);\n",
    "print('the pull corretion is ',cp,' meters');\n",
    "\n",
    "cs=-L*w*w/(24*p*p*n*n);\n",
    "print('the sag correction is  ',cs,'meters');\n",
    "\n",
    "e=ct+cp+cs;\n",
    "print('the total correction is ',e,'meters');\n",
    "\n",
    "hd=L+e;\n",
    "\n",
    "print('the horizontal distance  is ',hd);\n",
    "\n",
    "p=11;\n",
    "print('for p=11 case');\n",
    "\n",
    "ct=al*L*(tm-t0);\n",
    "print('the temperature correction is',ct,'meters');\n",
    "\n",
    "cp=(p-p0)*L/(a*E);\n",
    "print('the pull corretion is ',cp,' meters');\n",
    "\n",
    "cs=-L*w*w/(24*p*p*n*n);\n",
    "print('the sag correction is  ',cs,'meters');\n",
    "\n",
    "e=ct+cp+cs;\n",
    "print('the total correction is ',e,'meters');\n",
    "\n",
    "hd=L+e;\n",
    "\n",
    "print('the horizontal distance  is ',hd);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 9, pg 30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the temperature correction is 0.00264 meters\n",
      "the pull corretion is  0.003492063492063492  meters\n",
      "the sag correction is   -0.001171875 meters\n",
      "the total correction is  0.004960188492063492 meters\n",
      "the true length  is  680.1686464087301\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from __future__ import division\n",
    "\n",
    "L=20;\n",
    "t0=20;\n",
    "p0=5;\n",
    "pm=16;\n",
    "tm=32;\n",
    "a=0.03;\n",
    "al=11/(1000000);\n",
    "E=2.1*(1000000);\n",
    "w=0.6;\n",
    "ml=680;\n",
    "n=1;\n",
    "\n",
    "\n",
    "ct=al*L*(tm-t0);\n",
    "print('the temperature correction is',ct,'meters');\n",
    "\n",
    "cp=(pm-p0)*L/(a*E);\n",
    "print('the pull corretion is ',cp,' meters');\n",
    "\n",
    "cs=-L*w*w/(24*pm*pm*n*n);\n",
    "print('the sag correction is  ',cs,'meters');\n",
    "\n",
    "e=ct+cp+cs;\n",
    "print('the total correction is ',e,'meters');\n",
    "\n",
    "l1=L+e;\n",
    "\n",
    "truelength=(l1/L)*ml;\n",
    "print('the true length  is ',truelength);\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 10, pg 31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the temperature correction is 0.0061600000000000005 meters\n",
      "the pull corretion is  -0.0033333333333333335  meters\n",
      "the sag correction is   -0.008979994074074075 meters\n",
      "the total correction is  -0.006153327407407408 meters\n",
      "the correctt distance  is  679.8505620486773\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "\n",
    "L=28;\n",
    "t0=20;\n",
    "p0=10;\n",
    "pm=5;\n",
    "tm=40;\n",
    "a=0.02;\n",
    "al=11/(1000000);\n",
    "E=2.1*(1000000);\n",
    "w1=470;\n",
    "ml=680;\n",
    "n=1;\n",
    "\n",
    "w=(470*28)/30;\n",
    "w=w/1000;\n",
    "\n",
    "ct=al*L*(tm-t0);\n",
    "print('the temperature correction is',ct,'meters');\n",
    "\n",
    "cp=(pm-p0)*L/(a*E);\n",
    "print('the pull corretion is ',cp,' meters');\n",
    "\n",
    "cs=-L*w*w/(24*pm*pm*n*n);\n",
    "print('the sag correction is  ',cs,'meters');\n",
    "\n",
    "e=ct+cp+cs;\n",
    "print('the total correction is ',e,'meters');\n",
    "\n",
    "l1=L+e;\n",
    "\n",
    "dis=(l1/L)*ml;\n",
    "print('the correctt distance  is ',dis);\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 11, pg32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "from fig p.1.1\n",
      "87\n",
      " the value of EF is  135.34797293685585 meters\n",
      " the value of DF is  103.68256255569626 meters\n",
      " the value of EG is  205.85953773426738 meters\n"
     ]
    }
   ],
   "source": [
    "#ch-1, problems on obstacles in chaining, page-32,pb-1\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math;\n",
    "\n",
    "print('from fig p.1.1')\n",
    "DE=87;\n",
    "print(DE);\n",
    "EF=float(87/(math.cos(50*(math.pi/180))))\n",
    "\n",
    "DF=87*(math.tan(50*(math.pi/180)))\n",
    "\n",
    "EG=87/(math.cos(65*(math.pi/180)))\n",
    "\n",
    "\n",
    "print(' the value of EF is ',EF,'meters');\n",
    "\n",
    "print(' the value of DF is ',DF,'meters');\n",
    "\n",
    "print(' the value of EG is ',EG,'meters');         \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 12, pg 33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "width of river is  227.23577649516116 meters\n"
     ]
    }
   ],
   "source": [
    "#ch-1 page-33, pb-2\n",
    "import math\n",
    "\n",
    "\n",
    "x=(380.0285/2.5754);\n",
    "\n",
    "PA=x;\n",
    "AQ=367-x;\n",
    "al=180-(36.45+86.55);\n",
    "bt=86.35-40-35;\n",
    "\n",
    "TA=AQ*math.tan(46*(math.pi/180));\n",
    "\n",
    "print('width of river is ',TA,'meters');\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Problem 13, pg 34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "width of river is  316.63370603933663 meters\n"
     ]
    }
   ],
   "source": [
    "# cha-1 page-34 pb-3\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "x=(849.224)/2.6196\n",
    "\n",
    "\n",
    "\n",
    "PA=x;\n",
    "AQ=517-x;\n",
    "al=78-33.67;\n",
    "bt=180-(43.333+78);\n",
    "\n",
    "TA=AQ*math.tan(58.66*(math.pi/180));\n",
    "\n",
    "print('width of river is ',TA,'meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 14, pg35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "chainage of C is 277.08203230275507 meters\n"
     ]
    }
   ],
   "source": [
    "# cha-1 page-34,35  pb-4\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "al=288.5-(48.5+180);\n",
    "bt=90-48.5;\n",
    "BAC=360-41.5;\n",
    "\n",
    "AC=40*(math.tan(60*(math.pi/180)));\n",
    "\n",
    "A=207.8;\n",
    "\n",
    "C=A+AC;\n",
    "\n",
    "print('chainage of C is',C,'meters');\n",
    "       \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### Problem 15, pg36"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "width of the river is  74.99999999999999 meters\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "import math\n",
    "BB=287.25;\n",
    "MC=62.25;\n",
    "al=(BB-180)-MC;\n",
    "BM=75;\n",
    "BC=BM*(math.tan(45*(math.pi/180)))\n",
    "\n",
    "print('width of the river is ',BC,'meters')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### Problem 16, pg 36"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "AB= 241.8677324489565\n"
     ]
    }
   ],
   "source": [
    "#CH-1 PAGE-36  PB-6;\n",
    "\n",
    "from __future__ import division\n",
    "import math\n",
    "\n",
    "\n",
    "AC=250;\n",
    "AD=300;\n",
    "DB=150;\n",
    "BC=100;\n",
    "DC=DB+BC;\n",
    "\n",
    "cosal=(AD*AD+DC*DC-(AC*AC))/(2*AD*DC);\n",
    "\n",
    "AB=math.sqrt((AD*AD+DB*DB)-2*(AD*DB*cosal));\n",
    "\n",
    "print('AB=',AB);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 17, pg37"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "al 63.43494882292201\n",
      "bt= 26.56505117707799\n",
      "k= 0.5\n",
      "chinage of c is 375.5 meters\n"
     ]
    }
   ],
   "source": [
    "# ch-1 page-36,37   pb-7\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "\n",
    "import math\n",
    "\n",
    "BE=50;\n",
    "AB=25;\n",
    "AEC=157.5-67.5;\n",
    "\n",
    "al=math.atan2(BE,AB);\n",
    "al=al*(180/math.pi);\n",
    "\n",
    "print('al',al)\n",
    "\n",
    "bt=90-al;\n",
    "print('bt=',bt);\n",
    "k=(math.tan(bt*math.pi/180))\n",
    "\n",
    "print('k=',k)\n",
    "BC=BE/k;\n",
    "C=275.5+BC;\n",
    "print('chinage of c is',C,'meters')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 18, pg38"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "measured length is  79.71623152917896 meters\n",
      "true length is  79.61658623976749 meters\n"
     ]
    }
   ],
   "source": [
    "#ch-1  page -37,38  pb-1\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "\n",
    "a=17.5;\n",
    "b=19.3;\n",
    "c=17.8;\n",
    "d=13.6;\n",
    "e=12.9;\n",
    "\n",
    "da=2.35;\n",
    "db=4.20;\n",
    "dc=2.95;\n",
    "dd=1.65;\n",
    "de=3.25;\n",
    "\n",
    "AB=math.sqrt((a*a)-(da*da));\n",
    "BC=math.sqrt((b*b)-(db*db));\n",
    "CD=math.sqrt((c*c)-(dc*dc));\n",
    "DE=math.sqrt((d*d)-(dd*dd));\n",
    "EF=math.sqrt((e*e)-(de*de));\n",
    "\n",
    "total=AB+BC+CD+DE+EF;\n",
    "print('measured length is ',total,'meters');\n",
    "\n",
    "e=0.025;\n",
    "l=20;\n",
    "l1=l-e;\n",
    "ml=total;\n",
    "\n",
    "tl=(l1/l)*ml;\n",
    "\n",
    "print('true length is ',tl,'meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 19, pg 38"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "measured length is  531.2592044589876 meters\n",
      "true length is  532.587352470135 meters\n"
     ]
    }
   ],
   "source": [
    "#ch-1  page -38  pb-2\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "ab=550;\n",
    "AB=ab*(math.cos(15*(math.pi/180)));\n",
    "\n",
    "l=20;\n",
    "e=0.05;\n",
    "l1=l+e;\n",
    "ml=AB;\n",
    "print('measured length is ',ml,'meters');\n",
    "\n",
    "tl=(l1/l)*ml;\n",
    "\n",
    "print('true length is ',tl,'meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 20, pg39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "horizontal distance 1 is  275.74617084341827 meters\n",
      "horizontal distance 2 is  278.61041325879694 meters\n",
      "horizontal distance 3 is  279.8856909525744 meters\n"
     ]
    }
   ],
   "source": [
    "#ch-1  page -38,39  pb-3\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "ab=280;\n",
    "\n",
    "AB1=ab*(math.cos(10*(math.pi/180)));\n",
    "\n",
    "print('horizontal distance 1 is ',AB1,'meters');\n",
    "\n",
    "cosal=(10/(math.sqrt(101)));\n",
    "\n",
    "AB2=ab*cosal;\n",
    "\n",
    "print('horizontal distance 2 is ',AB2,'meters');\n",
    "\n",
    "bb=8;\n",
    "AB3=math.sqrt(ab*ab-(bb*bb));\n",
    "\n",
    "print('horizontal distance 3 is ',AB3,'meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 21, pg40"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "measured length is  101.35201880331583 meters\n",
      "true horizontal distance is  101.26755878764641 meters\n"
     ]
    }
   ],
   "source": [
    "#ch-1  page -39,40  pb-4\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "a=28.7;\n",
    "b=23.4;\n",
    "c=20.9;\n",
    "d=29.6;\n",
    "\n",
    "ag=5;\n",
    "bg=7;\n",
    "cg=10;\n",
    "dg=12;\n",
    "\n",
    "AB=a*(math.cos(ag*(math.pi/180)));\n",
    "\n",
    "BC=b*(math.cos(bg*(math.pi/180)));\n",
    "\n",
    "CD=c*(math.cos(cg*(math.pi/180)));\n",
    "\n",
    "DE=d*(math.cos(dg*(math.pi/180)));\n",
    "\n",
    "total=AB+BC+CD+DE;\n",
    "\n",
    "ml=total;\n",
    "\n",
    "print('measured length is ',ml,'meters');\n",
    "\n",
    "l=30;\n",
    "e=0.025;\n",
    "l1=l-e;\n",
    "\n",
    "tl=(l1/l)*ml;\n",
    "\n",
    "print('true horizontal distance is ',tl,'meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 22, pg 40"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "theta1= 30.009552668941378\n",
      "theta2= 106 degrees 32.534711618974654 minutes\n"
     ]
    }
   ],
   "source": [
    "#ch-1  page -40  pb-1\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "\n",
    "a=23;\n",
    "b=16.5;\n",
    "c=12;\n",
    "\n",
    "\n",
    "t1=math.acos((a*a+b*b-(c*c))/(2*a*b));\n",
    "t1=t1*(180/math.pi);\n",
    "\n",
    "print('theta1=',t1);\n",
    "\n",
    "t2=math.acos((c*c+b*b-(a*a))/(2*c*b));\n",
    "t2=t2*(180/math.pi);\n",
    "dg=int(t2)\n",
    "mi=t2-int(t2)\n",
    "mi=(mi*60);\n",
    "print('theta2=',dg,'degrees',mi,'minutes');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 23, pg 41"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "theta1= 5 degrees 46.94403663966165 minutes\n",
      "theta2= 165 degrees 26.421472313304548 minutes\n"
     ]
    }
   ],
   "source": [
    "#ch-1  page -40,41  pb-2\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "import math\n",
    "\n",
    "\n",
    "a=257;\n",
    "b=156;\n",
    "c=103;\n",
    "\n",
    "\n",
    "t1=math.acos((a*a+b*b-(c*c))/(2*a*b));\n",
    "t1=t1*(180/math.pi);\n",
    "\n",
    "dg1=int(t1)\n",
    "mi1=t1-int(t1)\n",
    "mi1=(mi1*60);\n",
    "print('theta1=',dg1,'degrees',mi1,'minutes');\n",
    "\n",
    "\n",
    "t2=math.acos((c*c+b*b-(a*a))/(2*c*b));\n",
    "t2=t2*(180/math.pi);\n",
    "dg=int(t2)\n",
    "mi=t2-int(t2)\n",
    "mi=(mi*60);\n",
    "print('theta2=',dg,'degrees',mi,'minutes');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 24, pg 42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RF is  0.025\n",
      "length of scale is  15.000000000000002 meters\n"
     ]
    }
   ],
   "source": [
    "#CH-1 PAGE-42  PB-1;\n",
    "\n",
    "from __future__ import division\n",
    "import math\n",
    "\n",
    "\n",
    "sc=100;\n",
    "a=2.5;\n",
    "m=6;\n",
    "\n",
    "RF=(a/sc);\n",
    "\n",
    "print('RF is ',RF);\n",
    "\n",
    "length=RF*m*sc;\n",
    "\n",
    "print('length of scale is ',length,'meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 25, pg 42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RF= 0.0002\n",
      "length of final scale is  700.0\n"
     ]
    }
   ],
   "source": [
    "#CH-1 PAGE-42,43  PB-2;\n",
    "\n",
    "from __future__ import division\n",
    "import math\n",
    "\n",
    "\n",
    "sc=100;\n",
    "area=93750;\n",
    "l=6.0;\n",
    "b=6.25;\n",
    "\n",
    "cm2=(area)/(l*b);\n",
    "\n",
    "cm=math.sqrt(cm2);\n",
    "RF=1/(sc*cm);\n",
    "\n",
    "print('RF=',RF);\n",
    "\n",
    "leng=14;\n",
    "leng=leng*cm;\n",
    "\n",
    "print('length of final scale is ',leng);\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Problem 26, pg 43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RF= 0.00025\n",
      "length of scale is  600.0 meters\n"
     ]
    }
   ],
   "source": [
    "#CH-1 PAGE-43  PB-3;\n",
    "\n",
    "from __future__ import division\n",
    "import math\n",
    "\n",
    "l=1.2;\n",
    "al=30;\n",
    "al=al/100;\n",
    "sc=1000;\n",
    "\n",
    "\n",
    "RF=(al)/(sc*l);\n",
    "print('RF=',RF);\n",
    "\n",
    "\n",
    "cm1=(1/RF)/(100);\n",
    "\n",
    "lsc=15;\n",
    "cm15=lsc*cm1;\n",
    "\n",
    "print('length of scale is ',cm15,'meters');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### Problem 27, pg44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1cm= 30.0\n",
      "RF= 0.03333333333333333\n",
      "length of scale is 13.333333333333334 CENTIMETERS\n"
     ]
    }
   ],
   "source": [
    "#CH-1 PAGE-44  PB-4;\n",
    "\n",
    "from __future__ import division\n",
    "import math\n",
    "\n",
    "\n",
    "sc=100;\n",
    "hect=10000;\n",
    "area=0.45*hect;\n",
    "\n",
    "cm1=(area)/5;\n",
    "cm=math.sqrt(cm1);\n",
    "\n",
    "print('1cm=',cm);\n",
    "RF=1/(cm);\n",
    "print('RF=',RF);\n",
    "\n",
    "\n",
    "maxl=400;\n",
    "\n",
    "los=(RF*maxl);\n",
    "\n",
    "print('length of scale is',los,'CENTIMETERS');\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}