summaryrefslogtreecommitdiff
path: root/Thermodynamics_by_Gaggioli_and_Obert/ch2.ipynb
blob: 30c440b6c6a8630c2c058c9618ae01abac248adb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 2 Fundamental Concepts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex:2.1 Pg:34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Potential energy = 3217.39 ft-lbm\n"
     ]
    }
   ],
   "source": [
    "#Initialization of variables\n",
    "z=100 #ft\n",
    "m=32.1739 #lbm\n",
    "#calculations\n",
    "PE=m*z\n",
    "#results\n",
    "print \"Potential energy = %.2f ft-lbm\"%(PE)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex:2.2 Pg:35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Absolute energy of this mixture = 5.40e+17 ft-lbf\n",
      "\n",
      " In case b, there is no change in mass\n",
      "\n",
      " Change in mass = -3.15e-09 lbm\n",
      "The answers are a bit different due to rounding off error in textbook.\n"
     ]
    }
   ],
   "source": [
    "#Initialization of variables\n",
    "m0=18.016 #lbm\n",
    "gc=32.1739 #lbm ft/lbf sec**2\n",
    "c=186000*5280\n",
    "dU=94.4*10**6 #ft-lbf\n",
    "#calculations\n",
    "U=m0/gc *c**2\n",
    "dm= -dU*gc/c**2\n",
    "#results\n",
    "print \"Absolute energy of this mixture = %.2e ft-lbf\"%(U)\n",
    "print \"\\n In case b, there is no change in mass\"\n",
    "print \"\\n Change in mass = %.2e lbm\"%(dm)\n",
    "print \"The answers are a bit different due to rounding off error in textbook.\""
   ]
  }
 ],
 "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
}