{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter9-Beams"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.1 page number 286"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RB= 18.8684 KN\n",
      "RA= 29.989 KN\n",
      "alpha= 25.21 °\n"
     ]
    }
   ],
   "source": [
    "from math import pi,atan,sqrt,cos,sin\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    "P1=float(10)                                     #Vertical down Load at 4m from A,KN\n",
    "P2=float(15)                                     #Inclined down Load at angle 30° at 6m from A,KN\n",
    "P3=float(20)                                     #Inclined down Load at angle 45° at 10m from A,KN\n",
    "theta2=30\n",
    "theta3=45\n",
    "#horizontal,vertical component at A  is Ha,Va respectively.\n",
    "\n",
    "Ha=P2*cos(theta2*pi/180)+P3*cos(theta3*pi/180)\n",
    "Rb=(P1*4+P2*6*sin(theta2*pi/180)+P3*10*sin(theta3*pi/180))/12         #reaction at B point,KN\n",
    "\n",
    "print \"RB=\",round(Rb,4),\"KN\"\n",
    "\n",
    "#now vertical component\n",
    "Va=P2*sin(theta2*pi/180)+P3*sin(theta3*pi/180)+P1-Rb\n",
    "\n",
    "Ra=sqrt(pow(Ha,2)+pow(Va,2))\n",
    "\n",
    "print \"RA=\",round(Ra,4),\"KN\"\n",
    "\n",
    "alpha=(atan(Va/Ha))*180/pi\n",
    "\n",
    "print \"alpha=\",round(alpha,2),\"°\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.2 page number 287"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RB= 100.4475 KN\n",
      "RA= 87.0172 KN\n",
      "alpha= 79.45 °\n"
     ]
    }
   ],
   "source": [
    "from math import pi,atan,sqrt,cos,sin\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    "P1=float(60)                                     #inclined down to right Load at angle 60 at 1m from A,KN\n",
    "P2=float(80)                                     #Inclined down to left Load at angle 75° at 3m from A,KN\n",
    "P3=float(50)                                     #Inclined down to left Load at angle 60° at 5.5m from A,KN\n",
    "theta1=60                                    \n",
    "theta2=75\n",
    "theta3=60\n",
    "thetaRb=60\n",
    "#horizontal,vertical component at A is Ha,Va  respectively.\n",
    "\n",
    "Rb=(P1*1*sin(theta1*pi/180)+P2*3*sin(theta2*pi/180)+P3*5.5*sin(theta3*pi/180))/(6*sin(thetaRb*pi/180))         #reaction at B point,KN\n",
    "Ha=-P1*cos(theta1*pi/180)+P2*cos(theta2*pi/180)-P3*cos(theta3*pi/180)+Rb*cos(thetaRb*pi/180)\n",
    "print \"RB=\",round(Rb,4),\"KN\"\n",
    "\n",
    "#now vertical component\n",
    "Va=P1*sin(theta1*pi/180)+P2*sin(theta2*pi/180)+P3*sin(theta3*pi/180)-Rb*sin(thetaRb*pi/180)\n",
    "\n",
    "Ra=sqrt(pow(Ha,2)+pow(Va,2))\n",
    "\n",
    "print \"RA=\",round(Ra,4),\"KN\"\n",
    "\n",
    "alpha=(atan(Va/Ha))*180/pi\n",
    "\n",
    "print \"alpha=\",round(alpha,2),\"°\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.3 page number 288\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RA= 91.6503 KN\n",
      "HB= 42.4264 KN\n",
      "VB= 90.7761 KN\n",
      "RB= 100.2013 KN\n",
      "alpha= 64.95 °\n"
     ]
    }
   ],
   "source": [
    "from math import pi,atan,sqrt,cos,sin\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    "P1=float(20)                                     #vertical down  Load  at 2m from A,KN\n",
    "P2=float(30)                                     #uniform distributed load from 2m to 6m from A,KN/m(in 4m of span)\n",
    "P3=float(60)                                     #Inclined down to right Load at angle 45° at 7m from A,KN\n",
    "\n",
    "theta3=45\n",
    "#horizontal,vertical component at  B is  Hb,Vb respectively.\n",
    "\n",
    "Ra=(P1*7+P2*4*5+P3*2*sin(theta3*pi/180))/(9)     #reaction at B point,KN\n",
    "\n",
    "print \"RA=\",round(Ra,4),\"KN\"\n",
    "\n",
    "Hb=P3*cos(theta3*pi/180)\n",
    "print \"HB=\",round(Hb,4),\"KN\"\n",
    "#now vertical component\n",
    "Vb=P1+P2*4+P3*sin(theta3*pi/180)-Ra\n",
    "print \"VB=\",round(Vb,4),\"KN\"\n",
    "\n",
    "Rb=sqrt(pow(Hb,2)+pow(Vb,2))\n",
    "\n",
    "print \"RB=\",round(Rb,4),\"KN\"\n",
    "\n",
    "alpha=(atan(Vb/Hb))*180/pi\n",
    "\n",
    "print \"alpha=\",round(alpha,2),\"°\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.4 page number 288"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "no horizontal force  HA=0\n",
      "VA= 74.0 KN\n",
      "MA= 148.0 KN-m\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "#Let the reactions at A be Ha, Va and Ma\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    "\n",
    "P1=float(20)                                     #vertical down  Load  at 2m from A,KN\n",
    "P2=float(12)                                     #vertical down  Load  at 3m from A,KN \n",
    "P3=float(10)                                     #vertical down  Load  at 4m from A,KN\n",
    "Pu=float(16)                                     #uniform distributed load from A to 2m from A,KN/m(in 2m of span)\n",
    "##horizontal,vertical component at  A is  Ha,Va respectively.\n",
    "print\"no horizontal force \",\"HA=0\"\n",
    "Va=Pu*2+P1+P2+P3\n",
    "print \"VA=\", round(Va,2),\"KN\"\n",
    "Ma=Pu*2*1+P1*2+P2*3+P3*4\n",
    "print \"MA=\", round(Ma,2),\"KN-m\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.5 page number 288\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "no horizontal force  HA=0\n",
      "VA= 65.0 KN\n",
      "MA= 165.0 KN-m\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "#Let the reactions at A be  Va and Ma\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    "\n",
    "P1=float(15)                                     #vertical down  Load  at 3m from A,KN\n",
    "P2=float(10)                                     #vertical down  Load  at 5m from A,KN \n",
    "M=float(30)                                      #CW moment at 4m distance from A, KN-m\n",
    "Pu=float(20)                                     #uniform distributed load from A to 2m from A,KN/m(in 2m of span)\n",
    "##horizontal,vertical component at  A is  Ha,Va respectively.\n",
    "print\"no horizontal force \",\"HA=0\"\n",
    "Va=Pu*2+P1+P2\n",
    "print \"VA=\", round(Va,2),\"KN\"\n",
    "Ma=Pu*2*1+P1*3+P2*5+M\n",
    "print \"MA=\", round(Ma,2),\"KN-m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.6 page number 289"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RB= 100.0 KN\n",
      "RA= 30.0 KN\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "#As supports A and B are simple supports and loading is only in vertical direction, the reactions RA and RB are in vertical directions only.\n",
    "\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    "\n",
    "P1=float(30)                                     #vertical down  Load  at 1m from A,KN\n",
    "P2=float(40)                                     #vertical down  Load  at 6.5m from A,KN                   \n",
    "Pu=float(20)                                     #uniform distributed load from 2m to 5m from A,KN/m(in 3m of span).\n",
    "\n",
    "Rb=(Pu*3*3.5+P1*1+P2*6.5)/5\n",
    "print \"RB=\", round(Rb,2),\"KN\"\n",
    "Ra=Pu*3+P1+P2-Rb\n",
    "print \"RA=\", round(Ra,2),\"KN\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.7 page number 289\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "no horizontal force  HA=0\n",
      "VB= 50.0 KN\n",
      "VA= 70.0 KN\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "#Let the reactions at A be  Va and Ma.\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    "\n",
    "P1=float(60)                                     #vertical down  Load  at 4m from A to right,KN\n",
    "P2=float(20)                                     #vertical down  Load  at 11m from A to right,KN \n",
    "M=float(30)                                      #CW moment at 7m distance from A to right, KN-m\n",
    "Pu=float(20)                                     #uniform distributed load from A to 2m from A to left ,KN/m(in 2m of span)\n",
    "##horizontal,vertical component at  A is  Ha,Va respectively.\n",
    "print\"no horizontal force \",\"HA=0\"\n",
    "Vb=(-Pu*2*1+P1*4+P2*11+M)/9\n",
    "print \"VB=\", round(Vb,2),\"KN\"\n",
    "Va=Pu*2+P1+P2-Vb\n",
    "print \"VA=\", round(Va,2),\"KN\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.8 page number 290\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RB= 71.011 KN\n",
      "(Negative sign show that the assumed direction of VA is wrong. In other words, VA is acting vertically downwards). \n",
      "RA= 23.3666 KN\n",
      "alpha= 24.79 °\n"
     ]
    }
   ],
   "source": [
    "from math import pi,atan,sqrt,cos,sin\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    " \n",
    "P1=float(30)                                     #Inclined down Load at angle 45° to left at 5m from A,KN\n",
    "Pu=float(20)                                     #uniformly distributed load from 6m to 8m from A ,KN,(2m of span)\n",
    "theta1=45\n",
    "M=40                                             #ACW moment at 3m from A, KN-m\n",
    "#horizontal,vertical component at A  is Ha,Va respectively.\n",
    "\n",
    "Rb=(M+P1*5*sin(theta1*pi/180)+Pu*2*7)/6         #reaction at B point,KN\n",
    "\n",
    "print \"RB=\",round(Rb,4),\"KN\"\n",
    "\n",
    "Ha=P1*cos(theta1*pi/180)\n",
    "\n",
    "#now vertical component\n",
    "Va=P1*sin(theta1*pi/180)-Rb+Pu*2\n",
    "\n",
    "Ra=sqrt(pow(Ha,2)+pow(Va,2))\n",
    "\n",
    "print \"(Negative sign show that the assumed direction of VA is wrong. In other words, VA is acting vertically downwards). \"\n",
    "\n",
    "Va1=-1*Va\n",
    "print \"RA=\",round(Ra,4),\"KN\"\n",
    "\n",
    "alpha=(atan(Va1/Ha))*180/pi\n",
    "\n",
    "print \"alpha=\",round(alpha,2),\"°\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 9.9 page number 290\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X= 5.0 m\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "#summation of all  horizontal forces is zero & vertical forces is zero.\n",
    " \n",
    "#Let the left support C be at a distance x metres from A. \n",
    "\n",
    "P1=float(30)                        #vertical down load at A,KN\n",
    "Pu=float(6)                         #uniform distributed load over whole span,KN/m,(20m of span)\n",
    "P2=float(50)                        #vertical down load at B, KN\n",
    "\n",
    "#Rc=Rd(given) reaction at C & D is equal.\n",
    "\n",
    "Rc=(P1+P2+Pu*20)/2\n",
    "Rd=Rc\n",
    "\n",
    "#taking moment at A \n",
    "x=(((Pu*20*10+P2*20)/100)-12)/2\n",
    "\n",
    "print \"X=\", round(x,2),\"m\"\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "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.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}