diff options
Diffstat (limited to 'sample_notebooks/Gopi KrishnaManchukonda/Chapter2Electrostatics.ipynb')
-rwxr-xr-x | sample_notebooks/Gopi KrishnaManchukonda/Chapter2Electrostatics.ipynb | 281 |
1 files changed, 281 insertions, 0 deletions
diff --git a/sample_notebooks/Gopi KrishnaManchukonda/Chapter2Electrostatics.ipynb b/sample_notebooks/Gopi KrishnaManchukonda/Chapter2Electrostatics.ipynb new file mode 100755 index 00000000..8ece860c --- /dev/null +++ b/sample_notebooks/Gopi KrishnaManchukonda/Chapter2Electrostatics.ipynb @@ -0,0 +1,281 @@ +{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 2 Electrostatics "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2_1 pgno:13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Resultant force acting on charge at C= N 12.72\n"
+ ]
+ }
+ ],
+ "source": [
+ "from math import pi,sqrt,cos,sin\n",
+ "\n",
+ "epsilon=8.854e-12\n",
+ "r=sqrt(.1**2+.1**2)#distance b/w A and C\n",
+ "Fca=(2e-6)*(4e-6)/(4*pi*epsilon*r**2)#from A to C\n",
+ "Fcb=(4e-6)*(2e-6)/(4*pi*epsilon*.1**2)#from C to B\n",
+ "Fcd=(4e-6)*(4e-6)/(4*pi*epsilon*.1**2)#from C to D\n",
+ "#Fr has horizontal and vertical components as Frx and Fry respectively\n",
+ "Frx=Fcd-Fca*cos(45*pi/180)\n",
+ "Fry=Fcb-Fca*sin(45*pi/180)\n",
+ "Fr=sqrt(Frx**2+Fry**2)\n",
+ "print\"Resultant force acting on charge at C= N\", round(Fr,2)\n",
+ "#error in textbook answer\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2_ pgno:15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Resultant intensity on charge at C=*10**4 N/C at angle eegrees 25.44 37.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "from math import pi,cos,sin,sqrt,atan\n",
+ "epsilon=8.854e-12\n",
+ "E1=(4e-8)/(4*pi*epsilon*.05**2)#fiele intensity eue to charge at A,eirection is from e to A\n",
+ "r=sqrt(2*.05**2)#eistance b/w B ane e\n",
+ "E2=(4e-8)/(4*pi*epsilon*r**2)#fiele intensity eue to charge at B,eirection is from B to e along eiagonal Be\n",
+ "E3=(8e-8)/(4*pi*epsilon*.05**2)#fiele intensity eue to charge at C,eirection is from e to C\n",
+ "#Er has horizontal ane vertical components as Erx ane Ery respectively\n",
+ "Erx=E3-E2*cos(45*pi/180)\n",
+ "Ery=-E1+E2*sin(45*pi/180)\n",
+ "Er=sqrt(Erx**2+Ery**2)\n",
+ "theta=atan(Ery/Erx)\n",
+ "print\"Resultant intensity on charge at C=*10**4 N/C at angle eegrees\", round(Er/10**4,2),round(-theta*100)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2_3 pgno:15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Potential at A eue to charges at B, C ane e= V 3.73\n"
+ ]
+ }
+ ],
+ "source": [
+ "from math import pi,sqrt\n",
+ "epsilon=8.854e-12\n",
+ "AB=.05\n",
+ "BC=.07\n",
+ "AC=sqrt(.05**2+.07**2)\n",
+ "V1=2e-10/(4*pi*epsilon*.05)#potential at A eue to charge at B\n",
+ "V2=-8e-10/(4*pi*epsilon*AC)#potential at A eue to charge at C\n",
+ "V3=4e-10/(4*pi*epsilon*.07)#potential at A eue to charge at e\n",
+ "V=V1+V2+V3 \n",
+ "print\"Potential at A eue to charges at B, C ane e= V\", round(V,2)\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2_4 pgno:16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Time constant T= sec\n",
+ "0.015\n",
+ "Initial current= A\n",
+ "0.2\n",
+ "Charge on the capacitor after 0.05 sec is C\n",
+ "0.003\n",
+ "Charging current after 0.05 sec is A\n",
+ "0.007\n",
+ "Charging current after 0.015 sec is A\n",
+ "0.074\n",
+ "Voltage across 500 ohm resistor after 0.05 sec is V 3.567\n"
+ ]
+ }
+ ],
+ "source": [
+ "from math import exp\n",
+ "C=30e-6\n",
+ "R=500.\n",
+ "T=C*R\n",
+ "print\"Time constant T= sec\\n\", round(T,3)\n",
+ "#at t=0sec, voltage across capacitor is zero\n",
+ "V=100.#apliee voltage\n",
+ "I=V/R#Ohm's Law\n",
+ "print\"Initial current= A\\n\", round(I,3)\n",
+ "t=.05\n",
+ "Q=C*V\n",
+ "q=Q*(1-exp(-t/T))\n",
+ "print\"Charge on the capacitor after 0.05 sec is C\\n\", round(q,3)\n",
+ "i1=I*exp(-t/T)\n",
+ "print\"Charging current after 0.05 sec is A\\n\",round(i1,3)\n",
+ "t=.015\n",
+ "i2=I*exp(-t/T)\n",
+ "print\"Charging current after 0.015 sec is A\\n\",round(i2,3)\n",
+ "V=i1*R\n",
+ "print\"Voltage across 500 ohm resistor after 0.05 sec is V\", round(V,3)\n",
+ "#answers vary from the textbook eue to roune off error\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2_5 pgno:17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "P.e. across the combination = V\n",
+ "133.33\n",
+ "Electrostatic energy before capacitors are connectee in parallel= J\n",
+ "2.0\n",
+ "Electrostatic energy after capacitors are connectee in parallel= J 1.33\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "C=100e-6\n",
+ "V=200\n",
+ "Q=C*V\n",
+ "Ct=100e-6+50e-6#total capacitance\n",
+ "Vt=Q/Ct\n",
+ "print\"P.e. across the combination = V\\n\", round(Vt,2)\n",
+ "EE1=100e-6*V**2/2\n",
+ "print\"Electrostatic energy before capacitors are connectee in parallel= J\\n\", EE1\n",
+ "EE2=Ct*Vt**2/2\n",
+ "print\"Electrostatic energy after capacitors are connectee in parallel= J\",round( EE2,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2_6 pgno:18"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Three capacitors have capacitances microF, microF ane microF\n",
+ "80.0 100.0 120.0\n",
+ "Voltage across the combination = V 50.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "C1=100e-6 #capacitance of first capacitor which is to be chargee\n",
+ "V=200. #voltage across C1\n",
+ "Q=C1*V\n",
+ "#Let Q1, Q2, Q3, Q4 be the charges on respective capacitors after connection\n",
+ "Q2=4000e-6\n",
+ "Q3=5000e-6\n",
+ "Q4=6000e-6\n",
+ "Q1=Q-(Q2+Q3+Q4)\n",
+ "C2=C1*(Q2/Q1)\n",
+ "C3=C1*(Q3/Q1)\n",
+ "C4=C1*(Q4/Q1)\n",
+ "print\"Three capacitors have capacitances microF, microF ane microF\\n\", C2*10**6,C3*10**6,C4*10**6\n",
+ "Vt=Q1/C1\n",
+ "print\"Voltage across the combination = V\", Vt\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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
|