summaryrefslogtreecommitdiff
path: root/Principles_of_Physics_by_F.J.Bueche/Chapter1_1.ipynb
blob: 7ecae4442feed19e15ec116fdbfbc5873282d8ff (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 01: Vectors and their use"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex1.1:pg-25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Resultant R= 40.31  cm\n",
      "\n",
      "Theta= 120.0  degrees\n"
     ]
    }
   ],
   "source": [
    "  #Example 1_1\n",
    "import math  \n",
    "  #To add the given Displacements Graphically\n",
    "d1=25     #units in cm\n",
    "d2=10     #units in cm\n",
    "d3=30     #units in cm\n",
    "R=math.sqrt(d1**2+d2**2+d3**2)    #units in cm\n",
    "theta1=30     #units in degrees\n",
    "theta2=90    #units in degrees\n",
    "theta3=120    #units in degrees\n",
    "theta=360-(theta1+theta2+theta3)    #units in degrees\n",
    "print \"The Resultant R=\",round(R,2),\" cm\\n\"\n",
    "print \"Theta=\",round(theta),\" degrees\"\n",
    "  #In text book the answer is printed wrong as R=49cm and theta=82 degrees but the correct answer is R=40.31cm and theta=120 degrees\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex1.2:pg-25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Resultant R= 6.72  Meters\n",
      "\n",
      "The Angle theta= 170.0  degrees\n"
     ]
    }
   ],
   "source": [
    "  #Example 1_2\n",
    "\n",
    "import math\n",
    "  \n",
    "  # To add the given vector displacements\n",
    "a=1    #units in meters\n",
    "b=3    #units in meters\n",
    "c=5    #units in meters\n",
    "d=6    #units in meters\n",
    "theta1=90    #units in degrees\n",
    "Rx_a=a*math.sin(theta1*math.pi/180)     #units in meters\n",
    "Rx_b=round(b*math.cos(theta1*math.pi/180))   #units in meters\n",
    "theta2=37     #units in degrees\n",
    "Rx_c=-round(c*math.cos(theta2*math.pi/180))       #units in meters\n",
    "theta3=53    #units in degrees\n",
    "Rx_d=-d*math.cos(theta3*math.pi/180)\n",
    "Ry_a=round(a*math.cos(theta1*math.pi/180))     #units in meters\n",
    "Ry_b=round(c*math.sin(theta2*math.pi/180))   #units in meters\n",
    "Ry_c=round(c*math.sin(theta2*math.pi/180))   #units in meters\n",
    "Ry_d=-(d*math.sin(theta3*math.pi/180))   #units in meters\n",
    "Rx=Rx_a+Rx_b+Rx_c+Rx_d       #units in meters\n",
    "Ry=Ry_a+Ry_b+Ry_c+Ry_d       #units in meters\n",
    "R=sqrt(Rx**2+Ry**2)    #units in meters\n",
    "phi=round(math.atan(Ry/-(Rx))*180/math.pi)      #units in degrees\n",
    "phi=180-phi     #units in degrees\n",
    "print \"The Resultant R=\",round(R,2),\" Meters\\n\"\n",
    "print \"The Angle theta=\",round(phi),\" degrees\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex1.3:pg-26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resultant R= 15.5  Meters\n",
      "\n",
      "Angle Theta= 19.0  Degrees\n"
     ]
    }
   ],
   "source": [
    "  #Example 1_3\n",
    "\n",
    "import math\n",
    "  #To subtract vector B from Vector A\n",
    "Ax=8.7    #units in meters\n",
    "Ay=5     #units in meters\n",
    "Bx=-6     #units in meters\n",
    "By=0     #units in meters\n",
    "Rx=Ax-Bx       #units in meters\n",
    "Ry=Ay-By        #units in meters\n",
    "R=sqrt(Rx**2+Ry**2)      #units in meters\n",
    "theta=round(math.atan(Ry/(Rx))*180/math.pi)      #units in degrees\n",
    "print \"Resultant R=\",round(R,1),\" Meters\\n\"\n",
    "print \"Angle Theta=\",round(theta),\" Degrees\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex1.4:pg-30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Volume V= 5.65e-10 Meter**3\n"
     ]
    }
   ],
   "source": [
    "  #Example 1_4\n",
    "import math\n",
    "\n",
    "  #To calculate the Volume\n",
    "r=3*10**-5    #units in meters\n",
    "L=0.20    #units in meters\n",
    "V=math.pi*r**2*L    #Units in meter**3\n",
    "print \"Volume V=\",round(V,12),\"Meter**3\"\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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}