{ "metadata": { "name": "", "signature": "sha256:1c6a10e6b876d2730bb167805af2fccb3104db62a9988f5aa3ef9c4c86e9b481" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 2: Zeroth Law of Thermodynamics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1, page no. 46" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "#Variable Declaration: \n", "Tf = 98.6 #Temperature of human body in degree Fahrenheit:\n", "\n", "#Calculation:\n", "Tc = (Tf-32)/1.8 #Temperature of the body in degree Celcius:\n", "\n", "#Results:\n", "print \"Temperature of the human body \",Tc,\"\u00b0C\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Temperature of the human body 37.0 \u00b0C\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2, page no. 47" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "import math as m\n", "import numpy as n\n", "\n", "#Variable Declaration: \n", "p0 = 3.0 #Thermodynamic property at T = 0:\n", "p100 = 8.0 #Thermodynamic property at T = 100:\n", "p = 6.5 #Thermodynamic property at which t is to be found\n", "\n", "#Calculation:\n", "#Solving two linear equation by linear Algebra using matrices AX = B\n", "A = n.matrix([[m.log(p0),0.5],[m.log(p100),0.5]])\n", "B = n.matrix([[0],[100]])\n", "X = n.matrix.getI(A)*B\n", "a = round(X[0],2) #Thermodynamic constant a from matrix solution\n", "b = round(X[1]) #Thermodynamic constant b from matrix solution\n", "t = a*m.log(p)-b/2 #At thermodynamic property p = 6.5:\n", "\n", "#Results:\n", "print \"Temperature at the value of thermodynamic property (p = 6.5)\" ,round(t,2),\"\u00b0C\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Temperature at the value of thermodynamic property (p = 6.5) 302.83 \u00b0C\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3, page no. 47" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "#Variable Declaration:\n", "T0 = 0 #Ice point (\u00b0C)\n", "T100 = 100 #Steam Poiont (\u00b0C)\n", "def E(t): #Function definition for above expression of EMF\n", " return 0.003*t - 5*10**-7*t**2 + 0.5 *10**-3\n", "\n", "#Calculation:\n", "t = (E(30)-E(0))/(E(100)-E(0))*(T100-T0) #Temperature shown by the thermometer at T = 30:\n", "\n", "#Results:\n", "print \"!--Please check that there are calculation mistake done in the book \\nhence there is heavy difference in answer of book and the code--!\\n\"\n", "print \"The temperature shown by thermometer: \",round(t,2),\"\u00b0C\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "!--Please check that there are calculation mistake done in the book \n", "hence there is heavy difference in answer of book and the code--!\n", "\n", "The temperature shown by thermometer: 30.36 \u00b0C\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4, page no. 48" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "#Variable Declaration: \n", "t1 = 50 #Temperature of gas using gas thermometer:\n", "def E(t): #Function Definition as per question:\n", " return 0.18*t - 5.2*10**-4*t**2\n", " \n", "#Calculation:\n", "t = (100-0)*E(t1)/(E(100)-E(0))\t#Temperature at EMF = E50:\n", "p = (t-t1)/t1*100\n", "\n", "#Results:\n", "print \"Percentage variation: \",round(p,2),\"%\"\n", " " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Percentage variation: 20.31 %\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5, page no. 48" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "import numpy as n\n", "\n", "#Variable Declaration: \n", "#Solving the conversion relation X = aC + b using matrices and finding a and b\n", "B = n.matrix([[0],[1000]])\n", "A = n.matrix([[0,1],[100,1]])\n", "\n", "#Calculations:\n", "X = n.matrix.getI(A)*B\n", "a = round(X[0]) #Value of a of equation X = aC + B\n", "b = round(X[1]) #Value of b of equation X = aC + B\n", "X = a*-273.15+b #Absolute temperature in new temperature scale:\n", "\n", "#Results:\n", "print \"Absolute temperature in new scale: \",X,\"\u00b0X\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Absolute temperature in new scale: -2731.5 \u00b0X\n" ] } ], "prompt_number": 5 } ], "metadata": {} } ] }