summaryrefslogtreecommitdiff
path: root/sample_notebooks/AdityaAnand/Chapter_8.ipynb
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-08-28 16:53:23 +0530
committerThomas Stephen Lee2015-08-28 16:53:23 +0530
commit4a1f703f1c1808d390ebf80e80659fe161f69fab (patch)
tree31b43ae8895599f2d13cf19395d84164463615d9 /sample_notebooks/AdityaAnand/Chapter_8.ipynb
parent9d260e6fae7328d816a514130b691fbd0e9ef81d (diff)
downloadPython-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.gz
Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.bz2
Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.zip
add books
Diffstat (limited to 'sample_notebooks/AdityaAnand/Chapter_8.ipynb')
-rw-r--r--sample_notebooks/AdityaAnand/Chapter_8.ipynb390
1 files changed, 390 insertions, 0 deletions
diff --git a/sample_notebooks/AdityaAnand/Chapter_8.ipynb b/sample_notebooks/AdityaAnand/Chapter_8.ipynb
new file mode 100644
index 00000000..cbd1971a
--- /dev/null
+++ b/sample_notebooks/AdityaAnand/Chapter_8.ipynb
@@ -0,0 +1,390 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "###Example 8.2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) The force acting = [0.0, 2.5849394142282115e-26, 0.0] ≈ 0\n",
+ "(b) The force acting = 2 Gm²\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Importing module\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variable declaration\n",
+ "\n",
+ "G=6.67*pow(10,-11) # Gravitational constant\n",
+ "m=1 # For convenience,mass is assumed to be unity \n",
+ "x=30 # The angle between GC and the positive x-axis is 30° and so is the angle between GB and the negative x-axis\n",
+ "y=math.radians(x) # The angle in radians\n",
+ "a=math.cos(y)\n",
+ "b=math.sin(y)\n",
+ "v1=(0,1,0)\n",
+ "v2=(-a,-b,0)\n",
+ "v3=(a,-b,0)\n",
+ "c=(2*G*pow(m,2))/1 # 2Gm²/1\n",
+ "\n",
+ "# Calculation\n",
+ "\n",
+ "#(a)\n",
+ "F1=[y * c for y in v1] # F(GA)\n",
+ "F2=[y * c for y in v2] # F(GB)\n",
+ "F3=[y * c for y in v3] # F(GC)\n",
+ "# From the principle of superposition and the law of vector addition, the resultant gravitational force FR on (2m) is given by\n",
+ "Fa=[sum(x) for x in zip(F1,F2,F3)]\n",
+ "\n",
+ "#(b)\n",
+ "# By symmetry the x-component of the force cancels out and the y-component survives\n",
+ "Fb=4-2 # 4Gm² j - 2Gm² j\n",
+ "\n",
+ "# Result\n",
+ "\n",
+ "print(\"(a) The force acting =\",Fa,\"≈ 0\")\n",
+ "print(\"(b) The force acting =\",Fb,\"Gm²\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "###Example 8.3 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Potential energy of a system of four particles = -5.414213562373095 Gm²/l\n",
+ "The gravitational potential at the centre of the square = -5.65685424949238 Gm²/l\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Importing module\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variable declaration\n",
+ "\n",
+ "G=6.67*pow(10,-11) # Gravitational constant\n",
+ "m=1 # For convenience,mass is assumed to be unity \n",
+ "l=1 # For convenience,side of the square is assumed to be unity \n",
+ "c=(G*pow(m,2))/l\n",
+ "n=4 # Number of particles\n",
+ "\n",
+ "# Calculation\n",
+ "\n",
+ "d=math.sqrt(2)\n",
+ "# If the side of a square is l then the diagonal distance is √2l\n",
+ "# We have four mass pairs at distance l and two diagonal pairs at distance √2l \n",
+ "# Since the Potential Energy of a system of four particles is -4Gm²/l) - 2Gm²/dl\n",
+ "w=(-n-(2/d)) \n",
+ "# If the side of a square is l then the diagonal distance from the centre to corner is \n",
+ "# Since the Gravitational Potential at the centre of the square\n",
+ "u=-n*(2/d)\n",
+ "\n",
+ "# Result\n",
+ "\n",
+ "print (\"Potential energy of a system of four particles =\",w,\"Gm²/l\")\n",
+ "print(\"The gravitational potential at the centre of the square =\",u,\"Gm²/l\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "###Example 8.4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Minimum speed of the projectile to reach the surface of the second sphere = ( 0.6 GM/R ) ^(1/2)\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Importing module\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variable declaration\n",
+ "\n",
+ "R=1 # For convenience,radii of both the spheres is assumed to be unity \n",
+ "M=1 # For convenience,mass is assumed to be unity \n",
+ "m1=M # Mass of the first sphere\n",
+ "m2=6*M # Mass of the second sphere\n",
+ "m=1 # Since the mass of the projectile is unknown,take it as unity\n",
+ "d=6*R # Distance between the centres of both the spheres\n",
+ "r=1 # The distance from the centre of first sphere to the neutral point N\n",
+ "\n",
+ "G=6.67*pow(10,-11) # Gravitational constant\n",
+ "\n",
+ "# Calculation\n",
+ "\n",
+ "# Since N is the neutral point; GMm/r² = 4GMm/(6R-r)² and we get\n",
+ "r=2*R\n",
+ "# The mechanical energy at the surface of M is; Et = m(v^2)/2 - GMm/R - 4GMm/5R\n",
+ "# The mechanical energy at N is; En = -GMm/2R - 4GMm/4R\n",
+ "# From the principle of conservation of mechanical energy; Et = En and we get\n",
+ "v_sqr=2*((4/5)-(1/2))\n",
+ "\n",
+ "# Result\n",
+ "\n",
+ "print(\"Minimum speed of the projectile to reach the surface of the second sphere =\",\"(\",round(v_sqr,5),\"GM/R\",\")\",\"^(1/2)\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "###Example 8.5 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(i) Mass of Mars = 6.475139697520706e+23 kg\n",
+ "(ii) Period of revolution of Mars = 684.0033777694376 days\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Importing module\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variable declaration\n",
+ "\n",
+ "π=3.14 # Constant pi\n",
+ "G=6.67*pow(10,-11) # Gravitational constant\n",
+ "R=9.4*pow(10,3) # Orbital radius of Mars in km\n",
+ "T=459*60\n",
+ "Te=365 # Period of revolution of Earth\n",
+ "r=1.52 # Ratio of Rms/Res, where Rms is the mars-sun distance and Res is the earth-sun distance. \n",
+ "\n",
+ "# Calculation\n",
+ "\n",
+ "# (i) \n",
+ "R=R*pow(10,3)\n",
+ "# Using Kepler's 3rd law:T²=4π²(R^3)/GMm\n",
+ "Mm=(4*pow(π,2)*pow(R,3))/(G*pow(T,2))\n",
+ "\n",
+ "# (ii)\n",
+ "# Using Kepler's 3rd law: Tm²/Te² = (Rms^3/Res^3)\n",
+ "Tm=pow(r,(3/2))*365\n",
+ "\n",
+ "\n",
+ "# Result\n",
+ "\n",
+ "print(\"(i) Mass of Mars =\",Mm,\"kg\")\n",
+ "print(\"(ii) Period of revolution of Mars =\",Tm,\"days\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "###Example 8.6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Mass of the Earth = 5.967906881559221e+24 kg\n",
+ "Mass of the Earth = 6.017752855396305e+24 kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Importing module\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variable declaration\n",
+ "\n",
+ "g=9.81 # Acceleration due to gravity\n",
+ "G=6.67*pow(10,-11) # Gravitational constant\n",
+ "Re=6.37*pow(10,6) # Radius of Earth in m\n",
+ "R=3.84*pow(10,8) # Distance of Moon from Earth in m\n",
+ "T=27.3 # Period of revolution of Moon in days\n",
+ "π=3.14 # Constant pi\n",
+ "\n",
+ "# Calculation\n",
+ "\n",
+ "# I Method\n",
+ "# Using Newton's 2nd law of motion:g = F/m = GMe/Re²\n",
+ "Me1=(g*pow(Re,2))/G\n",
+ "\n",
+ "# II Method\n",
+ "# Using Kepler's 3rd law: T²= 4π²(R^3)/GMe\n",
+ "T1=T*24*60*60\n",
+ "Me2=(4*pow(π,2)*pow(R,3))/(G*pow(T1,2))\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print(\"Mass of the Earth =\",Me1,\"kg\")\n",
+ "print(\"Mass of the Earth =\",Me2,\"kg\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "###Example 8.7 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Period of revolution of Moon = 27.5 days\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Importing module\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variable declaration\n",
+ "\n",
+ "k=pow(10,-13) # A constant = 4π² / GME\n",
+ "Re=3.84*pow(10,5) # Distance of the Moon from the Earth in m\n",
+ "\n",
+ "# Calculation\n",
+ "\n",
+ "k=pow(10,-13)*(pow(1/(24*60*60),2))*(1/pow((1/1000),3))\n",
+ "T2=k*pow(Re,3)\n",
+ "T=math.sqrt(T2) # Period of revolution of Moon in days\n",
+ "\n",
+ "# Result\n",
+ "\n",
+ "print(\"Period of revolution of Moon =\",round(T,1),\"days\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "###Example 8.8 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Change in Kinetic Energy = 3124485000.0 J\n",
+ "Change in Potential Energy = 6248970000.0 J\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Importing module\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variable declaration\n",
+ "\n",
+ "m=400 # Mass of satellite in kg\n",
+ "Re=6.37*pow(10,6) # Radius of Earth in m\n",
+ "g=9.81 # Acceleration due to gravity\n",
+ "\n",
+ "# Calculation\n",
+ "\n",
+ "# Change in energy is E=Ef-Ei\n",
+ "ΔE=(g*m*Re)/8 # Change in Total energy\n",
+ "# Since Potential Energy is twice as the change in Total Energy (V = Vf - Vi)\n",
+ "ΔV=2*ΔE # Change in Potential Energy in J\n",
+ "\n",
+ "# Result\n",
+ "\n",
+ "print(\"Change in Kinetic Energy =\",round(ΔE,4),\"J\")\n",
+ "print(\"Change in Potential Energy =\",round(ΔV,4),\"J\")"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.4.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}