{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 : Ohm's Law"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_1 Page No.  88"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Current I = 15.00 Amps\n"
     ]
    }
   ],
   "source": [
    "# A heater with the resistance of 8 Ohms\u0003 is connected across the 120-V power line. How much is current I?\n",
    "\n",
    "# Given data\n",
    "\n",
    "V = 120#        # Voltage of Power line=120 Volts\n",
    "R = 8#          # Heater Resistance=8 Ohms\n",
    "\n",
    "I = V/R#\n",
    "print 'The Current I = %0.2f Amps'%I"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_2 Page No.  88"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Current I = 0.05 Amps\n"
     ]
    }
   ],
   "source": [
    "# A small lightbulb with a resistance of 2400 Ohms\u0003 is connected across the 120-V power line. How much is current I?\n",
    "\n",
    "# Given data\n",
    "\n",
    "V = 120.#        # Voltage of Power line=120 Volts\n",
    "R = 2400#       # Lightbulb Resistance=2400 Ohms\n",
    "\n",
    "I = V/R#\n",
    "print 'The Current I = %0.2f Amps'%I"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_3 Page No.  88"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Voltage = 30.00 Volts\n"
     ]
    }
   ],
   "source": [
    "# If a 12-Ohms\u0003 resistor is carrying a current of 2.5 A, how much is its voltage?\n",
    "\n",
    "# Given data\n",
    "\n",
    "I = 2.5#        # Current=2.5 Amps\n",
    "R = 12#         # Resistance=12 Ohms\n",
    "\n",
    "V = I*R#\n",
    "print 'The Voltage = %0.2f Volts'%V"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_4 Page No.  89"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Resistance  = 75.00 ohms\n"
     ]
    }
   ],
   "source": [
    "# How much is the resistance of a lightbulb if it draws 0.16 A from a 12-V battery?\n",
    "\n",
    "# Given data\n",
    "\n",
    "V = 12#          # Voltage of Battery=12 Volts\n",
    "I = 0.16#        # Current drawn form Battery=0.16 Amps\n",
    "\n",
    "R = V/I\n",
    "print 'The Resistance  = %0.2f ohms'%R"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_5 Page No.  89"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Voltage = 40.00 Volts\n"
     ]
    }
   ],
   "source": [
    "# The I of 8 mA flows through a 5-kOhms Resistor. How much is the IR voltage?\n",
    "\n",
    "# Given data\n",
    "\n",
    "I = 8*10**-3#        # Current flowing through Resistor=8m Amps\n",
    "R = 5*10**3#         # Resistance=5k Ohms\n",
    "\n",
    "V = I*R#\n",
    "print 'The Voltage = %0.2f Volts'%V"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_6 Page No.  90"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Current I = 0.005 Amps\n",
      "i.e 5 mAmps\n"
     ]
    }
   ],
   "source": [
    "# How much current is produced by 60 V across 12 kOhms?\n",
    "\n",
    "# Given data\n",
    "\n",
    "V = 60.0#        # Voltage=60 Volts\n",
    "R = 12*10**3#   # Resistance=12k Ohms\n",
    "\n",
    "I = V/R#\n",
    "print 'The Current I = %0.3f Amps'%I\n",
    "print 'i.e 5 mAmps'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_7 Page No.  91"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Power used = 1200.00 Watts\n",
      "OR 1.2 kW\n"
     ]
    }
   ],
   "source": [
    "# A toaster takes 10 A from the 120-V power line. How much power is used?\n",
    "\n",
    "# Given data\n",
    "\n",
    "V = 120#        # Voltage of Power line=120 Volts\n",
    "I = 10#         # Current drawn from Powerline=10 Amps\n",
    "\n",
    "P = V*I#\n",
    "print 'The Power used = %0.2f Watts'%P\n",
    "print 'OR 1.2 kW'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_8 Page No.  91"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Current I = 2.50 Amps\n"
     ]
    }
   ],
   "source": [
    "# How much current flows in the filament of a 300-W bulb connected to the 120-V power line?\n",
    "\n",
    "# Given Data\n",
    "\n",
    "V = 120.0#        # Voltage of Power line=120 Volts\n",
    "P = 300#        # Power of Bulb=300 Watts\n",
    "\n",
    "I = P/V#\n",
    "print 'The Current I = %0.2f Amps'%I"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_9 Page No.  91"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Current I = 0.50 Amps\n",
      "OR 500 mA\n"
     ]
    }
   ],
   "source": [
    "# How much current flows in the filament of a 60-W bulb connected to the 120-V power line?\n",
    "\n",
    "# Given Data\n",
    "\n",
    "V = 120#        # Voltage of Power line=120 Volts\n",
    "P = 60.0#         # Power of Bulb=60 Watts\n",
    "\n",
    "I = P/V#\n",
    "print 'The Current I = %0.2f Amps'%I\n",
    "print 'OR 500 mA'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_10 Page No. 93"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cost = 4.32 $\n"
     ]
    }
   ],
   "source": [
    "# Asuming that the cost of electricity is 6 cent per kWh, how much will it cost to light a 100-W lightbulb for 30 days?\n",
    "\n",
    "h = 24*30#    # Total hours = 24 hrs * 30 days\n",
    "\n",
    "kWh = 0.1*h#    # 100W=0.1kW\n",
    "\n",
    "Cost = kWh*0.06#    # 6 cent = $0.06\n",
    "\n",
    "print 'Cost = %0.2f $'%Cost"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_11 Page No.  95"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Power = 200.00 Watts\n"
     ]
    }
   ],
   "source": [
    "# Calculate the power in a circuit where the source of 100 V produces 2 A in a 50 Ohms Resistor.\n",
    "\n",
    "# Given data\n",
    "\n",
    "I = 2#          # Current=2 Amps\n",
    "R = 50#         # Resistance=50 Ohms\n",
    "V = 100#        # Voltage Source=100 Volts\n",
    "\n",
    "P = I*I*R#\n",
    "print 'The Power = %0.2f Watts'%P"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_12 Page No. 95"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Power = 400.00 Watts\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# Calculate the power in a circuit where the source of 100 V produces 4 A in a 25 Ohms Resistor.\n",
    "\n",
    "# Given data\n",
    "\n",
    "I = 4#          # Current=4 Amps\n",
    "R = 25#         # Resistance=25 Ohms\n",
    "V = 100#        # Voltage Source=100 Volts\n",
    "\n",
    "P = I*I*R#\n",
    "print 'The Power = %0.2f Watts'%P"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_13 Page No.  96"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Current I = 5.00 Amps\n"
     ]
    }
   ],
   "source": [
    "# How much current is needed for a 600-W, 120-V toaster?\n",
    "\n",
    "# Given data\n",
    "\n",
    "V = 120.0#        # Applied Voltage=120 Volts\n",
    "P = 600#        # Power of toaster=600 Watts\n",
    "\n",
    "I = P/V#\n",
    "print 'The Current I = %0.2f Amps'%I"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_14 Page No.  97"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Resistance = 24.00 Ohms\n"
     ]
    }
   ],
   "source": [
    "# How much is the resistance of a 600-W, 120-V toaster?\n",
    "\n",
    "# Given data\n",
    "\n",
    "V = 120.0#        # Applied Voltage=120 Volts\n",
    "P = 600#        # Power of toaster=600 Watts\n",
    "\n",
    "R = (V*V)/P#\n",
    "print 'The Resistance = %0.2f Ohms'%R"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_15 Page No.  97"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Current I = 5.00 Amps\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "# How much current is needed for a 24 Ohms\u0003 Resistor that dissipates 600 W?\n",
    "\n",
    "# Given data\n",
    "\n",
    "R = 24.0#         # Resistance=24 Ohms\n",
    "P = 600.0#        # Power=600 Watts\n",
    "\n",
    "I = sqrt(P/R)#\n",
    "print 'The Current I = %0.2f Amps'%I"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_16 Page No.  98"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Resistor value = 1500.00 Ohms\n",
      "i.e 1.5 kohms\n",
      "The Power = 0.60 Watts\n",
      "OR 600 mW\n"
     ]
    }
   ],
   "source": [
    "# Determine the required resistance and appropriate wattage rating of a resistor to meet the following requirements: The resistor must have a 30-V IR drop when its current is 20 mA. The resistors available have the following wattage ratings: 1⁄8, 1⁄4, 1⁄2, 1, and 2 W.\n",
    "\n",
    "# Given data\n",
    "\n",
    "I = 20.0*10**-3#   # Current=20m Amps\n",
    "V = 30.0#         # Voltage Drop=30 Volts\n",
    "\n",
    "R = V/I#\n",
    "print 'The Resistor value = %0.2f Ohms'%R\n",
    "print 'i.e 1.5 kohms'\n",
    "\n",
    "P = I*I*R#\n",
    "print 'The Power = %0.2f Watts'%P\n",
    "print 'OR 600 mW'\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 3_17 Page No.  99"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Resistor value = 1500000 Ohms\n",
      "i.e 1.5 Mohms\n",
      "The Power = 0.03375 Watts\n",
      "i.e 33.75 mW\n"
     ]
    }
   ],
   "source": [
    "#Determine the required resistance and appropriate wattage rating of a carbonfilm resistor to meet the following requirements: The resistor must have a 225-V IR drop when its current is 150 uA. The resistors available have the following wattage ratings: 1⁄8, 1⁄4, 1⁄2, 1, and 2 W.\n",
    "\n",
    "# Given data\n",
    "\n",
    "I = 150.0*10**-6#   # Current=150 uAmps\n",
    "V = 225#         # Voltage Drop=225 Volts\n",
    "\n",
    "R = V/I#\n",
    "print 'The Resistor value = %0.f Ohms'%R\n",
    "print 'i.e 1.5 Mohms'\n",
    "\n",
    "P = I*I*R#\n",
    "print 'The Power = %0.5f Watts'%P\n",
    "print 'i.e 33.75 mW'"
   ]
  }
 ],
 "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
}