{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 23: Clocks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.1, Page number 23.4" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "required time is 16.36 minutes past 3\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "H=3; #initial position of hour hand\n", "A=0; #required angle(degrees)\n", "\n", "#Calculation\n", "T=(2/11)*((H*30)+A); #required time(minutes)\n", "\n", "#Result\n", "print \"required time is\",round(T,2),\"minutes past\",H" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.2, Page number 23.4" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "one timing is 38.18 minutes past 4\n", "another timing is 5.45 minutes past 4\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "H=4; #initial position of hour hand\n", "A=90; #required angle(degrees)\n", "\n", "#Calculation\n", "T1=(2/11)*((H*30)+A); #required time(minutes)\n", "T2=(2/11)*((H*30)-A); #required time(minutes)\n", "\n", "#Result\n", "print \"one timing is\",round(T1,2),\"minutes past\",H\n", "print \"another timing is\",round(T2,2),\"minutes past\",H" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.3, Page number 23.5" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "one timing is 54.545 minutes past 7\n", "another timing is 21.818 minutes past 7\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "H=7; #initial position of hour hand\n", "A=90; #required angle(degrees)\n", "\n", "#Calculation\n", "T1=(2/11)*((H*30)+A); #required time(minutes)\n", "T2=(2/11)*((H*30)-A); #required time(minutes)\n", "\n", "#Result\n", "print \"one timing is\",round(T1,3),\"minutes past\",H\n", "print \"another timing is\",round(T2,3),\"minutes past\",H" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.4, Page number 23.5" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "required time is 5.45 minutes past 7\n", "answer given in the book is wrong\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "H=7; #initial position of hour hand\n", "A=180; #required angle(degrees)\n", "\n", "#Calculation\n", "T=(2/11)*((H*30)-A); #required time(minutes)\n", "\n", "#Result\n", "print \"required time is\",round(T,2),\"minutes past\",H\n", "print \"answer given in the book is wrong\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.5, Page number 23.5" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "one timing is 34.909 minutes past 5\n", "another timing is 19.636 minutes past 5\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "H=5; #initial position of hour hand\n", "A=42; #required angle(degrees)\n", "\n", "#Calculation\n", "T1=(2/11)*((H*30)+A); #required time(minutes)\n", "T2=(2/11)*((H*30)-A); #required time(minutes)\n", "\n", "#Result\n", "print \"one timing is\",round(T1,3),\"minutes past\",H\n", "print \"another timing is\",round(T2,3),\"minutes past\",H" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.6, Page number 23.5" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "true time is 55.08 minutes past 5 p.m\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "Ti=6-1; #time interval(hours)\n", "h=1/60; #hour gained(hour)\n", "\n", "\n", "#Calculation\n", "Tti=Ti/(1+h); #true time interval(hours)\n", "Tt=1+Tti; #true time(hours)\n", "H=int(Tt); #hour hand(p.m)\n", "m=(Tt-H)*60; #true time(minutes)\n", "\n", "#Result\n", "print \"true time is\",round(m,2),\"minutes past\",H,\"p.m\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.7, Page number 23.6" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "required time is 27.27 minutes past 2 and at 3 o' clock\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "H=2; #initial position of hour hand\n", "A=90; #required angle(degrees)\n", "\n", "#Calculation\n", "T1=(2/11)*((H*30)+A); #required time(minutes)\n", "T2=(2/11)*((H*30)-A); #required time(minutes)\n", "\n", "#Result\n", "print \"required time is\",round(T1,2),\"minutes past\",H,\"and at\",H+1,\"o' clock\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.8, Page number 23.6" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "total time gained is 5.035 minutes\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "T=12; #time(hours)\n", "x=65; #time(minutes)\n", "y=65+(5/11); #time interval(minutes)\n", "\n", "#Calculation\n", "Ttg=(T*60)*(y-x)/x; #total time gained(minutes)\n", "\n", "#Result\n", "print \"total time gained is\",round(Ttg,3),\"minutes\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 23.9, Page number 23.6" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "required time is 16.36 minutes and 49.09 minutes past 12\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "H=0; #initial position of hour hand\n", "A=90; #required angle(degrees)\n", "\n", "#Calculation\n", "T1=(2/11)*((H*30)+A); #required time(minutes)\n", "T2=(2/11)*(360+(H*30)-A); #required time(minutes)\n", "\n", "#Result\n", "print \"required time is\",round(T1,2),\"minutes and\",round(T2,2),\"minutes past 12\"" ] } ], "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 }