{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 1: Gravity"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 pgno:10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time period of the pendulum is  sec 1.00303620705\n"
     ]
    }
   ],
   "source": [
    "#INPUT DATA\n",
    "L=1;#Length of the bar in m\n",
    "l=0.25;#Length of the pemdulum in m\n",
    "from math import sqrt\n",
    "#CALCULATIONS\n",
    "k=sqrt((L**2)/12);#Radius of gyration m\n",
    "T=sqrt(((k**2/l)+l)/9.8)*2*3.14;#Time period of pendulum in s\n",
    "\n",
    "#OUTPUT\n",
    "print'Time period of the pendulum is  sec',T\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 pgno:11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The acceleration due to gravity is m s^-2 9.8002855276\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#INPUT DATA\n",
    "T=2.223;#Time taken for 1 oscillation in sec\n",
    "L=1.228;#Length of the pendulum in m\n",
    "\n",
    "#CALCULATIONS\n",
    "g=((4*3.14**2*L)/(T**2));#Acceleration due to gravity in m.s^-2\n",
    "\n",
    "#OUTPUT\n",
    "print'The acceleration due to gravity is m s^-2',g\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 pgno:12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The time period of pendulum is s\n",
      "Distance of another point from centre of gravity on bar with same time period is  m 1.79428571429 0.2\n"
     ]
    }
   ],
   "source": [
    "#INPUT DATA\n",
    "l=1.2;#Length of of bar in m\n",
    "from math import sqrt\n",
    "#CALCULATIONS\n",
    "k=sqrt(l**2/12);#Radius of gyration in m\n",
    "T=sqrt(((k**2/(l/2))+(l/2))/9.8)*2*3.14;#Time period of the pendulum in s\n",
    "L=((9.8*T**2)/(4*3.14**2));#Length in m\n",
    "D=L-(l/2);#Another point where pendulum has same timeperiod in m\n",
    "\n",
    "#OUTPUT\n",
    "print'The time period of pendulum is s\\nDistance of another point from centre of gravity on bar with same time period is  m',T,D\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 pgno:14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The minimum time period is obtained at cm -28.9035753267\n"
     ]
    }
   ],
   "source": [
    "\n",
    "#INPUT DATA\n",
    "L=1;#Length of pendulum in m\n",
    "B=0.05;#Width of pendulum in m\n",
    "from math import sqrt\n",
    "#CALCULATIONS\n",
    "k=sqrt((L**2+B**2)/12);#Radius of gyration in m\n",
    "D=((L/2)-k)*100;#distance of point of minimum time period from one end in cm\n",
    "\n",
    "#OUTPUT\n",
    "print'The minimum time period is obtained at cm',D\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
}