{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#Chapter-1, Section-1.22, pg-24, problem 1\n",
    "\n",
    "L=20;                                                           #True length of the chain is defined as L\n",
    "print(' the length of the chain is ',L,'meters');               #Print L\n",
    "\n",
    "E=0.03;                                                         # Error in chain\n",
    "print(' the error in the chain is  ',E);                        # Print E\n",
    "\n",
    "ML=327;                                                         # Measured length is defined as ML\n",
    "print(' the measured length ',ML,'meters');                     #print ML\n",
    "\n",
    "tlength=((L+E)/L)*ML;                                          #True length of L calculated\n",
    "print(' the ture length of the chain is ',tlength,'meters')    # Print true length.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Chapter-1, Section-1.23, pg 39, Problem- 4\n",
    "\n",
    "import math                                                                    # Library imported.\n",
    "\n",
    "ab=28.7*math.cos(5*(math.pi/180));                                             #AB calculated using trigonometry\n",
    "b1c=23.4*math.cos(7*(math.pi/180));                                            #B'C calculated\n",
    "c1d=20.9*math.cos(10*(math.pi/180));                                           # C'D calculated\n",
    "d1e=29.6*math.cos(12*(math.pi/180)) ;                                          # D'E calculated\n",
    "print(' the value of ab is ',ab,'meters');                                    #AB printed\n",
    "\n",
    "print(' the value of b1c is ',b1c,'meters');                                 #B'C printed\n",
    "\n",
    "print(' the value of c1d is ',c1d,'meters');                                 #C'D printed\n",
    "\n",
    "print(' the value of d1e is ',d1e,'meters');                                 #D'E printed\n",
    "\n",
    "\n",
    "total=ab+b1c+c1d+d1e;                                                        #total calculated.\n",
    "print('the total distance is ',total,'meters')                               #total printed\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Chapter 1, Section 1.22, Problem 6, pg 27.\n",
    "\n",
    "L=30;                                                         # Length of tape\n",
    "t0=20;                                                        # Temperature of tape\n",
    "p0=10;                                                        # Pull under which tape is present\n",
    "pm=15;                                                         # Measured line pull\n",
    "tm=32;                                                          # Mean temperature.\n",
    "a=0.03;                                                        # Cross-sectional area\n",
    "al=11/(1000000);                                               # Temperature correction co-efficient\n",
    "E=2.1*(1000000);                                                # E for steel\n",
    "w=0.693;                                                        #Total weight\n",
    "ml=780;                                                         #measured length\n",
    "\n",
    "n=1;                                                            #n defined\n",
    "print(' for n=1');                                               #print n value\n",
    "ct=al*L*(tm-t0);                                                 # temperature correction calculated\n",
    "print('the temperature correction is',ct,'meters');              # print temperature correction\n",
    "\n",
    "cp=(pm-p0)*L/(a*E);                                             #pull correction calculated\n",
    "print('the pull corretion is ',cp,' meters');                   #print pull correction\n",
    "\n",
    "cs=-L*w*w/(24*pm*pm*n*n);                                        #sag correction calculated\n",
    "print('the sag correction is  ',cs,'meters');                    # print sag correction\n",
    "\n",
    "e=ct+cp+cs;                                                       #total correction calculated\n",
    "print('the total correction is ',e,'meters');                     # total correction printed\n",
    "\n",
    "l1=L+e;                                                           # correction in length =sum of correction and measured length \n",
    "\n",
    "truelength=(l1/L)*ml;                                              #true length calculated\n",
    "print('the true length  is ',truelength);                        #true length printed\n",
    "\n",
    "n=2;                                                                #new n defined\n",
    "\n",
    "print(' for n=2');                                                   # print n value\n",
    "ct=al*L*(tm-t0);                                                     # temperature correction calculated\n",
    "print('the temperature correction is',ct,'meters');                  # print temperature correction\n",
    "\n",
    "\n",
    "cp=(pm-p0)*L/(a*E);                                                 #pull correction calculated\n",
    "print('the pull corretion is ',cp,' meters');                       #print pull correction\n",
    "\n",
    "cs=-L*w*w/(24*pm*pm*n*n);                                            #sag correction calculated\n",
    "print('the sag correction is  ',cs,'meters');                        #print sag correction\n",
    "\n",
    "e=ct+cp+cs;                                                           #total correction calculated\n",
    "print('the total correction is ',e,'meters');                         # total correction printed\n",
    "\n",
    "l1=L+e;                                                               #correction in length =sum of correction and measured length \n",
    "\n",
    "truelength=(l1/L)*ml;                                                 #true length calculated\n",
    "print('the true length  is ',truelength);                             #true length printed\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Chapter-2, Section-2.4, Problem 2, Page number 56\n",
    "\n",
    "import math                                                       #Library to be used is imported\n",
    "\n",
    "cd=(15-15*math.cos(3*(math.pi/180)))/10;                         #displacement perpendicular to chain line.\n",
    "\n",
    "print('the required displacement perpendicular to char line is ',cd); #Print cd\n",
    "bc=15*(math.sin(3*(math.pi/180)))/10;                               #displacement parallel to chain line.\n",
    "print('the displacemenet parllel to the chain line is ',bc)         #print bc"
   ]
  }
 ],
 "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
}