{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Basic Electric Circuits and Components" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.1, Page 23" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Current, I = 15.9 mA\n" ] } ], "source": [ "#Initialisation\n", "v1=15.8 #voltage across r1\n", "v2=12.3 #voltage across r2\n", "r2=220 #resistance R2 in ohm\n", "\n", "#Calculation\n", "v=v1-v2 #voltage difference across the resistor\n", "i=v/r2 #current in ampere\n", "\n", "#Result\n", "print'Current, I = %.1f mA'%(i*1000)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.2, Page 24" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "I2 = 7 A\n" ] } ], "source": [ "#Initialisation\n", "i1=10; #current in amp\n", "i3=3; #current in amp\n", "\n", "\n", "#Calculation\n", "i2=i1-i3 #current in amp\n", "\n", "#Result\n", "print'I2 = %d A'%i2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.3, Page 25" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "V1 = 5 V\n" ] } ], "source": [ "#Initialisation\n", "E=12 #EMF in volt\n", "v2=7 #volt\n", "\n", "\n", "#Calculation\n", "v1=E-v2 #volt\n", "\n", "#Result\n", "print'V1 = %d V'%v1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.4, Page 25" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "P = 450 W\n" ] } ], "source": [ "#Initialisation\n", "i=3 #current in amp\n", "r=50 #resistance in ohm\n", "\n", "\n", "#Calculation\n", "p=(i**2)*r #power in watt\n", "\n", "#Result\n", "print'P = %d W'%p\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.5, Page 26" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "R = 70 ohm\n" ] } ], "source": [ "#Initialisation\n", "r1=10 #resistance in ohm\n", "r2=20 #resistance in ohm\n", "r3=15 #resistance in ohm\n", "r4=25 #resistance in ohm\n", "\n", "\n", "#Calculation\n", "r=r1+r2+r3+r4 #series resistance in ohm\n", "\n", "#Result\n", "print'R = %d ohm'%r\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.6, Page 27" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "R = 6.67 ohm\n" ] } ], "source": [ "#Initialisation\n", "r1=10 #resistance in ohm\n", "r2=20 #resistance in ohm\n", "\n", "\n", "\n", "#Calculation\n", "r=(r1*r2)*(r1+r2)**-1 #parallel resistance in ohm\n", "\n", "#Result\n", "print'R = %.2f ohm'%r\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.7, Page 28" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "V = 6 V\n" ] } ], "source": [ "#Initialisation\n", "r1=200 #resistance in ohm\n", "r2=300 #resistance in ohm\n", "\n", "\n", "#Calculation\n", "v=(10*r2)/(r1+r2) #resistance in ohm\n", "\n", "#Result\n", "print'V = %d V'%v" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.8, Page 29" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "V = 7 V\n" ] } ], "source": [ "#Initialisation\n", "r1=1*10**3 #resistance in ohm\n", "r2=500 #resistance in ohm\n", "v1=15 #voltage\n", "v2=3 #voltage\n", "\n", "#Calculation\n", "v=v2+((v1-v2)*((r2)*(r1+r2)**-1)) #resistance in ohm\n", "\n", "#Result\n", "print'V = %d V'%v\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.9, Page 30" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "T = 20 ms\n" ] } ], "source": [ "#Initialisation\n", "f=50 #frequency in herts\n", "\n", "\n", "#Calculation\n", "t=(1*f**-1) #time period\n", "\n", "\n", "#Result\n", "print'T = %d ms'%(t*10**3)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [Root]", "language": "python", "name": "Python [Root]" }, "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.12" } }, "nbformat": 4, "nbformat_minor": 0 }