{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 1 - Introduction and basic concepts" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.1 Page: 4" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.1 - Page: 4\n", "\n", "\n", "Weight of the man on the moon is 260.43 N\n", "\n" ] } ], "source": [ "from __future__ import division\n", "# Soltion\n", "\n", "print \"Example: 1.1 - Page: 4\\n\\n\"\n", "\n", "#*****Data*****#\n", "g_Earth = 9.83 # [m/square s]\n", "F_Earth = 800 # [N]\n", "g_Moon = 3.2 # [m/square s]\n", "#************#\n", "\n", "# From the expression of force, the force on the man on the Eath's surface is given by:\n", "# F = m*g_Earth\n", "m = F_Earth/g_Earth # [kg]\n", "\n", "# On the moon, the weight of the mass is equal to the force acting on the mass on the moon and is given by\n", "F_Moon = m*g_Moon # [N]\n", "\n", "print \"Weight of the man on the moon is %0.2f N\\n\"%(F_Moon)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.2 Page: 5" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.2 - Page: 5\n", "\n", "\n", "Gravitational force on the body is 16.68 N\n", "\n" ] } ], "source": [ "# Solution\n", "\n", "print \"Example: 1.2 - Page: 5\\n\\n\"\n", "\n", "#*****Data*****#\n", "m1 = 1.5 # [mass of the body, kg]\n", "m2 = 6*10**(24) # [mass of the Earth, kg]\n", "G = 6.672*10**(-11) # [N.square m/square.kg]\n", "r = 6000*10**(3) # [m]\n", "#************#\n", "\n", "# According to Newton's universal law of gravity:\n", "F = G*m1*m2/r**2 # [N]\n", "print \"Gravitational force on the body is %.2f N\\n\"%(F)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.3 Page: 5" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.3 - Page: 5\n", "\n", "\n", "Mass of 1 kg will weigh 6.92 kg on moon\n", "\n" ] } ], "source": [ "# Solution\n", "\n", "print \"Example: 1.3 - Page: 5\\n\\n\"\n", "\n", "#*****Data*****#\n", "r_Moon = 0.3 # [km]\n", "r_Earth = 1 # [km]\n", "m2 = 1 # [mass of body, kg]\n", "mMoon_By_mEarth = 0.013 # [kg/kg]\n", "#***************#\n", "\n", "# According to the Newton's universal law of gravitation:\n", "Fe_By_Fm = (1/mMoon_By_mEarth)*(r_Moon/r_Earth)**2#\n", "print \"Mass of 1 kg will weigh %.2f kg on moon\\n\"%(Fe_By_Fm)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.4 Page: 6" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.4 - Page: 6\n", "\n", "\n", "The absolute pressure is 54.914 kPa\n", "\n" ] } ], "source": [ "# Solution\n", "\n", "print \"Example: 1.4 - Page: 6\\n\\n\"\n", "\n", "#*****Data*****#\n", "h = 40 # [cm]\n", "density = 14.02 # [g/cubic cm]\n", "g = 9.792 # [m/square s]\n", "#*************#\n", "\n", "P = h*density*g/1000 # [N/square cm]\n", "P = P*10 # [kPa]\n", "\n", "print \"The absolute pressure is %.3f kPa\\n\"%(P)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.5 Page: 7" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.5 - Page: 7\n", "\n", "\n", "The absolute pressure within the container is 119.299 kPa\n", "\n" ] } ], "source": [ "# Solution\n", "\n", "print \"Example: 1.5 - Page: 7\\n\\n\"\n", "\n", "#*****Data*****#\n", "Patm = 112 # [kPa]\n", "density = 1200 # [kg/cubic m]\n", "g = 9.81 # [m/sqaure s]\n", "h = 0.62 # [m]\n", "#**************#\n", "\n", "P = Patm + (density*g*h/1000) # [kPa]\n", "\n", "print \"The absolute pressure within the container is %.3f kPa\\n\"%(P)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.6 Page: 9" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.6 - Page: 9\n", "\n", "\n", "Work done by the system is 1500 J\n", "\n" ] } ], "source": [ "# Solution\n", "\n", "print \"Example: 1.6 - Page: 9\\n\\n\"\n", "\n", "#*****Data*****#\n", "F = 150 # [N]\n", "Displacement = 10 # [m]\n", "#**************#\n", "\n", "W = F*Displacement # [J]\n", "\n", "print \"Work done by the system is %d J\\n\"%(W)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.7 Page: 9" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.7 - Page: 9\n", "\n", "\n", "Actual Work done by the system is 9.1e+05 J\n", "\n" ] } ], "source": [ "# Solution\n", "\n", "print \"Example: 1.7 - Page: 9\\n\\n\"\n", "\n", "#*****Data*****#\n", "P = 560*10**3 # [Pa]\n", "Vinit = 3 # [cubic m]\n", "Vfinal = 5 # [cubic m]\n", "Wext = 210*10**3 # [J]\n", "#*************#\n", "\n", "W = P*(Vfinal - Vinit) # [J]\n", "# Again the system receives 210 kJ of work from the external agent.\n", "W = W - Wext # [J]\n", "\n", "print \"Actual Work done by the system is %.1e J\\n\"%(W)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.8 Page: 11" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.8 - Page: 11\n", "\n", "\n", "Change in potential Energy is 981 J\n", "\n" ] } ], "source": [ "# Solution\n", "\n", "print \"Example: 1.8 - Page: 11\\n\\n\"\n", "\n", "#*****Data*****#\n", "g = 9.81 # [m/square s]\n", "Z = 100 # [m]\n", "#***************#\n", "\n", "# Basis: 1 kg of water\n", "m = 1 # [kg]\n", "Ep = m*g*Z # [J]\n", "print \"Change in potential Energy is %d J\\n\"%(Ep)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.9 Page: 11" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.9 - Page: 11\n", "\n", "\n", "The velocity of the metal block is 15.34 m/s\n", "\n", "The final Kinetic Energy is 1765.8 J\n", "\n" ] } ], "source": [ "from __future__ import division\n", "# Solution\n", "\n", "print \"Example: 1.9 - Page: 11\\n\\n\"\n", "\n", "#*****Data*****#\n", "m = 15# # [kg]\n", "g = 9.81 # [m/square s]\n", "V1 = 0 # [m/square s]\n", "Z1 = 12 # [m]\n", "Z2 = 0 # [m]\n", "#***************#\n", "\n", "# At initial condition, V1 = 0, so kinetic energy is zero.\n", "# At final condition, Z2 = 0, so potential energy is zero.\n", "# Ep1 + Ek1 = Ep2 + Ek2\n", "#deff('[y] = f(V2)','y = ((1/2)*m*V1**2) + (m*g*Z1) - (((1/2)*m*V2**2) + (m*g*Z2))')#\n", "def f(V2):\n", " y = ((1/2)*m*V1**2) + (m*g*Z1) - (((1/2)*m*V2**2) + (m*g*Z2))\n", " return y\n", "from scipy.optimize import fsolve\n", "V2 = fsolve(f,7)#\n", "\n", "print \"The velocity of the metal block is %.2f m/s\\n\"%(V2)#\n", "\n", "Ek2 = (1/2)*m*V2**2 # [J]\n", "print \"The final Kinetic Energy is %.1f J\\n\"%(Ek2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.10 Page: 12" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.10 - Page: 12\n", "\n", "\n", "Power required is 7.64 kW\n", "\n" ] } ], "source": [ "# Solution\n", "\n", "print \"Example: 1.10 - Page: 12\\n\\n\"\n", "\n", "#*****Data*****#\n", "m = 1200 # [kg]\n", "v1 = 10 # [km/h]\n", "v2 = 100 # [km/h]\n", "time = 1 # [min]\n", "#***************#\n", "\n", "v1 = 10*1000/3600 # [m/s]\n", "v2 = 100*1000/3600 # [m/s]\n", "W = (1/2)*m*(v2**2 - v1**2) # [J]\n", "time = time*60 # [s]\n", "P = W/time # [W]\n", "print \"Power required is %.2f kW\\n\"%(P/1000)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.11 Page: 13" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.11 - Page: 13\n", "\n", "\n", "Total Force eacting upon the gas is 8139.7 N\n", "\n", "Pressure exerted is 115.153 kPa\n", "\n", "\n", "Work due to expansion by the gas is 4.070 kJ\n", "\n", "\n", "Change in Potential Energy is 489.6 J\n", "\n" ] } ], "source": [ "from math import pi\n", "print \"Example: 1.11 - Page: 13\\n\\n\"\n", "\n", "#*****Data*****#\n", "dia = 0.3 # [m]\n", "m = 100 # [kg]\n", "P_atm = 1.013*10**5 # [N/square m]\n", "g = 9.792 # [m/square s]\n", "#**************#\n", "\n", "Area = (pi/4)*dia**2 # [square m]\n", "#Solution (a)(i)\n", "# Force exerted by the atmosphere:\n", "F_atm = P_atm*Area # [N]\n", "# Force exerted by piston & metal block:\n", "F_mass = m*g # [N]\n", "# Total force acting upon the gas:\n", "F = F_atm + F_mass # [N]\n", "print \"Total Force eacting upon the gas is %.1f N\\n\"%(F)#\n", "\n", "# Solution (a)(ii)\n", "Pressure = F/Area # [N/square m]\n", "print \"Pressure exerted is %.3f kPa\\n\\n\"%(Pressure/1000)#\n", "\n", "# Solution (b)\n", "# The gas expands on application of heat, the volume of the gas goes on increasing and the piston moves upward.\n", "Z = 0.5 # [m]\n", "# Work done due to expansion of gas:\n", "W = F*Z # [J]\n", "print \"Work due to expansion by the gas is %.3f kJ\\n\\n\"%(W/1000)#\n", "\n", "# Solution (c)\n", "# Change in potential energy of piston and weight after expansion process:\n", "Ep = m*g*Z # [J]\n", "print \"Change in Potential Energy is %.1f J\\n\"%(Ep)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.12 Page: 24" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.12 - Page: 24\n", "\n", "\n", "The temperature which has the same value on both the centigrade and Fahrenheit scales is -40 degree Celsius or -40 degree Fahrenheit\n", "\n" ] } ], "source": [ "print \"Example: 1.12 - Page: 24\\n\\n\"\n", "\n", "# Solution\n", "\n", "# The relation is:\n", "# (C/5) = ((F - 32)/9)\n", "# For C = F\n", "C = - (32*5/4)# # [degree Celsius]\n", "print \"The temperature which has the same value on both the centigrade and Fahrenheit scales is %d degree Celsius or %d degree Fahrenheit\\n\"%(C,C)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 1.13 Page: 24" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 1.13 - Page: 24\n", "\n", "\n", "The rise in temperature in the Kelvin scale is 30 K\n", "\n", "The rise in temperature in the Rankine scale is 54 R\n", "\n", "The rise in temperature in the Fahrenheit scale is 54 OF\n", "\n" ] } ], "source": [ "print \"Example: 1.13 - Page: 24\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****#\n", "delta_T_C = 30 # [OC]\n", "#*************#\n", "\n", "# The relation between the Kelvin temperature scale and the Celsius temperature scale:\n", "# T(K) = T(OC) + 273.15\n", "# Here, the temperature rise is to be expressed in terms of K, but the difference in temperature will be the same in the Kelvin and Celsius scales of temperature:\n", "delta_T_K = delta_T_C # [K]\n", "print \"The rise in temperature in the Kelvin scale is %d K\\n\"%(delta_T_K)#\n", "# The emperical relationship between the Rankine and Kelvin scales is given by:\n", "delta_T_R = 1.8*delta_T_K # [R]\n", "print \"The rise in temperature in the Rankine scale is %d R\\n\"%(delta_T_R)#\n", "delta_T_F = delta_T_R # [OF]\n", "print \"The rise in temperature in the Fahrenheit scale is %d OF\\n\"%(delta_T_F)#" ] } ], "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 }