{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 9 :  Kirchoff's Laws"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 9_1 Page No.  268"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Branch 3 Current I3 = 4.5 Amps\n"
     ]
    }
   ],
   "source": [
    "# Apply Kirchhoff’s current law to solve for the unknown current, I3.\n",
    "\n",
    "# Given data\n",
    "\n",
    "I1 = 2.5#     # Branch 1 Current=2.5 Amps\n",
    "I2 = 8#       # Branch 2 Current=8 Amps\n",
    "I4 = 6#       # Branch 3 Current=6 Amps\n",
    "I5 = 9#       # Branch 4 Current=9 Amps\n",
    "\n",
    "# I1+I2+I3-I4-I5 = 0 Sum of all currents at node is ZERO\n",
    "# I1+I2+I3 = I4+I5 Total Incomming Current = Total Outgoing Current\n",
    "\n",
    "I3 = I4+I5-I1-I2#\n",
    "print 'The Branch 3 Current I3 = %0.1f Amps'%I3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 9_2 Page No.  275"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Voltage V(AG) = 7.20 Volts\n",
      "The Voltage V(BG) = -1.80 Volts\n"
     ]
    }
   ],
   "source": [
    "# Apply Kirchhoff’s voltage law to solve for the voltages V(AG) & V(BG).\n",
    "\n",
    "# Given data\n",
    "\n",
    "V1 = 18.#        # Source Voltage 1=18 Volts\n",
    "V2 = 18.#        # Source Voltage 2=18 Volts\n",
    "R1 = 120.#       # Resistor 10=120 Ohms\n",
    "R2 = 100.#       # Resistor 2=100 Ohms\n",
    "R3 = 180.#       # Resistor 3=180 Ohms\n",
    "\n",
    "Vt = V1+V2#\n",
    "Rt = R1+R2+R3#\n",
    "\n",
    "I = Vt/Rt#\n",
    "\n",
    "VR1 = I*R1#\n",
    "VR2 = I*R2#\n",
    "VR3 = I*R3#\n",
    "\n",
    "# V1+V2-VR1-VR2-VR3=0 Sum of all Voltages in loop is ZERO\n",
    "# V1+V2 = VR1+VR2+VR3 Total Applied Voltage = Total Dropped Voltage in Resistors\n",
    "\n",
    "Vt = VR1+VR2+VR3#\n",
    "\n",
    "VAG = VR2+VR3-V2#\n",
    "print 'The Voltage V(AG) = %0.2f Volts'%VAG\n",
    "\n",
    "VBG = V1-VR1-VR2#\n",
    "print 'The Voltage V(BG) = %0.2f Volts'%VBG"
   ]
  }
 ],
 "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
}