{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 38: Relativity"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 38.1: Sample_Problem_1.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Given that\n",
"r = 0.9990\n",
"t = 10  //in years\n",
"\n",
"//Sample Problem 38-1\n",
"printf('**Sample Problem 38-1**\n')\n",
"y = 1/sqrt(1-r^2)\n",
"tEarth = t*y\n",
"T = 2*tEarth\n",
"printf('The time as measured from the earth is %1.2fy', T)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 38.2: Sample_Problem_2.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Given that\n",
"Tl = 0.1237*10^-6  //in sec\n",
"c = 3*10^8  //in m/s\n",
"r = 0.990\n",
"\n",
"//Sample Problem 38-2\n",
"printf('**Sample Problem 38-2**\n')\n",
"y = 1/sqrt(1-r^2)\n",
"Tb = Tl*y  //in laboratory frame\n",
"v = r*c\n",
"d = v*Tb\n",
"printf('The kaon can go till %dm', d)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 38.3: Sample_Problem_3.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Given that\n",
"Lp = 230  ///in meter\n",
"t = 3.57*10^-6  //in meter\n",
"c = 3*10^8  //in m/s\n",
"\n",
"//Sample Problem 38-3\n",
"printf('**Sample Problem 38-3**\n')\n",
"//y = 1/sqrt(1-r^2)\n",
"//L = Lp/y\n",
"//L = r*c*t\n",
"//solving -\n",
"r = Lp/sqrt((c*t)^2 + Lp^2)\n",
"printf('The relative velocoty is equal to %.3fc m/s', r)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 38.4: Sample_Problem_4.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Given that\n",
"deltaT = 1.10  //in sec\n",
"x = 4.00*10^8  //in meter\n",
"c = 3*10^8 //in m/s\n",
"r = 0.980\n",
"\n",
"//Sample Problem 38-4\n",
"printf('**Sample Problem 38-4**\n')\n",
"y = 1/sqrt(1-r^2)\n",
"Xe = y*(x - r*c*deltaT)\n",
"printf('The distance in earth frame is %1.2em\n', Xe)\n",
"Te = y*(deltaT - r*x/c)\n",
"printf('The time interval in earth frame is %1.2f', Te)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 38.5: Sample_Problem_5.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Given that\n",
"lp1 = 499.8*10^-9  //in meter\n",
"lp2 = 501.6*10^-9  //in meter\n",
"c = 3*10^8  //in m/s\n",
"Ms = 1.99*10^30  //in kg\n",
"G = 6.67*10^-11  //in SI unit\n",
"R = 100  //in light year\n",
"conv = 9.46*10^15  //conversion factor from light year to sec\n",
"\n",
"//Sample Problem 38-5a\n",
"printf('**Sample Problem 38-5a**\n')\n",
"lo = lp1 + lp2\n",
"lo = lo/2\n",
"deltaL = abs(lp1 - lo)\n",
"v = deltaL/lo * c\n",
"printf('The speed of gas relative to us is %1.2em/s\n', v)\n",
"\n",
"//Sample Problem 38-5b\n",
"printf('\n**Sample Problem 38-5b**\n')\n",
"//G*M*m/r^2 = m*v^2/r\n",
"r = R*conv\n",
"M = v^2*r/G\n",
"ratio = M/Ms\n",
"printf('The mass of galaxy is %1.2e*Ms', ratio)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 38.6: Sample_Problem_6.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Given that\n",
"K = 2.53  //in Mev\n",
"Me = 9.109*10^-31  //in kg\n",
"c = 3*10^8  //in m/s\n",
"conv = 1.6*10^-19*10^6  //Mev to joule conversion factor\n",
"\n",
"//Sample Problem 38-6a\n",
"printf('**Sample Problem 38-6a**\n')\n",
"Eactual = Me*c^2/conv + K\n",
"printf('The actual energy of the elctron is %1.2fMev\n', Eactual)\n",
"\n",
"//Sample Problem 38-6b\n",
"printf('\n**Sample Problem 38-6b**\n')\n",
"p = sqrt(Eactual^2 - (Me*c^2))\n",
"printf('The momentum of the electron is %1.2fMev/c', p)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 38.7: Sample_Problem_7.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Given that\n",
"K = 3.0*10^20*1.6*10^-19  //in J\n",
"Mp = 1.67*10^-27  //in kg\n",
"c = 3*10^8  //in m/s\n",
"conv = 9.46*10^15  //conversion factor from light year to sec\n",
"D = 9.8*10^4  //in light year\n",
"\n",
"//Sample Problem 38-7a\n",
"printf('**Sample Problem 38-7a**\n')\n",
"Erm = (Mp*c^2)\n",
"y = (K + Erm)/Erm\n",
"r = sqrt(1 - (1/y)^2)\n",
"printf('The velocity is approximately equal to %1.2f*c\n', r)\n",
"\n",
"//Sample Problem 38-7b\n",
"printf('\n**Sample Problem 38-7b**\n')\n",
"deltaT = D  //in year\n",
"printf('The time taken is %1.1ey\n', deltaT)\n",
"\n",
"//Sample Problem 38-7c\n",
"printf('\n**Sample Problem 38-7c**\n')\n",
"deltaTp = deltaT/y * 365*24*3600\n",
"printf('The time taken in reference frame of proton is %1.2fs', deltaTp)"
   ]
   }
],
"metadata": {
		  "kernelspec": {
		   "display_name": "Scilab",
		   "language": "scilab",
		   "name": "scilab"
		  },
		  "language_info": {
		   "file_extension": ".sce",
		   "help_links": [
			{
			 "text": "MetaKernel Magics",
			 "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
			}
		   ],
		   "mimetype": "text/x-octave",
		   "name": "scilab",
		   "version": "0.7.1"
		  }
		 },
		 "nbformat": 4,
		 "nbformat_minor": 0
}