{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 15 : Electric forces and electric fields"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 15.1 Page No : 502"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The attractive force = 8.19e-08 N\n",
      "The gravitational force = 3.61e-47 N\n"
     ]
    }
   ],
   "source": [
    "k_e=8.99*10**9\n",
    "e=1.6*10**-19\n",
    "r=5.3*10**-11\n",
    "F_e= (k_e*e*e)/(r*r)\n",
    "print \"The attractive force = %0.2e N\"%F_e\n",
    "G=6.67*10**-11\n",
    "m_e=9.11*10**-31\n",
    "m_p=1.67*10**-27\n",
    "F_g=(G*m_e*m_p)/(r*r)\n",
    "print \"The gravitational force = %0.2e N\"%F_g"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 15.2 Page No : 503"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The force = 5.62e-09 N\n",
      "The force = 1.08e-08 N\n"
     ]
    }
   ],
   "source": [
    "k_e=8.99*10**9 #N.m**2/c**2\n",
    "q2=2*10**-9# = %0.2f c\n",
    "q3=5*10**-9# = %0.2f c\n",
    "r1=4#in m\n",
    "F_23=(q2*q3*k_e)/(r1*r1)\n",
    "print \"The force = %0.2e N\"%F_23\n",
    "q1=6*10**-9\n",
    "r2=5#in m\n",
    "F_13=(q1*q3*k_e)/(r2*r2)\n",
    "print \"The force = %0.2e N\"%F_13"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 15.4 Page No: 507"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The magnitude of force = 3.20e-15 N\n"
     ]
    }
   ],
   "source": [
    "q=1.6*10**-19#in c\n",
    "E=2*10**4# = %0.2f N/C\n",
    "F=q*E\n",
    "print \"The magnitude of force = %0.2e N\"%F"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 15.5 Page No: 509"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Magnitude of E1 = 3.93e+05 N/C\n",
      "Magnitude of E2 = 1.80e+05 N/C\n",
      "Magnitude in x direction = 1.80e+05 N/C\n",
      "Magnitude in y direction = 2.49e+05 N/C\n",
      "Angle = 54.17 degree\n"
     ]
    }
   ],
   "source": [
    "from math import degrees, atan\n",
    "k_e=8.99*10**9 #N.m**2/c**2\n",
    "q1=7*10**-6# = %0.2f C\n",
    "q2=5*10**-6#in C\n",
    "r1=0.4\n",
    "r2=0.5\n",
    "E1=(k_e*q1)/(r1**2)\n",
    "E2=(k_e*q2)/(r2**2)\n",
    "Ex=(k_e*q2)/(r2**2)\n",
    "print \"Magnitude of E1 = %0.2e N/C\"%E1\n",
    "print \"Magnitude of E2 = %0.2e N/C\"%E2\n",
    "print \"Magnitude in x direction = %0.2e N/C\"%Ex\n",
    "Ey=(3.93*10**5)+(-1.44*10**5)\n",
    "print \"Magnitude in y direction = %0.2e N/C\"%Ey\n",
    "phi=degrees(atan(Ey/Ex))\n",
    "print \"Angle = %0.2f degree\"%phi\n",
    "#Answer given in the book is wrong"
   ]
  }
 ],
 "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
}
