{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Ch:6 Levers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 6-1 - Page 171"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " d1 is 20.0 mm     \n",
      "\n",
      " D is 40.0 mm     \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "Del=10#\n",
    "k=500#\n",
    "W=k*Del#\n",
    "#Let load arm be l1\n",
    "l1=200#\n",
    "#Let effort arm be l2\n",
    "l2=500#\n",
    "P=W*l1/l2#\n",
    "Ro=sqrt(W**2+P**2)#\n",
    "Ta=40#\n",
    "d=sqrt(Ro*4/(2*pi*Ta))#\n",
    "d=10#\n",
    "pb=10#\n",
    "d1=sqrt(Ro/(pb*1.5))#\n",
    "d1=20#\n",
    "l=1.5*d#\n",
    "t=10#\n",
    "T=Ro*4/(2*pi*d1**2)#\n",
    "M=(Ro/2*(l/2+t/3))-(Ro/2*l/4)#\n",
    "sigb=32*M/(pi*d1**3)#\n",
    "sigmax=(sigb/2)+sqrt((sigb/2)**2+T**2)#\n",
    "P=Ro/(l*d1)#\n",
    "D=2*d1#\n",
    "print \" d1 is %0.1f mm     \"%(d1)#\n",
    "print \"\\n D is %0.1f mm     \"%(D)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 6-2 - Page 172"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " h is 50.00 mm     \n",
      "\n",
      " pmax is 74.43 MPa     \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "d1=80#\n",
    "p=0.981#\n",
    "Ta=40#\n",
    "siga=80#\n",
    "pa=15#\n",
    "W=pi*(d1**2)*p/4#\n",
    "P=W/8#\n",
    "Ws=W-P#\n",
    "d=sqrt(W*4/(pi*2*Ta))#\n",
    "l=1.5*d#\n",
    "D=2*d#\n",
    "T=W/(2*pi*pa**2/4)#\n",
    "M1=P*(700-87.5-(D/2))#\n",
    "h=50#\n",
    "b=h/4#\n",
    "Z=b*h**2/6#\n",
    "sigb=M1/Z#\n",
    "pmax=80#\n",
    "T=2465.6/h**2#\n",
    "pmax=(sigb/2)+sqrt((sigb/2)**2+T**2)#\n",
    "print \" h is %0.2f mm     \"%(h)#\n",
    "print \"\\n pmax is %0.2f MPa     \"%(pmax)#\n",
    "  \n",
    "#The difference in the value of pmax is due to rounding-off the digits."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 6-3 - Page 173"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "P is 2.0 KN     \n",
      "\n",
      "pmax is 69.53 MPa     \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "P=((4*360)+(2*360))/900#\n",
    "Fv=4-2#\n",
    "Fh=P#\n",
    "Fr=sqrt(Fv**2+Fh**2)#\n",
    "P1=4*0.36/0.9#\n",
    "Rf=sqrt(4**2+1.6**2)#\n",
    "d=sqrt(Rf*10**3/(15*1.25))#\n",
    "d=16#\n",
    "l=1.25*d#\n",
    "T=Rf*10**3*4/(2*pi*d**2)#\n",
    "D=2*d#\n",
    "M1=Rf*10**3*(360-(D/2))#\n",
    "pa=15#\n",
    "h=80#\n",
    "b=h/4#\n",
    "Z=b*h**2/6#\n",
    "sigb=M1/Z#\n",
    "T=4310/(b*h)#\n",
    "pmax=(sigb/2)+sqrt((sigb/2)**2+T**2)#\n",
    "print \"P is %0.1f KN     \"%(P)#\n",
    "print \"\\npmax is %0.2f MPa     \"%(pmax)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 6-4 - Page 174"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d is 30.0 mm     \n",
      "\n",
      "D is 30.0 mm     \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "l=360#\n",
    "P=400#\n",
    "Mh=2*P*l/3#\n",
    "sigb=50#\n",
    "l1=60#\n",
    "d=(Mh*32/(pi*l1))**(1/3)#\n",
    "d=30#\n",
    "L=420#\n",
    "siga=60#\n",
    "H=20#\n",
    "B=H/3#\n",
    "Mx=P*(L-H/2)#\n",
    "Tx=2*P*l/3#\n",
    "sigb1=Mx*18/H**3#\n",
    "Td=P/(B*H)#\n",
    "Tr=17.17*Tx/H**4#\n",
    "T=Tr+Td#\n",
    "sigmax=(sigb1/2)+sqrt((sigb1/2)**2+T**2)#\n",
    "Tmax=sqrt((sigb1/2)**2+T**2)#\n",
    "T=P*L#\n",
    "M=P*(l1+(2/3*l))#\n",
    "Te=sqrt(T**2+M**2)#\n",
    "Ta=40#\n",
    "D=(Te*16/(pi*Ta))**(1/3)#\n",
    "D=30# #Rounding off to nearest whole number\n",
    "print \"d is %0.1f mm     \"%(d)#\n",
    "print \"\\nD is %0.1f mm     \"%(D)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 6-5 - Page 175"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " d is 35.0  mm     \n",
      "\n",
      " dh is 22.0 mm     \n",
      "\n",
      " d1 is 56.0 mm     \n",
      "\n",
      " l1 is 52.5 mm     \n",
      "\n",
      " d2 is 32.0 mm     \n",
      "\n",
      " b  is 9.0  mm     \n",
      "\n",
      " t  is 6.0  mm     \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "l2=300#\n",
    "l=450#\n",
    "P=400#\n",
    "Mx=2*P*l2/3#\n",
    "siga=80#\n",
    "dh=(Mx*32/(pi*siga))**(1/3)#\n",
    "dh=22#\n",
    "L=(2*l2/3)+l#\n",
    "T=P*L#\n",
    "Ta=40#\n",
    "d=(T*16/(pi*Ta))**(1/3)#\n",
    "d=35#\n",
    "d1=1.6*d#\n",
    "Th=T*16*d1/(pi*(d1**4-d**4))#\n",
    "l1=1.5*d#\n",
    "My=P*(L-(d1/2))#\n",
    "B=dh#\n",
    "H=sqrt(3.66*75)#\n",
    "H=30#\n",
    "Mz=P*l1/2#\n",
    "Te=sqrt(T**2+Mz**2)#\n",
    "d2=(Te*16/(pi*Ta))**(1/3)#\n",
    "d2=32#\n",
    "b=d/4#\n",
    "b=9# #Rounding off to nearest whole number\n",
    "t=d/6#\n",
    "t=6# #Rounding off to nearest whole number\n",
    "print \" d is %0.1f  mm     \"%(d)#\n",
    "print \"\\n dh is %0.1f mm     \"%(dh)#\n",
    "print \"\\n d1 is %0.1f mm     \"%(d1)#\n",
    "print \"\\n l1 is %0.1f mm     \"%(l1)#\n",
    "print \"\\n d2 is %0.1f mm     \"%(d2)#\n",
    "print \"\\n b  is %0.1f  mm     \"%(b)#\n",
    "print \"\\n t  is %0.1f  mm     \"%(t)#\n",
    "  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 6-6 - Page 175"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " d is 32.0  mm     \n",
      "\n",
      " d1 is 52.0 mm     \n",
      "\n",
      " l1 is 40.0 mm     \n",
      "\n",
      " B  is 15.0 mm     \n",
      "\n",
      " H  is 45.0 mm     \n",
      "\n",
      " d2 is 38.0 mm     \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "L=450#\n",
    "P=700#\n",
    "T=P*L#\n",
    "Ta=50#\n",
    "d=(T*16/(pi*Ta))**(1/3)#\n",
    "d=32#\n",
    "d1=1.6*d#\n",
    "d1=52# #Rounding off to nearest whole number\n",
    "l1=1.25*d#\n",
    "My=P*(L-d1/2)#\n",
    "sigb=65#\n",
    "H=(My*18/sigb)**(1/3)#\n",
    "H=45#\n",
    "B=H/3#\n",
    "T1=P/(B*H)#\n",
    "sigmax=(sigb/2)+sqrt((sigb/2)**2+T**2)#\n",
    "Mx=P*l1/2#\n",
    "Te=sqrt((T)**2+(Mx**2))#\n",
    "d2=(Te*16/(pi*Ta))**(1/3)#\n",
    "d2=d2+6#\n",
    "d2=38# #Rounding off to nearest whole number\n",
    "print \" d is %0.1f  mm     \"%(d)#\n",
    "print \"\\n d1 is %0.1f mm     \"%(d1)#\n",
    "print \"\\n l1 is %0.1f mm     \"%(l1)#\n",
    "print \"\\n B  is %0.1f mm     \"%(B)#\n",
    "print \"\\n H  is %0.1f mm     \"%(H)#\n",
    "print \"\\n d2 is %0.1f mm     \"%(d2)#\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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}