{
 "metadata": {
  "name": "",
  "signature": "sha256:a49d3045051d18d945c16a76ba66d562e97f6c140e0b1e26e143c1e463c579f5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 : Simple Mechanisms"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.1 Page No : 110"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "AC = 300.\n",
      "CB1 = 120. \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 5.28\n",
      "#Calculating the sine of inclination of the slotted bar with the vertical\n",
      "sineCAB1 = CB1/AC\n",
      "#Calculating the inclination of the slotted bar with the vertical\n",
      "angleCAB1 = math.sin(sineCAB1)*180/math.pi \t\t\t#degrees\n",
      "#Calculating the angle alpha\n",
      "alpha = 2*(90-angleCAB1) \t\t\t#degrees\n",
      "#Calculating the ratio of time of cutting stroke to time of return stroke\n",
      "r = (360-alpha)/alpha \t\t\t#Ratio of time of cutting stroke to time of return stroke\n",
      "\n",
      "#Results:\n",
      "print \" The ratio of the time of cutting stroke to the time of return stroke is %.1f\"%(r)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The ratio of the time of cutting stroke to the time of return stroke is 1.7\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2 Page No : 110"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "AC = 240.\n",
      "CB1 = 120.\n",
      "AP1 = 450. \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 5.29\n",
      "#Calculating the math.sine of inclination of the slotted bar with the vertical\n",
      "sineCAB1 = CB1/AC\n",
      "#Calculating the inclination of the slotted bar with the vertical\n",
      "angleCAB1 = math.sin(sineCAB1)*180/math.pi \t\t\t#degrees\n",
      "#Calculating the angle alpha\n",
      "alpha = 2*(90-angleCAB1) \t\t\t#degrees\n",
      "#Calculating the time ratio of cutting stroke to the return stroke\n",
      "r = (360-alpha)/alpha \t\t\t#Time ratio of cutting stroke to the return stroke\n",
      "#Calculating the length of the stroke\n",
      "R1R2 = 2*AP1*round(math.sin(math.pi/2-alpha/2*math.pi/180),1) \t\t\t#mm\n",
      "\n",
      "#Results:\n",
      "print \" The time ratio of cutting stroke to the return stroke is %.f.\"%(r)\n",
      "print \" The length of the stroke R1R2  =  P1P2  =  %d mm.\"%(R1R2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The time ratio of cutting stroke to the return stroke is 2.\n",
        " The length of the stroke R1R2  =  P1P2  =  450 mm.\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3 Page No : 112"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "#Refer Fig. 5.30 and Fig. 5.31\n",
      "BC = 30.\n",
      "R1R2 = 120. \t\t\t#mm\n",
      "r = 1.7 \t\t\t#Time ratio of working stroke to the return stroke\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angle alpha\n",
      "alpha = 360/(1.7+1) \t\t\t#degrees\n",
      "#Calculating the length of the link AC\n",
      "B1C = BC\n",
      "AC = B1C/math.cos(math.radians(alpha/2)) \t\t\t#mm\n",
      "#Calculating the length of the link AP\n",
      "AP1 = R1R2/(2*math.cos(math.radians(alpha/2))) \t\t\t#mm\n",
      "AP = AP1\n",
      "\n",
      "#Results:\n",
      "print \" The length of AC  =  %.1f mm.\"%(AC)\n",
      "print \" The length of AP  =  %.2f mm.\"%(AP)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The length of AC  =  75.7 mm.\n",
        " The length of AP  =  151.48 mm.\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.4 Page No : 112"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "CD = 50.  #mm\n",
      "CA = 75.  #mm\n",
      "PA = 150. #mm\n",
      "PR = 135. #mm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 5.32 and Fig. 5.33\n",
      "#Calculating the cosine of angle beta\n",
      "CA2 = CA\n",
      "cosbeta = CD/CA2\n",
      "#Calculating the angle beta\n",
      "beta = 2*math.degrees(math.acos(cosbeta)) \t\t\t#degrees\n",
      "#Calculating the ratio of time of cutting stroke to time of return stroke\n",
      "r = (360-beta)/beta            \t\t\t#Ratio of time of cutting stroke to time of return stroke\n",
      "#Calculating the length of effective stroke\n",
      "R1R2 = 87.5 \t\t\t#mm\n",
      "\n",
      "#Results:\n",
      "print \" The ratio of time of cutting stroke to time of return stroke is %.3f.\"%(r)\n",
      "print \" The length of effective stroke R1R2  =  %.1f mm.\"%(R1R2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The ratio of time of cutting stroke to time of return stroke is 2.735.\n",
        " The length of effective stroke R1R2  =  87.5 mm.\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}