summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrupti Kini2016-10-10 23:31:11 +0600
committerTrupti Kini2016-10-10 23:31:11 +0600
commit189970c4df1e5d7e1c76e6bffae8323f42192c4a (patch)
tree3da8e9596c0b8c638a105ee4143e1bb2bc840436
parent1f4df3f622aa9920d8343e53a354fbde7f9f38c2 (diff)
downloadPython-Textbook-Companions-189970c4df1e5d7e1c76e6bffae8323f42192c4a.tar.gz
Python-Textbook-Companions-189970c4df1e5d7e1c76e6bffae8323f42192c4a.tar.bz2
Python-Textbook-Companions-189970c4df1e5d7e1c76e6bffae8323f42192c4a.zip
Added(A)/Deleted(D) following books
A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter11.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter12.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter13.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter14.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter15.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter16.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter18.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter19.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter2.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter20.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter21.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter22.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter23.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter5.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter6.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter8.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter9.ipynb A Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/cap1.png A Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index.png A Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index2.png A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10_oz6KtzL.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter1_Zz52w1c.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter2_ctyqn3t.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter3_UNgU4ev.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter4_JbH1k27.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter5_0VUnA6n.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter6_Vet62xI.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter7_TclM939.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter8_O8vLz4s.ipynb A Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/InverseMatrix_4IPKcOB.png A Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_1i9RBkK.png A Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_vUnUNjM.png
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter11.ipynb280
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter12.ipynb313
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter13.ipynb278
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter14.ipynb268
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter15.ipynb395
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter16.ipynb215
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter18.ipynb158
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter19.ipynb113
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter2.ipynb363
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter20.ipynb121
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter21.ipynb241
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter22.ipynb123
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter23.ipynb151
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter5.ipynb253
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter6.ipynb261
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter8.ipynb175
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter9.ipynb418
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/cap1.pngbin0 -> 25269 bytes
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index.pngbin0 -> 7144 bytes
-rw-r--r--Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index2.pngbin0 -> 7115 bytes
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10_oz6KtzL.ipynb128
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter1_Zz52w1c.ipynb751
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter2_ctyqn3t.ipynb792
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter3_UNgU4ev.ipynb631
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter4_JbH1k27.ipynb327
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter5_0VUnA6n.ipynb357
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter6_Vet62xI.ipynb503
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter7_TclM939.ipynb240
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter8_O8vLz4s.ipynb560
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/InverseMatrix_4IPKcOB.pngbin0 -> 38657 bytes
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_1i9RBkK.pngbin0 -> 42440 bytes
-rw-r--r--Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_vUnUNjM.pngbin0 -> 42440 bytes
32 files changed, 8415 insertions, 0 deletions
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter11.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter11.ipynb
new file mode 100644
index 00000000..1e08381f
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter11.ipynb
@@ -0,0 +1,280 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:3a4ef8be1017f129a0421c21819212b5457aab0abc06690d5c2563f72500374f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11: Measurement of Voltages and Currents"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.1, Page 209"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialisation\n",
+ "t=0.02 #time period in seconds from diagram\n",
+ "v1=7 #peak voltage from diagram\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "f=1*t**-1 #frequency in Hz\n",
+ "v2=2*v1 # Peak to Peak Voltage\n",
+ "\n",
+ "#Result\n",
+ "print'Frequency = %d Hz\\n'%f\n",
+ "print'Peak to Peak Voltage = %d V\\n'%v2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Frequency = 50 Hz\n",
+ "\n",
+ "Peak to Peak Voltage = 14 V\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.2, Page 210"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#Initialisation\n",
+ "t=0.05 #time period in seconds from diagram\n",
+ "v1=10 #peak voltage from diagram\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "f1=1*t**-1 #frequency in Hz\n",
+ "w1=2*math.pi*f1 #Angular velocity\n",
+ "\n",
+ "#Result\n",
+ "print'%d sin %.1ft Hz\\n'%(v1,w1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "10 sin 125.7t Hz\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.3, Page 211"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#Initialisation\n",
+ "t=0.1 #time period in seconds from diagram\n",
+ "v1=10 #peak voltage from diagram\n",
+ "t1=25*10**-3\n",
+ "\n",
+ "#Calculation\n",
+ "f1=1*t**-1 #frequency in Hz\n",
+ "w1=2*math.pi*f1 #Angular velocity\n",
+ "phi=-(t1*t**-1)*360 #phase angle\n",
+ "\n",
+ "#Result\n",
+ "print'phi = %d degree'%phi\n",
+ "print'%d sin %dt%d Hz\\n'%(v1,round(w1),phi)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phi = -90 degree\n",
+ "10 sin 63t-90 Hz\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.4, Page 215"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#Initialisation\n",
+ "v1=5 #constant 5V\n",
+ "r=10 #resistance in Ohm\n",
+ "vrms=5 #sine wave of 5 V r.m.s\n",
+ "vp=5 #5 V peak\n",
+ "\n",
+ "#Calculation\n",
+ "p=(v1**2)*r**-1 #Power in watts\n",
+ "p2=(vrms**2)*r**-1 #Power avarage in watts\n",
+ "a=(vp*math.sqrt(2)**-1)**2\n",
+ "p3=a*r**-1 #Power avarage in watts \n",
+ "\n",
+ "#Result\n",
+ "print'(1) P = %.1f W\\n'%p\n",
+ "print'(2) Pav = %.1f W\\n'%p2\n",
+ "print'(3) Pav = %.2f W\\n'%p3"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(1) P = 2.5 W\n",
+ "\n",
+ "(2) Pav = 2.5 W\n",
+ "\n",
+ "(3) Pav = 1.25 W\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.5, Page 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialisation\n",
+ "fsd1=50*10**-3 #full scale defelction of ammeter in Ampere\n",
+ "fsd2=1*10**-3 #full scale defelction of moving coil meter in Ampere\n",
+ "Rm=25 #resistance of moving coil meter in Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "Rsm=fsd1*fsd2**-1 #sensitivity factor\n",
+ "Rsh=Rm*49**-1 #shunt resistor\n",
+ "\n",
+ "#Result\n",
+ "print'Therefore, Resistor = %d mOhm\\n'%round(Rsh*10**3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Therefore, Resistor = 510 mOhm\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.6, Page 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialisation\n",
+ "fsd1=50 #full scale defelction of voltmeter in Volts\n",
+ "fsd2=1*10**-3 #full scale defelction of moving coil meter in Ampere\n",
+ "Rm=25 #resistance of moving coil meter in Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "Rsm=fsd1*fsd2**-1\n",
+ "Rse=Rsm-Rm\n",
+ "\n",
+ "#Result\n",
+ "print'Rse = %.3f KOhm\\n'%(Rse*10**-3)\n",
+ "print'Therefore, Resistor ~ %d KOhm\\n'%round(Rse*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rse = 49.975 KOhm\n",
+ "\n",
+ "Therefore, Resistor ~ 50 KOhm\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter12.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter12.ipynb
new file mode 100644
index 00000000..0b76bb5c
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter12.ipynb
@@ -0,0 +1,313 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 12: Resistance and DC Circuits"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.1, Page 237"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Magnitude, I4 = -3 A\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialization\n",
+ "i1=8 #current in Amp\n",
+ "i2=1 #current in Amp\n",
+ "i3=4 #current in Amp\n",
+ "\n",
+ "#Calculation\n",
+ "i4=i2+i3-i1 #current in Amp\n",
+ "\n",
+ "#Results\n",
+ "print'Magnitude, I4 = %d A'%i4"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.2, Page 239"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "#Initialization\n",
+ "e=12 #EMF source in volt\n",
+ "v1=3 #node voltage\n",
+ "v3=3 #node voltage\n",
+ "\n",
+ "#Calculation\n",
+ "v2=v1+v3-e #node voltage\n",
+ "\n",
+ "#Results\n",
+ "print'V2 = %d V'%v2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.4, Page 242"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voc = 10 V\n",
+ "R = 100 ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "\n",
+ "#We have used method II for solving our problem by using simultaneous equations\n",
+ "\n",
+ "a = np.array([[25,-2],[400,-8]]) \n",
+ "b = np.array([[50],[3200]])\n",
+ "c=np.linalg.solve(a,b)\n",
+ "\n",
+ "print'Voc = %d V'%c[0]\n",
+ "print'R = %d ohm'%c[1]\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.5, Page 244"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage, V = 7.14\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialization\n",
+ "r1=100 #Resistance in Ohm\n",
+ "r2=200 #Resistance in Ohm\n",
+ "r3=50 #Resistance in Ohm\n",
+ "v1=15 #voltage source\n",
+ "v2=20 #voltage source\n",
+ "\n",
+ "#Calculation\n",
+ "#Considering 15 V as a source & replace the other voltage source by its internal resistance,\n",
+ "r11=(r2*r3)*(r2+r3)**-1 #resistance in parallel\n",
+ "v11=v1*(r11/(r1+r11)) #voltage\n",
+ "#Considering 20 V as a source & replace the other voltage source by its internal resistance,\n",
+ "r22=(r1*r3)*(r1+r3)**-1 #resistance in parallel\n",
+ "v22=v2*(r22/(r2+r22)) #voltage\n",
+ "\n",
+ "#output of the original circuit\n",
+ "v33=v11+v22\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print'Voltage, V = %.2f'%v33"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.6, Page 246"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Output Current, I = 1.67 A\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialization\n",
+ "r1=10 #Resistance in Ohm\n",
+ "r2=5 #Resistance in Ohm\n",
+ "v2=5 #voltage source\n",
+ "i=2 #current in Amp\n",
+ "\n",
+ "#Calculation\n",
+ "#Considering 5 V as a source & replace the current source by its internal resistance,\n",
+ "i1=v2*(r1+r2)**-1 #current using Ohms law\n",
+ "#Considering current source & replace the voltage source by its internal resistance,\n",
+ "r3=(r1*r2)*(r1+r2)**-1 #resistance in parallel\n",
+ "v3=i*r3 #voltage using Ohms law\n",
+ "i2=v3*r2**-1 #current using Ohms law\n",
+ "i3=i1+i2 #total current\n",
+ "\n",
+ "#Results\n",
+ "print'Output Current, I = %.2f A'%i3"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.8, Page 251"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "V2 = 33.04 V\n",
+ "V3 = 43.15 V\n",
+ "Current, I1 = 1.73 A\n"
+ ]
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "r=25 #resistance in ohm\n",
+ "\n",
+ "#We have used for solving our problem by using simultaneous equations\n",
+ "\n",
+ "a = np.array([[(-13*60**-1),(1*20**-1)],[(1*60**-1),(-9*100**-1)]]) \n",
+ "b = np.array([[-5],[-100*30**-1]])\n",
+ "c=np.linalg.solve(a,b)\n",
+ "i1=c[1]/r #required current\n",
+ "\n",
+ "print'V2 = %.2f V'%c[0] #wrong answer in textbook\n",
+ "print'V3 = %.2f V'%c[1] #wrong answer in textbook\n",
+ "print'Current, I1 = %.2f A'%i1\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.9, Page 253"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "I1 = 326 mA\n",
+ "I2 = 33 mA\n",
+ "I3 = 53 mA\n",
+ "Voltage, Ve = 0.197 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "re=10 #resistance in ohm\n",
+ "\n",
+ "#We have used for solving our problem by using simultaneous equations\n",
+ "\n",
+ "a = np.array([[(-160),(20), (30)],[(20),(-210), (10)], [(30),(10), (-190)]]) \n",
+ "b = np.array([[-50],[0],[0]])\n",
+ "c=np.linalg.solve(a,b)\n",
+ "ve=re*(c[2]-c[1])\n",
+ "\n",
+ "print'I1 = %d mA'%(c[0]*10**3) #current I1\n",
+ "print'I2 = %d mA'%(c[1]*10**3) #current I2\n",
+ "print'I3 = %d mA'%(c[2]*10**3) #current I3\n",
+ "print'Voltage, Ve = %.3f V'%ve\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter13.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter13.ipynb
new file mode 100644
index 00000000..6ed908f9
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter13.ipynb
@@ -0,0 +1,278 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:d756c6c77a4ac290c4965398d89838e2f053a559b464bd46ff8cc1c208f13b8e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 13: Capacitance and Electric Fields"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13.1, Page 264"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialization\n",
+ "c=10*10**-6 #capacitance in Farad\n",
+ "v=10 #voltage\n",
+ "\n",
+ "#Calculation\n",
+ "q=c*v #charge in coulomb\n",
+ "\n",
+ "#Results\n",
+ "print'Charge, q = %.1f uC'%(q*10**6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Charge, q = 100.0 uC\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13.2, Page 264"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialization\n",
+ "l=25*10**-3 #length in meter\n",
+ "b=10*10**-3 #breadth in meter\n",
+ "d=7*10**-6 #distance between plates in meter\n",
+ "e=100 #dielectric constant of material\n",
+ "e0=8.85*10**-12 #dielectric constant of air \n",
+ "\n",
+ "#Calculation\n",
+ "c=(e0*e*l*b)*d**-1 #Capacitance\n",
+ "#Results\n",
+ "print'Capacitance, C = %.1f nF'%(c*10**9)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Capacitance, C = 31.6 nF\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13.3, Page 268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialization\n",
+ "v=100 #voltage\n",
+ "d=10**-5 #distance in meter\n",
+ "\n",
+ "#Calculation\n",
+ "e=v*d**-1 #Electric Field Strength\n",
+ "\n",
+ "#Results\n",
+ "print'Electric Field Strength, E = %d ^7 V/m'%round(e*10**-6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Electric Field Strength, E = 10 ^7 V/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13.4, Page 268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialization\n",
+ "q=15*10**-6 #charge in coulomb\n",
+ "a=200*10**-6 #area\n",
+ "\n",
+ "#Calculation\n",
+ "d=q/a #electric flux density\n",
+ "\n",
+ "#Results\n",
+ "print'D = %d mC/m^2'%(d*10**3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "D = 75 mC/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13.5, Page 270"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialization\n",
+ "C1=10*10**-6 #capacitance in Farad\n",
+ "C2=25*10**-6 #capacitance in Farad\n",
+ "\n",
+ "#Calculation\n",
+ "C=C1+C2 #capacitance in Farad\n",
+ "\n",
+ "#Results\n",
+ "print'C = %d uF'%(C*10**6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "C = 35 uF\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13.6, Page 271"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialization\n",
+ "C1=10*10**-6 #capacitance in Farad\n",
+ "C2=25*10**-6 #capacitance in Farad\n",
+ "\n",
+ "#Calculation\n",
+ "C=(C1*C2)/(C1+C2) #capacitance in Farad\n",
+ "\n",
+ "#Results\n",
+ "print'C = %.2f uF'%(C*10**6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "C = 7.14 uF\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13.7, Page 275"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Initialization\n",
+ "C1=10*10**-6 #capacitance in Farad\n",
+ "V=100 #voltage\n",
+ "\n",
+ "#Calculation\n",
+ "E=(0.5)*(C1*V**2) #Energy stored\n",
+ "\n",
+ "#Results\n",
+ "print'E = %.1f mJ'%(E*10**3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "E = 50.0 mJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter14.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter14.ipynb
new file mode 100644
index 00000000..e0d13aee
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter14.ipynb
@@ -0,0 +1,268 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 14: Inductance and Magnetic Fields"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 14.1, Page 280"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Magnetic Field Strength, H = 7.96 A/m\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialization\n",
+ "i=5 #current in ampere\n",
+ "l=0.628 #circumference\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "h=i/l #magnetic field strength\n",
+ "\n",
+ "#Results\n",
+ "print'Magnetic Field Strength, H = %.2f A/m'%h"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 14.2, Page 283"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) Magnetomotive Force, H = 3000.00 ampere-turns\n",
+ "(b) Magnetic Field Strength, H = 7500.00 A/m\n",
+ "(c) B = 9.42 mT\n",
+ "(d) Toal Flux, phi = 2.83 uWb\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "i=6 #current in ampere\n",
+ "n=500 #turns\n",
+ "l=0.4 #circumference\n",
+ "uo=4*math.pi*10**-7 #epsilon zero constant\n",
+ "a=300*10**-6 #area\n",
+ "\n",
+ "#Calculation\n",
+ "f=n*i #Magnetomotive Force\n",
+ "h=f/l #magnetic field strength\n",
+ "b=uo*h #magnetic induction\n",
+ "phi=b*a #flux\n",
+ "\n",
+ "#Results\n",
+ "print'(a) Magnetomotive Force, H = %.2f ampere-turns'%f\n",
+ "print'(b) Magnetic Field Strength, H = %.2f A/m'%h\n",
+ "print'(c) B = %.2f mT'%(b*10**3)\n",
+ "print'(d) Toal Flux, phi = %.2f uWb'%(phi*10**6)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 14.3, Page 285"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage, V = 30 mV\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialization\n",
+ "l=10*10**-3 #inductance in henry\n",
+ "di=3\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "v=l*di #voltage \n",
+ "\n",
+ "#Results\n",
+ "print'Voltage, V = %d mV'%(v*10**3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 14.4, Page 287"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Inductance,L = 30 uH\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "n=400 #turns\n",
+ "l=200*10**-3 #circumference\n",
+ "uo=4*math.pi*10**-7 #epsilon zero constant\n",
+ "a=30*10**-6 #area\n",
+ "\n",
+ "#Calculation\n",
+ "L=(uo*a*n**2)/l #Inductance in henry \n",
+ "\n",
+ "#Results\n",
+ "print'Inductance,L = %d uH'%(L*10**6)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 14.5, Page 289"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) Inductance in series,L = 30 uH\n",
+ "(b) Inductance in parallel,L = 6.67 uH\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "l1=10 #Inductance in henry \n",
+ "l2=20 #Inductance in henry \n",
+ "\n",
+ "#Calculation\n",
+ "ls=l1+l2 #Inductance in henry \n",
+ "lp=((l1*l2)*(l1+l2)**-1) #Inductance in henry \n",
+ "#Results\n",
+ "print'(a) Inductance in series,L = %d uH'%ls\n",
+ "print'(b) Inductance in parallel,L = %.2f uH'%lp"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 14.6, Page 293"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Stored Energy = 125 mJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "l=10**-2 #Inductance in henry \n",
+ "i=5 #current in ampere \n",
+ "\n",
+ "#Calculation\n",
+ "s=0.5*l*i**2 #stored energy\n",
+ "\n",
+ "#Results\n",
+ "print'Stored Energy = %d mJ'%(s*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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter15.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter15.ipynb
new file mode 100644
index 00000000..0cab5dbb
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter15.ipynb
@@ -0,0 +1,395 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter : Alternating Voltages and Currents"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15.1, Page 305"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Reactance, Xl = 1 Ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "w=1000 #Angular Frequency \n",
+ "L=10**-3 #Inductance\n",
+ "\n",
+ "#Calculation\n",
+ "Xl=w*L #Reactance\n",
+ "\n",
+ "#Result\n",
+ "print'Reactance, Xl = %d Ohm'%Xl"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15.2, Page 305"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Reactance, Xl = 1.59 KOhm\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "f=50 #frequency\n",
+ "C=2*10**-6 #Capacitance\n",
+ "\n",
+ "#Calculation\n",
+ "w=2*math.pi*f #Angular Frequency \n",
+ "Xc=1/(w*C) #Reactance\n",
+ "\n",
+ "#Result\n",
+ "print'Reactance, Xl = %.2f KOhm'%(Xc/1000)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15.3, Page 306"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Peak Current, IL = 318 mA\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "f=100 #frequency\n",
+ "l=25*10**-3 #Inductance\n",
+ "Vl=5 #AC Voltage (Sine)\n",
+ "\n",
+ "#Calculation\n",
+ "w=2*math.pi*f #Angular Frequency \n",
+ "Xl=w*l #Reactance\n",
+ "Il=Vl*Xl**-1\n",
+ "\n",
+ "#Result\n",
+ "print'Peak Current, IL = %d mA'%(Il*10**3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15.4, Page 306"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage appear across the capacitor, V = 8 V r.m.s\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "Ic=2 #sinusoidal Current\n",
+ "C=10*10**-3 #Capacitance\n",
+ "w=25 #Angular Frequency \n",
+ "\n",
+ "\n",
+ "\n",
+ "#Calculation \n",
+ "Xc=1/(w*C) #Reactance\n",
+ "Vc= Ic*Xc #Voltage\n",
+ "\n",
+ "#Result\n",
+ "print'Voltage appear across the capacitor, V = %d V r.m.s'%(Vc)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15.5, Page 309"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) V = 63.6 V\n",
+ "(b) V = 38.15 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "I=5 #sinusoidal Current\n",
+ "R=10 #Resistance in Ohm\n",
+ "f=50 #Frequency in Hertz\n",
+ "L=0.025 #Inductancec in Henry\n",
+ " \n",
+ "\n",
+ "#Calculation \n",
+ "Vr=I*R #Voltage across resistor\n",
+ "Xl=2*math.pi*f*L #Reactance\n",
+ "VL= I*Xl #Voltage across inductor\n",
+ "V=math.sqrt((Vr**2)+(VL**2)) #total voltage\n",
+ "phi=math.atan(VL*Vr**-1) #Phase Angle in radians\n",
+ "\n",
+ "#Result\n",
+ "print'(a) V = %.1f V'%(V)\n",
+ "print'(b) V = %.2f V'%(phi*180/math.pi) #phase angle in degree"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15.6, Page 311"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 45,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) Current, I = 884 uA\n",
+ "(b) V = -27.95 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "R=10**4 #Resistance in Ohm\n",
+ "f=10**3 #Frequency in Hertz\n",
+ "C=3*10**-8 #Capacitance in Farad\n",
+ "V=10 #Voltage\n",
+ "\n",
+ "#Calculation \n",
+ "Xc=1/(2*math.pi*f*C) #Reactance\n",
+ "a=((10**4)**2)+(5.3*10**3)**2\n",
+ "I=math.sqrt((V**2)/a) #Current in Amp\n",
+ "Vr=I*R #Voltage\n",
+ "Vc=Xc*I #Voltage\n",
+ "phi=math.atan(Vc/Vr) #Phase Angle in radians\n",
+ "\n",
+ "#Result\n",
+ "print'(a) Current, I = %d uA'%round(I*10**6)\n",
+ "print'(b) V = %.2f V'%(-phi*180/math.pi) #phase angle in degree"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15.7, Page 317"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 49,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Z = 200 + j 62 Ohms\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "I=5 #sinusoidal Current\n",
+ "R=200 #Resistance in Ohm\n",
+ "f=50 #Frequency in Hertz\n",
+ "L=400*10**-3 #Inductancec in Henry\n",
+ "C=50*10**-6 #Capacitance in Henry \n",
+ "\n",
+ "#Calculation \n",
+ "Vr=I*R #Voltage across resistor\n",
+ "Xl=2*math.pi*f*L #Reactance\n",
+ "Xc=1/(2*math.pi*f*C) #Reactance\n",
+ "i=Xl-Xc\n",
+ "\n",
+ "#Result\n",
+ "print'Z = %d + j %d Ohms'%(R,i)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15.8, Page 320"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "vo = 12.4 < 29.7\n",
+ "Therefore\n",
+ "vo = 12.4 sin(500 t + 29.7)\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "from numpy import ones\n",
+ "\n",
+ "#Initialisation\n",
+ "R1=5 #Resistance in Ohm\n",
+ "R2=50 #Resistance in Ohm\n",
+ "w=500 #rad/s\n",
+ "L=50*10**-3 #Inductancec in Henry\n",
+ "C=200*10**-6 #Capacitance in Henry \n",
+ "v=10\n",
+ "\n",
+ "#Calculation\n",
+ "Xc=1/(w*C) #Reactance\n",
+ "Z1=complex(R1,-Xc) #taking in complex form\n",
+ "a=(R2*w**2*L**2)/(R2**2+(w**2*L**2))\n",
+ "b=(R2**2*w*L)/(R2**2+(w**2*L**2))\n",
+ "Z2=complex(a,b) #taking in complex form\n",
+ "Z3=(Z1+Z2)\n",
+ "Z=Z2/Z3\n",
+ "r=math.sqrt((Z.real)**2 + (Z.imag)**2) #converting in polar (absolute)\n",
+ "r1=v*r \n",
+ "phi=math.atan(Z.imag/Z.real) #converting in polar (phase)\n",
+ "\n",
+ "#Result\n",
+ "print'vo = %.1f < %.1f'%(r1,(phi*180/math.pi))\n",
+ "print'Therefore'\n",
+ "print'vo = %.1f sin(%d t + %.1f)'%(r1,w,(phi*180/math.pi))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter16.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter16.ipynb
new file mode 100644
index 00000000..7a471548
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter16.ipynb
@@ -0,0 +1,215 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 16: Power in AC Circuits"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 16.1, Page 329"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) Apparent power, S = 250 VA\n",
+ "(b) Power Factor = 0.866\n",
+ "(c) Active Power, P = 216.5\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "V=50 #Voltage\n",
+ "I=5 #Current in Ampere r.m.s\n",
+ "phase=30 #in degrees\n",
+ "\n",
+ "#Calculation \n",
+ "S=V*I #apparent power\n",
+ "pf=math.cos(phase*math.pi/180) #power factor\n",
+ "apf=S*pf #active power\n",
+ "\n",
+ "#Result\n",
+ "print'(a) Apparent power, S = %d VA'%S\n",
+ "print'(b) Power Factor = %.3f'%pf\n",
+ "print'(c) Active Power, P = %.1f'%apf"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 16.2, Page 331"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Apparent Power, P = 2000 W\n",
+ " Active Power, P = 1500 W\n",
+ " Reactive Power, Q = 1322 var\n",
+ " Current I = 8.33 A\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "pf=0.75 #power factor\n",
+ "S=2000 #apparent power in VA\n",
+ "V=240 #Voltage in volts\n",
+ "\n",
+ "#Calculation \n",
+ "apf=S*pf #active power\n",
+ "sin=math.sqrt(1-(pf**2)) \n",
+ "Q=S*sin #Reactive Power\n",
+ "I=S*V**-1 #Current\n",
+ "#Result\n",
+ "print' Apparent Power, P = %d W'%S\n",
+ "print' Active Power, P = %d W'%apf\n",
+ "print' Reactive Power, Q = %d var'%Q\n",
+ "print' Current I = %.2f A'%I"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 16.3, Page 333"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Apparent Power, S = 1500 W\n",
+ " Active Power, P = 1500 W\n",
+ " Reactive Power, Q = 1322 var\n",
+ " Current I = 6.25 A\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "pf=0.75 #power factor\n",
+ "S=1500 #apparent power in W\n",
+ "V=240 #Voltage in volts\n",
+ "P1 = 2000 #apparent power\n",
+ "P2 = 1500 #active power\n",
+ "Q = 1322 #reactive power\n",
+ "I = 8.33 #current in amp\n",
+ "f=50 #frequency in hertz\n",
+ "\n",
+ "#Calculation \n",
+ "Xc=V**2/Q #reactive capacitance\n",
+ "C=1/(Xc*2*math.pi*f) #capacitance\n",
+ "I=S*V**-1 #current\n",
+ "\n",
+ "#Result\n",
+ "print' Apparent Power, S = %d W'%S\n",
+ "print' Active Power, P = %d W'%apf\n",
+ "print' Reactive Power, Q = %d var'%Q\n",
+ "print' Current I = %.2f A'%I"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 16.4, Page 335"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Zl = (50+20j)\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "import numpy as np\n",
+ "\n",
+ "#Initialisation\n",
+ "Zo=complex(50,-20) #complex form of output impedance\n",
+ "\n",
+ "#Calculation \n",
+ "Zl=np.conjugate(Zo) #complex form of Load impedance\n",
+ "\n",
+ "#Result\n",
+ "print'Zl = %s'%Zl"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter18.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter18.ipynb
new file mode 100644
index 00000000..b24f0f02
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter18.ipynb
@@ -0,0 +1,158 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 18: Transient Behaviour"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.1, Page 376"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "v = 18.36 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "c=100*10**-6 #capacitance in farad\n",
+ "r=100*10**3 #resistance in ohm\n",
+ "v=20 #volt\n",
+ "t=25 #time in seconds\n",
+ "e=2.71828 #mathematical constant\n",
+ "\n",
+ "#Calculation\n",
+ "T=c*r #time in seconds\n",
+ "v1=v*(1-e**(-t*T**-1)) #volt\n",
+ "\n",
+ "#Result\n",
+ "print'v = %.2f V'%v1\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.2, Page 378"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "t = 10.2 mSec\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Initialisation\n",
+ "l=400*10**-3 #inductance in henry\n",
+ "i1=300 #current in milliamp\n",
+ "r=20 #resistance in ohm\n",
+ "v=15 #volt\n",
+ "t=25 #time in seconds\n",
+ "e=2.71828 #mathematical constant\n",
+ "\n",
+ "#Calculation\n",
+ "T=l/r #time in seconds\n",
+ "i=(v*r**-1)*10**3 #current in amp\n",
+ "t=((math.log(i/(i-i1)))/(math.log(e)))*0.02 #expression to find time t\n",
+ "\n",
+ "#Result\n",
+ "print't = %.1f mSec'%(t*10**3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18.3, Page 382"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "v = 10 - 5 e^( -t/0.2 ) V\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "c=20*10**-6 #capacitance in farad\n",
+ "r=10*10**3 #resistance in ohm\n",
+ "v=5 #volt\n",
+ "v2=10 #volt\n",
+ "\n",
+ "#Calculation\n",
+ "T=c*r #time in seconds\n",
+ "\n",
+ "#Result\n",
+ "print'v = %d - %d e^( -t/%.1f ) V'%(v2,v,T)"
+ ]
+ },
+ {
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter19.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter19.ipynb
new file mode 100644
index 00000000..b87fa7b1
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter19.ipynb
@@ -0,0 +1,113 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 19: Semiconductor Diodes"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 19.1, Page 392"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Peak Ripple Voltage = 0.4 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Introduction\n",
+ "i=0.2 #current in amp\n",
+ "C=0.01 #Capacitance in farad\n",
+ "t=20*10**-3 #time in sec\n",
+ "\n",
+ "#Calculation\n",
+ "dv=i/C #change in voltage w.r.t time\n",
+ "v=dv*t #peak ripple voltage\n",
+ "\n",
+ "#Result\n",
+ "print'Peak Ripple Voltage = %.1f V'%v\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 19.2, Page 406"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Peak Ripple Voltage = 0.2 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Introduction\n",
+ "i=0.2 #current in amp\n",
+ "C=0.01 #Capacitance in farad\n",
+ "t=10*10**-3 #time in sec\n",
+ "\n",
+ "#Calculation\n",
+ "dv=i/C #change in voltage w.r.t time\n",
+ "v=dv*t #peak ripple voltage\n",
+ "\n",
+ "#Result\n",
+ "print'Peak Ripple Voltage = %.1f V'%v\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter2.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter2.ipynb
new file mode 100644
index 00000000..8bc25886
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter2.ipynb
@@ -0,0 +1,363 @@
+{
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter20.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter20.ipynb
new file mode 100644
index 00000000..960e2bde
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter20.ipynb
@@ -0,0 +1,121 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 20: Field-effect Transistors"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 20.1, Page"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Small signal voltage gain = -4 \n",
+ "Low frequency cut off = 0.16 Hz\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Introduction\n",
+ "gm=2*10**-3\n",
+ "rd=2*10**3 #resistance in ohm\n",
+ "C=10**-6 #capacitance in farad\n",
+ "R=10**6 #resistance in ohm\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "G=-gm*rd #Small signal voltage gain\n",
+ "fc=1/(2*math.pi*C*R) #frequency in Hz\n",
+ "\n",
+ "#Result\n",
+ "print'Small signal voltage gain = %d '%G\n",
+ "print'Low frequency cut off = %.2f Hz'%fc"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 20.2, Page"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Rd = 0.67 kOhm\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Introduction\n",
+ "idd=4*10**-3 #current in ampere\n",
+ "vo=8 #voltage\n",
+ "vdd=12 #voltage\n",
+ "\n",
+ "#Calculation\n",
+ "Rd=vo*(vdd-idd)**-1\n",
+ "\n",
+ "#Result\n",
+ "print'Rd = %.2f kOhm'%Rd #wrong answer in textbook"
+ ]
+ },
+ {
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter21.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter21.ipynb
new file mode 100644
index 00000000..6d1b753b
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter21.ipynb
@@ -0,0 +1,241 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 21: Bipolar Transistors"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 21.1, Page 445"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Output Current, I = 2.04 mA\n",
+ "Output Voltage, V = 4.5 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "vcc=10 #voltage\n",
+ "vbe=0.7 #voltage, base-to-emitter junction\n",
+ "rb=910*10**3 #resistance in ohm\n",
+ "hfe=200\n",
+ "rc=2.7*10**3 #resistance in ohm\n",
+ "\n",
+ "#Calculation\n",
+ "ib=(vcc-vbe)/rb #base current in ampere\n",
+ "ic=hfe*ib #collector in current in ampere\n",
+ "vo=vcc-(ic*rc) #output voltage\n",
+ "\n",
+ "#Result\n",
+ "print'Output Current, I = %.2f mA'%(ic*10**3)\n",
+ "print'Output Voltage, V = %.1f V'%vo"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 21.2, Page 445"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Quiescent Output Voltage, V = 5.6 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "vcc=10 #voltage\n",
+ "r2=10*10**3 #resistance in ohm\n",
+ "r1=27*10**3 #resistance in ohm\n",
+ "vbe=0.7 #voltage, base-to-emitter junction\n",
+ "re=10**3 #resistance in ohm\n",
+ "rc=2.2*10**3 #resistance in ohm\n",
+ "\n",
+ "#Calculation\n",
+ "vb=vcc*(r2*(r1+r2)**-1) # base voltage\n",
+ "ve=vb-vbe #emitter voltage\n",
+ "ie=ve/re #emitter current\n",
+ "ic=ie #collector current\n",
+ "vo=vcc-(ic*rc) #output voltage\n",
+ "\n",
+ "#Result\n",
+ "print'Quiescent Output Voltage, V = %.1f V'%vo\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 21.3, Page 448"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage Gain = -2.2 mA\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "re=10**3 #resistance in ohm\n",
+ "rc=2.2*10**3 #resistance in ohm\n",
+ "\n",
+ "#Calculation\n",
+ "gain=-rc/re #voltage gain\n",
+ "\n",
+ "#Result\n",
+ "print'Voltage Gain = %.1f mA'%gain\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 21.4, Page 451"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage Gain = 64 Hz\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "r1=15*10**3 #resistance in ohm\n",
+ "r2=47*10**3 #resistance in ohm\n",
+ "C=220*10**-9 #capacitance in farad\n",
+ "\n",
+ "#Calculation\n",
+ "ri=(r1*r2)/(r1+r2) #resistance in paraller\n",
+ "fco=1/(2*math.pi*C*ri) #frequency in Hz\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print'Voltage Gain = %d Hz'%round(fco)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 21.5, Page 453"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Quiescent Output Voltage, V = 2.0 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "vcc=10 #voltage\n",
+ "r2=10*10**3 #resistance in ohm\n",
+ "r1=27*10**3 #resistance in ohm\n",
+ "vbe=0.7 #voltage, base-to-emitter junction\n",
+ "re=10**3 #resistance in ohm\n",
+ "rc=2.2*10**3 #resistance in ohm\n",
+ "\n",
+ "#Calculation\n",
+ "vb=vcc*(r2*(r1+r2)**-1) # base voltage\n",
+ "ve=vb-vbe #emitter voltage\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print'Quiescent Output Voltage, V = %.1f V'%ve\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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter22.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter22.ipynb
new file mode 100644
index 00000000..b477d5ec
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter22.ipynb
@@ -0,0 +1,123 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 22: Power Electronics"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 22.1, Page 475"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Output Voltage, V = 12.0 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "vz=4.7 #voltage\n",
+ "r3=1.222*10**3 #resistance in ohm\n",
+ "r4=10**3 #resistance in ohm\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "Vo=(vz+0.7)*((r3+r4)*r4**-1) #output voltage\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print' Output Voltage, V = %.1f V'%Vo\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 22.2, Page 476"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Power delivered to the load, P = 5 W\n",
+ "Power dissipated in the output transistor, P = 10 W\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialization\n",
+ "vo=10 #voltage\n",
+ "rl=5 #resistance in ohm\n",
+ "vi=15 #voltage\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "io=vo*rl**-1 #current in ampere\n",
+ "po=vo*io**-1 #power delivered to the load in watt\n",
+ "pt=(vi-vo)*io #power dissipated in the output transistor in watt\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print'Power delivered to the load, P = %d W'%po\n",
+ "print'Power dissipated in the output transistor, P = %d W'%pt\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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter23.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter23.ipynb
new file mode 100644
index 00000000..e17dafb8
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter23.ipynb
@@ -0,0 +1,151 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 23: Electric Motors and Generators"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 23.1, Page 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Sinusoidal Voltage with Peak value = 8.4 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "#initialization\n",
+ "n=100 #no of turns\n",
+ "b=400*10**-3 #magnetic field\n",
+ "a=20*10**-4 #area in cm^2\n",
+ "w=105 #angular frequency\n",
+ "\n",
+ "#calculation\n",
+ "v=n*b*a*w #voltage\n",
+ "\n",
+ "#result\n",
+ "print'Sinusoidal Voltage with Peak value = %.1f V'%v"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 23.2, Page 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Rotation Speed = 1800 rpm\n"
+ ]
+ }
+ ],
+ "source": [
+ "#initialization\n",
+ "f=60 #frequency in Hz\n",
+ "a=60 #seconds\n",
+ "\n",
+ "#calculation\n",
+ "f1=f/2 #required rotation speed\n",
+ "f2=f1*a #equivalent rotation speed\n",
+ "\n",
+ "\n",
+ "#result\n",
+ "print'Rotation Speed = %d rpm'%f2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 23.3, Page 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Rotation Speed = 12000 rpm\n"
+ ]
+ }
+ ],
+ "source": [
+ "#initialization\n",
+ "f=50 #frequency in Hz\n",
+ "p=4 #four times magnetic field for 8 pole motor\n",
+ "a=60 #seconds\n",
+ "\n",
+ "#calculation\n",
+ "f1=f*p #required rotation speed\n",
+ "f2=f1*a #equivalent rotation speed\n",
+ "\n",
+ "\n",
+ "#result\n",
+ "print'Rotation Speed = %d rpm'%f2"
+ ]
+ },
+ {
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter5.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter5.ipynb
new file mode 100644
index 00000000..55d66248
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter5.ipynb
@@ -0,0 +1,253 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 5: Signals and Data Transmission"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.1, Page 71"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 66,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "An 8-bit word can take 2^8 = 256 values\n",
+ "\n",
+ "An 16-bit word can take 2^16 = 65536 values\n",
+ "\n",
+ "An 32-bit word can take 2^32 = 4.000000 x 10^9 values\n",
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "n=8 #8 bit\n",
+ "n2=16 #16 bit\n",
+ "n3=32 #32 bit\n",
+ "\n",
+ "#Calculation\n",
+ "c=2**n #value for 8 bit\n",
+ "c2=2**n2 #value for 16 bit\n",
+ "c3=2**n3 #value for 32 bit\n",
+ "\n",
+ "#Result\n",
+ "print'An 8-bit word can take 2^8 = %d values\\n'%c\n",
+ "print'An 16-bit word can take 2^16 = %d values\\n'%c2\n",
+ "print'An 32-bit word can take 2^32 = %f x 10^9 values\\n'%(c3/10**9)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.2, Page 71"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 67,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "An 8-bit word resolution = 0.39 percent\n",
+ "\n",
+ "An 16-bit word resolution = 0.0015 percent\n",
+ "\n",
+ "An 32-bit word resolution = 0.000000023 percent\n",
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "n=8 #8 bit\n",
+ "n2=16 #16 bit\n",
+ "n3=32 #32 bit\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "c=2**n #value for 8 bit\n",
+ "p=(1*c**-1)*100 #percent\n",
+ "c2=2**n2 #value for 16 bit\n",
+ "p2=(1*c2**-1)*100 #percent\n",
+ "c3=2**n3 #value for 32 bit\n",
+ "p3=(1*c3**-1)*100 #percent\n",
+ "\n",
+ "#Result\n",
+ "print'An 8-bit word resolution = %.2f percent\\n'%p\n",
+ "print'An 16-bit word resolution = %.4f percent\\n'%p2\n",
+ "print'An 32-bit word resolution = %.9f percent\\n'%p3"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.3, Page 73"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 64,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEZCAYAAACNebLAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAG4pJREFUeJzt3X2UXXV97/H3J4RHUxhFGyGQzDINZqHQATSEgs1YCybI\ng7flQaqFgduWpahUdClFbS7qur3Lem2gQBEEQlAKiEpQoMUKU5CHoAlzSZHwUAiEKPEBQoBQGuB7\n/9h7wuZkn5kzk73n/GbO57XWWZy99+/s8z0/fjnfs3/fvfcoIjAzM2s0qd0BmJlZmpwgzMyslBOE\nmZmVcoIwM7NSThBmZlbKCcLMzEo5QZiZWSknCKuUpNWSNkraIOm5/L9vbXdc7SDpaEn3Slov6VeS\n/k3SjJrf81VJb6vzPaxzTG53ADbhBPCBiLh1qEaStomIV8YopjEnaSZwOfDBiOiX9AbgMKDuzzzk\nla8Tvd+tWj6CsDpoixXSjPzX7SmSHgd+nK+fK+kOSc/kv7b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fSQdmy/vnO9rE3BP/oWLpAGgG9gA/CIiVsDmP9SC\npGuBL0r6DHAKsLiF974hIl4GfitpHdmX/C8a2mxHdtR0WkTcXlj/SLGfikdR+fLBwF+Q/RU3s5Y5\nQdh49ELhuYC/i4iLiw0knT7E61/mtenVHRr29YmI+FHDvuYBLxVWvcJr/3a2mN6JiBcl/Qj4IHAs\ncMAQsQwq7v9Vyv9tvkxWt5gP3F6yfQuSdgMuBo4cvH22Watcg7CUtfInJ/8VOEXSGwAk7S7pLcBt\nwAclbS/pd4AjC69ZDbwrf35sw74+lt9XH0mzJO00xHs/CLxV0gF5+ymSBv9NXQKcS3bk8WyzHYxQ\nkB2RzJb02cL6ZjWIycA1wOci4j8risE6iI8gLGXDnp0TET+SNBu4KytB8BzwkYi4V9I1wH3AOuCe\nwsu+BlyTF6FvKKz/JtnU0Yq8nvErsqOA0rgiYpOk44HzJO1IVvf4Y7KpsRWSNgCXjeQDF/df/nEj\nJJ0ALM33f9MQ7f+A7OjlbElfytsdHhFPjSIm60C+3bd1hHxe/rmI+PoYvd/uwC0RMXss3s+sDp5i\nMquYpD8H7iL7gy1m45aPIMzMrJSPIMzMrJQThJmZlXKCMDOzUk4QZmZWygnCzMxKOUGYmVmp/w9Q\n8qp7rMXCBAAAAABJRU5ErkJggg==\n",
+ "text/plain": [
+ "<matplotlib.figure.Figure at 0x8ee1f60>"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "#data\n",
+ "x = np.linspace(0, 3, 1)\n",
+ "y=2\n",
+ "\n",
+ "#plotting\n",
+ "\n",
+ "plt.bar(1, y, 0.001*max(x))\n",
+ "\n",
+ "\n",
+ "xlabel(\"Frequency in kHz\")\n",
+ "ylabel(\"Voltage\")\n",
+ "title(\"Frequency Spectrum\")\n",
+ "plt.axis([0, 2, 0, 3])\n",
+ "plt.grid()\n",
+ "plt.show()\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.4, Page 73"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 65,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEZCAYAAACNebLAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAG21JREFUeJzt3Xu0ZGV55/HvD9oLymB7G0SQ7hWCslBJK4oYdLqNUcGo\nOImIjgZbJwnL+0RdalDT42UlaxnHIFFjULSBSLwrKJJolBPwBgr0QBRQglxVvCByaYZweeaP2t0U\nxT7n1Dm965zd53w/a9Wi9t5v7XrqZXc99b7P3vukqpAkadQOix2AJKmfTBCSpFYmCElSKxOEJKmV\nCUKS1MoEIUlqZYKQJLUyQahTSS5LsjnJ9UluaP77kMWOazEkOTTJeUmuS/LzJP+aZNWE3/OOJL81\nyffQ8rFisQPQklPAH1TV6TM1SrJjVd2+QDEtuCR7AccDz62qqST3BZ4OTPozz3jl61Lvd3XLEYQm\nIXdbkaxqft2+LMnlwNea9Qcm+WaSXze/ttcOvWZ1kqkkv0nyL0n+LsmJzba1Sa4ceY8fJ/m95nmS\nvDnJJUl+keQTSVaOxHJEksubX/dHDe1nhyRHNa+9Psl3k+ye5P1J3jPynicneW1LH6wBLq2qKYCq\nuqmqPl9VVzWv25Dk001c1yf5XpL9hva7W5LPNLH9R5JXzxLfHkn+ren785v1h23ppyRvTPJT4KNJ\nXpLkzJHPsXXkkeRjST6Q5MvNKPDMJLsm+dsk1yb5QZLfmfb/vpYME4QW2n8D9gGekeShwJeAd1TV\n/YE3AJ9N8sCm7UnAd4EHAe8CXsJdfyHP9Gv5NcBzgCcDDwV+DXxwpM1BwN7A7wN/meQRzfrXA4cD\nB1fVLsDLgM0MRgQv2PLiJs6nAh9vef9zgX2SvDfJumYEMeo5wCeB+wP/BHwhyY5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HA+9PshODusfvM5gaOzfJ9cDH5vKBh/ff/nGrkrwQOLnZ/2kztP9dBqOXtyd5R9PumVX1\ns3nEpGXI231rWWjm5W+oqvcu0Ps9FPh6Ve2zEO8nTYJTTFLHkvwx8G0Gf7BF2m45gpAktXIEIUlq\nZYKQJLUyQUiSWpkgJEmtTBCSpFYmCElSq/8PK/+gYIz8oXAAAAAASUVORK5CYII=\n",
+ "text/plain": [
+ "<matplotlib.figure.Figure at 0x8b6bd30>"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "#data\n",
+ "x = np.linspace(0, 3, 1)\n",
+ "y=2\n",
+ "y1=1\n",
+ "\n",
+ "#plotting\n",
+ "plt.bar(1, y, 0.001*max(x))\n",
+ "plt.bar(1.5, y1, 0.001*max(x))\n",
+ "\n",
+ "\n",
+ "xlabel(\"Frequency in kHz\")\n",
+ "ylabel(\"Voltage\")\n",
+ "title(\"Frequency Spectrum\")\n",
+ "plt.axis([0, 2, 0, 3])\n",
+ "plt.grid()\n",
+ "plt.show()\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.5, Page 74"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 68,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Bandwidth = 7.0 kHz\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "f1=7000 #Human Speech Frequency Upper limit in HZ\n",
+ "f2=50 #Human Speech Frequency Lower limit in Hz\n",
+ "\n",
+ "#Calculation\n",
+ "B=f1-f2 #Bandwidth in Hz\n",
+ "\n",
+ "#Result\n",
+ "print'Bandwidth = %.1f kHz'%(B*1000**-1)"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter6.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter6.ipynb
new file mode 100644
index 00000000..4bcd3580
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter6.ipynb
@@ -0,0 +1,261 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 6: Amplification"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.1, Page 92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Ouput voltage of and amplifier = 15.2 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "Ri=1000 #Input Resistance of amplifier in Ohm\n",
+ "Rs=100 #Output Resistance of sensor in Ohm\n",
+ "Rl=50 #Load Resistance\n",
+ "Ro=10 #Output Resistance of amplifier in Ohm\n",
+ "Av=10 #Voltage gain\n",
+ "Vs=2 #Sensor voltage\n",
+ "\n",
+ "#Calculation\n",
+ "Vi=Ri*Vs*(Rs+Ri)**-1 #Input Voltage of Amplifier\n",
+ "Vo=Av*Vi*Rl*(Ro+Rl)**-1 #Output Voltage of Amplifier\n",
+ "\n",
+ "#Result\n",
+ "print'Ouput voltage of and amplifier = %.1f V'%Vo\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.2, Page 93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage Gain, Av = 8.35\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "Vo=15.2 #Output Voltage of Amplifier\n",
+ "Vi=1.82 #Input Voltage of Amplifier\n",
+ "\n",
+ "#Calculation\n",
+ "Av=Vo/Vi #Voltage gain\n",
+ "\n",
+ "#Result\n",
+ "print'Voltage Gain, Av = %.2f'%Av\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.3, Page 94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Ouput voltage of and amplifier = 20.0 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "Av=10 #Voltage gain\n",
+ "Vi=2 #Input Voltage of Amplifier\n",
+ "Rl=50 #Load Resistance\n",
+ "Ro=0 #Output Resistance of amplifier in Ohm\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "Vo=Av*Vi*Rl/(Ro+Rl) #Output Voltage of Amplifier\n",
+ "\n",
+ "#Result\n",
+ "print'Ouput voltage of and amplifier = %.1f V'%Vo\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.4, Page 96"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Output Power, Po = 4.6 W\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "Vo=15.2 #Output Voltage\n",
+ "Rl=50 #Load Resistance\n",
+ "\n",
+ "#Calculation \n",
+ "Po=(Vo**2)/Rl #Output Power\n",
+ "\n",
+ "#Result\n",
+ "print'Output Power, Po = %.1f W'%Po"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.5, Page 98"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Power Gain, Ap = 1395\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "Vi=1.82 #Input Voltage of Amplifier\n",
+ "Ri=1000 #Input Resistance of amplifier in Ohm\n",
+ "Vo=15.2 #Output Voltage of Amplifier\n",
+ "Rl=50 #Load Resistance\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "Pi=(Vi**2)*Ri**-1 #Input Power in Watt\n",
+ "Po=(Vo**2)*Rl**-1 #Output Power in Watt\n",
+ "Ap=Po/Pi #Power Gain\n",
+ " \n",
+ "\n",
+ "#Result\n",
+ "print'Power Gain, Ap = %d'%Ap #wrong answer in textbook \n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.6, Page 99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Power Gain (dB) = 31.5 dB\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Initialisation\n",
+ "P=1400 #Power gain\n",
+ "\n",
+ "#Calculation\n",
+ "pdb=10*math.log10(P) #Power Gain in dB\n",
+ "\n",
+ "#Result\n",
+ "print'Power Gain (dB) = %.1f dB'%pdb\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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter8.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter8.ipynb
new file mode 100644
index 00000000..bc1fdb59
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter8.ipynb
@@ -0,0 +1,175 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 8: Operational Amplifier"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8.3, Page 148"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Gain = 50\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "f=20*10**3 #bandwidth frequency in KHz\n",
+ "\n",
+ "#Calculation\n",
+ "gain=(10**6)/(f) #gain\n",
+ "\n",
+ "#Result\n",
+ "print'Gain = %d'%gain"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8.4, Page 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false,
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Output Resistance = 7.5 mOhm\n",
+ "\n",
+ "Input Resistance = 20 GOhm\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "og=2*10**5 #Open Loop Gain\n",
+ "cg=20 #Closed Loop Gain\n",
+ "or1=75 #Output Resistance\n",
+ "ir1=2*10**6 #Input Resistance\n",
+ "\n",
+ "#Calculation\n",
+ "ab=og*cg**-1 #factor (1+AB)\n",
+ "or2=or1/ab #Output Resistance\n",
+ "ir2=ir1*ab #Input Resistance\n",
+ "\n",
+ "#Result\n",
+ "print'Output Resistance = %.1f mOhm\\n'%(or2*1000)\n",
+ "print'Input Resistance = %d GOhm'%(ir2*10**-9)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8.5, Page 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Output Resistance = 7.5 mOhm\n",
+ "\n",
+ "Input Resistance = 1 KOhm\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "og=2*10**5 #Open Loop Gain\n",
+ "cg=20 #Closed Loop Gain\n",
+ "or1=75 #Output Resistance\n",
+ "ir1=2*10**6 #Input Resistance\n",
+ "r1=20*10**3 #Resistnce in Ohm\n",
+ "r2=10**3 #Resistnce in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "ab=og*cg**-1 #factor (1+AB)\n",
+ "or2=or1*ab**-1 #Output Resistance\n",
+ "#the input is connected to a virtual earth point by the resistance R2, \n",
+ "#so the input resistance is equal to R 2 ,\n",
+ "ir2=r2 #Input Resistance\n",
+ "\n",
+ "#Result\n",
+ "print'Output Resistance = %.1f mOhm\\n'%(or2*1000)\n",
+ "print'Input Resistance = %d KOhm'%(ir2*10**-3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8.6, Page 151"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Output Resistance = 375 uOhm\n",
+ "\n",
+ "Input Resistance = 400 GOhm\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialisation\n",
+ "og=2*10**5 #Open Loop Gain\n",
+ "cg=1 #Closed Loop Gain\n",
+ "or1=75 #Output Resistance\n",
+ "ir1=2*10**6 #Input Resistance\n",
+ "\n",
+ "#Calculation\n",
+ "ab=og*cg**-1 #factor (1+AB)\n",
+ "or2=or1*ab**-1 #Output Resistance\n",
+ "ir2=ir1*ab #Input Resistance\n",
+ "\n",
+ "#Result\n",
+ "print'Output Resistance = %d uOhm\\n'%(or2*10**6) #wrong answer in the textbook\n",
+ "print'Input Resistance = %d GOhm'%(ir2*10**-9)"
+ ]
+ }
+ ],
+ "metadata": {},
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter9.ipynb b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter9.ipynb
new file mode 100644
index 00000000..489ec875
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/Chapter9.ipynb
@@ -0,0 +1,418 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 9: Digital Electronics"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9.8, Page 176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Decimal Equivalent = 26.000000\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialization\n",
+ "ni1=11010 #binary number\n",
+ "\n",
+ "#Calculation\n",
+ "def binary_decimal(ni): # Function to convert binary to decimal\n",
+ " deci = 0;\n",
+ " i = 0;\n",
+ " while (ni != 0):\n",
+ " rem = ni-int(ni/10.)*10\n",
+ " ni = int(ni/10.);\n",
+ " deci = deci + rem*2**i;\n",
+ " i = i + 1;\n",
+ " return deci\n",
+ "\n",
+ "w=binary_decimal(ni1) #calling the function\n",
+ "\n",
+ "#Declaration\n",
+ "print'Decimal Equivalent = %f'%w"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9.9, Page 176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Binary Equivalent = 11010\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialization\n",
+ "ni1=26 #Decimal number\n",
+ "\n",
+ "#Calculation\n",
+ "def decimal_binary(ni): # Function to convert decimal to binary\n",
+ " bini = 0;\n",
+ " i = 1;\n",
+ " while (ni != 0):\n",
+ " rem = ni-int(ni/2)*2; \n",
+ " ni = int(ni/2);\n",
+ " bini = bini + rem*i;\n",
+ " i = i * 10;\n",
+ " return bini\n",
+ "\n",
+ "w=decimal_binary(ni1) #calling the function\n",
+ "\n",
+ "#Declaration\n",
+ "print'Binary Equivalent = %d'%w"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9.10, Page 177"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Decimal equivalent of 34.6875 = 100010.1011\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initializaton\n",
+ "\n",
+ "no=34.6875 #decimal number\n",
+ "n_int = int(no); # Extract the integral part\n",
+ "n_frac = no-n_int; # Extract the fractional part\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "def decimal_binary(ni): # Function to convert decimal to binary\n",
+ " bini = 0;\n",
+ " i = 1;\n",
+ " while (ni != 0):\n",
+ " rem = ni-int(ni/2)*2; \n",
+ " ni = int(ni/2);\n",
+ " bini = bini + rem*i;\n",
+ " i = i * 10;\n",
+ " return bini\n",
+ "\n",
+ "def decifrac_binfrac(nf): # Function to convert binary fraction to decimal fraction\n",
+ " binf = 0; i = 0.1;\n",
+ " while (nf != 0):\n",
+ " nf = nf*2;\n",
+ " rem = int(nf); \n",
+ " nf = nf-rem;\n",
+ " binf = binf + rem*i;\n",
+ " i = i/10;\n",
+ " return binf\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print \"Decimal equivalent of 34.6875 = %.4f\"%(decimal_binary(n_int)+decifrac_binfrac(n_frac))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9.11, Page 177"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "W = 40979\n"
+ ]
+ }
+ ],
+ "source": [
+ "#initialization\n",
+ "n='A013' #Hex number \n",
+ "\n",
+ "#Calculation\n",
+ "w=int(n, 16) #Hex to Decimal Coversion\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print'W = %d'%w"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9.12, Page 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The hexadecimal equivalent of 7046 is 0x1b86\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "#Variable declaration\n",
+ "n=7046 #Hex number \n",
+ "\n",
+ "#Calculations\n",
+ "h = hex(n) #decimal to hex conversion\n",
+ "\n",
+ "#Result\n",
+ "print \"The hexadecimal equivalent of 7046 is\",h"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9.13, Page 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Decimal equivalent of 34.6875 = 1111100001010001\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initializaton\n",
+ "\n",
+ "n='f851' #Hex Number\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "w=int(n, 16) #Hex to Decimal Coversion\n",
+ "\n",
+ "def decimal_binary(ni): # Function to convert decimal to binary\n",
+ " bini = 0;\n",
+ " i = 1;\n",
+ " while (ni != 0):\n",
+ " rem = ni-int(ni/2)*2; \n",
+ " ni = int(ni/2);\n",
+ " bini = bini + rem*i;\n",
+ " i = i * 10;\n",
+ " return bini\n",
+ "\n",
+ "\n",
+ "w1=decimal_binary(w) #calling the function\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print \"Decimal equivalent of 34.6875 = %.d\"%(w1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9.14, Page 179"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The hexadecimal equivalent of 111011011000100 is 0x76c4\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Initialiation\n",
+ "ni1=111011011000100 #binary number\n",
+ "\n",
+ "#Calculation\n",
+ "def binary_decimal(ni): # Function to convert binary to decimal\n",
+ " deci = 0;\n",
+ " i = 0;\n",
+ " while (ni != 0):\n",
+ " rem = ni-int(ni/10.)*10\n",
+ " ni = int(ni/10.);\n",
+ " deci = deci + rem*2**i;\n",
+ " i = i + 1;\n",
+ " return deci\n",
+ "\n",
+ "w=binary_decimal(ni1) #calling the function\n",
+ "h = hex(w) #decimal to hex conversion\n",
+ "\n",
+ "#Result\n",
+ "print \"The hexadecimal equivalent of 111011011000100 is\",h"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "collapsed": false
+ },
+ "source": [
+ "## Example 9.15, Page 182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Eqivalent BCD of 72 = 1001010001010000\n"
+ ]
+ }
+ ],
+ "source": [
+ "#initialisation\n",
+ "x='9450' #decimal number to be convert\n",
+ "\n",
+ "#calculation\n",
+ "digits = [int(c) for c in x]\n",
+ "zero_padded_BCD_digits = [format(d, '04b') for d in digits]\n",
+ "\n",
+ "#results\n",
+ "print \"Eqivalent BCD of 72 = \",\n",
+ "print ''.join(zero_padded_BCD_digits)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9.16, Page 182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The equivalent decimal =3876.\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "#Initialisation\n",
+ "BCD=\"0011 1000 0111 0110\" #Given BCD string\n",
+ "BCD_split=BCD.split(\" \"); #Splitting th binary string into individual BCD \n",
+ "d=0;\n",
+ "for i in range(len(BCD_split),0,-1):\n",
+ " d+=int(BCD_split[len(BCD_split)-i],2)*10**(i-1);\n",
+ "\n",
+ "#Result\n",
+ "print(\"The equivalent decimal = %d.\"%d);\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "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
+}
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/cap1.png b/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/cap1.png
new file mode 100644
index 00000000..30eb3a12
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/cap1.png
Binary files differ
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index.png b/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index.png
new file mode 100644
index 00000000..1e4ff4d3
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index.png
Binary files differ
diff --git a/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index2.png b/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index2.png
new file mode 100644
index 00000000..8cdd1ca3
--- /dev/null
+++ b/Electrical_&_Electronic_Systems_by_Neil_Storey/screenshots/index2.png
Binary files differ
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10_oz6KtzL.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10_oz6KtzL.ipynb
new file mode 100644
index 00000000..24d02247
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10_oz6KtzL.ipynb
@@ -0,0 +1,128 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 10 - Bilinear forms"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 363 Example 10.4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a = [x1 x2]\n",
+ "b = [y1 y2]\n",
+ "f(a,b) = x1*y1 + x1*y2 + x2*y1 + x2*y2\n",
+ "so, f(a,b) = \n",
+ "[x1 x2] * |1 1| * |y1|\n",
+ " |1 1| |y2|\n",
+ "So the matrix of f in standard order basis B = {e1,e2} is:\n",
+ "[f]B = \n",
+ "[[1 1]\n",
+ " [1 1]]\n",
+ "P = \n",
+ "[[ 1 1]\n",
+ " [-1 1]]\n",
+ "Thus, [f]B = P*[f]B*P\n",
+ "[f]B = \n",
+ "[[ 1 -1]\n",
+ " [-1 1]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,transpose\n",
+ "print 'a = [x1 x2]'\n",
+ "print 'b = [y1 y2]'\n",
+ "print 'f(a,b) = x1*y1 + x1*y2 + x2*y1 + x2*y2'\n",
+ "print 'so, f(a,b) = '\n",
+ "print '[x1 x2] * |1 1| * |y1|'\n",
+ "print ' |1 1| |y2|'\n",
+ "print 'So the matrix of f in standard order basis B = {e1,e2} is:'\n",
+ "fb = array([[1, 1],[1, 1]])\n",
+ "print '[f]B = \\n',fb\n",
+ "P = array([[1 ,1],[-1, 1]])\n",
+ "print 'P = \\n',P\n",
+ "print 'Thus, [f]B'' = P''*[f]B*P'\n",
+ "fb1 = transpose(P) * fb * P\n",
+ "print '[f]B'' = \\n',fb1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 365 Example 10.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "n = 24.0\n",
+ "a = 100.0\n",
+ "b = 40.0\n",
+ "f(a,b) = 4000.0\n",
+ "f is non-degenerate billinear form on R**n.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import random,transpose\n",
+ "n = round(random.randint(2,90))\n",
+ "a = round(random.randint(1,n) * 10)#\n",
+ "b = round(random.randint(1,n) * 10)#\n",
+ "print 'n = ',n\n",
+ "print 'a = ',a\n",
+ "print 'b = ',b\n",
+ "f = a * transpose(b)\n",
+ "print 'f(a,b) = ',f\n",
+ "print 'f is non-degenerate billinear form on R**n.'\n",
+ "#end"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter1_Zz52w1c.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter1_Zz52w1c.ipynb
new file mode 100644
index 00000000..d1fed764
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter1_Zz52w1c.ipynb
@@ -0,0 +1,751 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 1 - Linear Equations"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 8 Example 1.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a=\n",
+ "[[ 2 -1 3 2]\n",
+ " [ 1 4 0 -1]\n",
+ " [ 2 6 -1 5]]\n",
+ "Applying row transformations:\n",
+ "R1 = R1-2*R2\n",
+ "a = \n",
+ "[[ 0 -9 3 4]\n",
+ " [ 1 4 0 -1]\n",
+ " [ 2 6 -1 5]]\n",
+ "R3 = R3-2*R2\n",
+ "a = \n",
+ "[[ 0 -9 3 4]\n",
+ " [ 1 4 0 -1]\n",
+ " [ 0 -2 -1 7]]\n",
+ "R3 = R3/-2\n",
+ "a = \n",
+ "[[ 0 -9 3 4]\n",
+ " [ 1 4 0 -1]\n",
+ " [ 0 1 0 -3]]\n",
+ "R2 = R2-4*R3\n",
+ "a = \n",
+ "[[ 0 -9 3 4]\n",
+ " [ 1 0 0 11]\n",
+ " [ 0 1 0 -3]]\n",
+ "R1 = R1+9*R3\n",
+ "a = \n",
+ "[[ 0 0 3 -23]\n",
+ " [ 1 0 0 11]\n",
+ " [ 0 1 0 -3]]\n",
+ "R1 = R1*2/15\n",
+ "a = \n",
+ "[[ 0 0 0 -4]\n",
+ " [ 1 0 0 11]\n",
+ " [ 0 1 0 -3]]\n",
+ "R2 = R2+2*R1\n",
+ "a = \n",
+ "[[ 0 0 0 -4]\n",
+ " [ 1 0 0 3]\n",
+ " [ 0 1 0 -3]]\n",
+ "R3 = R3-R1/2\n",
+ "a = \n",
+ "[[ 0 0 0 -4]\n",
+ " [ 1 0 0 3]\n",
+ " [ 0 1 0 -1]]\n",
+ "We get the system of equations as:\n",
+ "2*x1 - x2 + 3*x3 + 2*x4 = 0\n",
+ "x1 + 4*x2 - x4 = 0\n",
+ "2*x1 + 6* x2 - x3 + 5*x4 = 0\n",
+ "and\n",
+ "x2 - 5/3*x4 = 0 x1 + 17/3*x4 = 0 x3 - 11/3*x4 = 0\n",
+ "now by assigning any rational value c to x4 in system second, the solution is evaluated as:\n",
+ "(-17/3*c,5/3,11/3*c,c)\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "a = array([[2, -1, 3, 2],[1, 4, 0 ,-1],[2, 6, -1, 5]])\n",
+ "print 'a=\\n',a\n",
+ "print 'Applying row transformations:'\n",
+ "print 'R1 = R1-2*R2'\n",
+ "a[0,:] = a[0,:] - 2*a[1,:]#\n",
+ "print 'a = \\n',a\n",
+ "print 'R3 = R3-2*R2'\n",
+ "a[2,:] = a[2,:] - 2*a[1,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'R3 = R3/-2'\n",
+ "a[2,:] = -1.0/2*a[2,:]#\n",
+ "print 'a = \\n',a\n",
+ "print 'R2 = R2-4*R3'\n",
+ "a[1,:] = a[1,:] - 4*a[2,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'R1 = R1+9*R3'\n",
+ "a[0,:] = a[0,:] + 9*a[2,:]#\n",
+ "print 'a = \\n',a\n",
+ "print 'R1 = R1*2/15'\n",
+ "a[0,:] = a[0,:] * 2/15\n",
+ "print 'a = \\n',a\n",
+ "print 'R2 = R2+2*R1'\n",
+ "a[1,:] = a[1,:] + 2*a[0,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'R3 = R3-R1/2'\n",
+ "a[2,:] = a[2,:] - 1.0/2*a[0,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'We get the system of equations as:'\n",
+ "print '2*x1 - x2 + 3*x3 + 2*x4 = 0'\n",
+ "print 'x1 + 4*x2 - x4 = 0'\n",
+ "print '2*x1 + 6* x2 - x3 + 5*x4 = 0'\n",
+ "print 'and'\n",
+ "print 'x2 - 5/3*x4 = 0','x1 + 17/3*x4 = 0','x3 - 11/3*x4 = 0'\n",
+ "print 'now by assigning any rational value c to x4 in system second, the solution is evaluated as:'\n",
+ "print '(-17/3*c,5/3,11/3*c,c)'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 9 Example 1.6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a = \n",
+ "[[-1.+0.j 0.+1.j]\n",
+ " [ 0.-1.j 3.+0.j]\n",
+ " [ 1.+0.j 2.+0.j]]\n",
+ "Applying row transformations:\n",
+ "R1 = R1+R3 and R2 = R2 + i *R3\n",
+ "a = \n",
+ "[[ 0.+0.j 2.+1.j]\n",
+ " [ 0.+0.j 3.+2.j]\n",
+ " [ 1.+0.j 2.+0.j]]\n",
+ "R1 = R1 * (1/2+i)\n",
+ "a = \n",
+ "[[ 0.+0.j 1.+0.j]\n",
+ " [ 0.+0.j 3.+2.j]\n",
+ " [ 1.+0.j 2.+0.j]]\n",
+ "R2 = R2-R1*(3+2i) and R3 = R3 - 2 *R1\n",
+ "a = \n",
+ "[[ 0.+0.j 1.+0.j]\n",
+ " [ 0.+0.j 0.+0.j]\n",
+ " [ 1.+0.j 0.+0.j]]\n",
+ "Thus the system of equations is:\n",
+ "x1 + 2*x2 = 0 -i*x1 + 3*x2 = 0 -x1+i*x2 = 0\n",
+ "It has only trivial solution x1 = x2 = 0\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "a=array([[-1, 1J],[-1J, 3],[1 ,2]])\n",
+ "print 'a = \\n',a\n",
+ "print 'Applying row transformations:'\n",
+ "print 'R1 = R1+R3 and R2 = R2 + i *R3'\n",
+ "a[0,:] = a[0,:] +a[2,:]\n",
+ "a[1,:] = a[1,:] + 1J * a[2,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'R1 = R1 * (1/2+i)'\n",
+ "a[0,:] = 1.0/(2 + 1J) * a[0,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'R2 = R2-R1*(3+2i) and R3 = R3 - 2 *R1'\n",
+ "a[1,:] = (a[1,:] - (3 + 2 * 1J) * a[0,:])\n",
+ "a[2,:] = (a[2,:] - 2 * a[0,:])\n",
+ "print 'a = \\n',a\n",
+ "print 'Thus the system of equations is:'\n",
+ "print 'x1 + 2*x2 = 0','-i*x1 + 3*x2 = 0','-x1+i*x2 = 0'\n",
+ "print 'It has only trivial solution x1 = x2 = 0'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 9 Example 1.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[[ 1. 0. 0. 0. 0. 0. 0.]\n",
+ " [ 0. 1. 0. 0. 0. 0. 0.]\n",
+ " [ 0. 0. 1. 0. 0. 0. 0.]\n",
+ " [ 0. 0. 0. 1. 0. 0. 0.]\n",
+ " [ 0. 0. 0. 0. 1. 0. 0.]\n",
+ " [ 0. 0. 0. 0. 0. 1. 0.]\n",
+ " [ 0. 0. 0. 0. 0. 0. 1.]]\n",
+ "This is an Identity matrix of order 7 * 7\n",
+ "And It is a row reduced matrix.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import random, identity\n",
+ "i=2;\n",
+ "while i<=2:\n",
+ " n = random.randint(9)\n",
+ " i=n\n",
+ "print identity(n)\n",
+ "print 'This is an Identity matrix of order %d * %d'%(n,n)\n",
+ "print 'And It is a row reduced matrix.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 12 Example 1.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[[ 1.]]\n",
+ "This is an Identity matrix of order 1 * 1\n",
+ "And It is a row reduced matrix.\n",
+ "[[ 0. 0. 0. 0.]]\n",
+ "This is an Zero matrix of order 1 * 4\n",
+ "And It is also a row reduced matrix.\n",
+ "a = \n",
+ "[[ 0. 1. -3. 0. 0.5]\n",
+ " [ 0. 0. 0. 1. 2. ]\n",
+ " [ 0. 0. 0. 0. 0. ]]\n",
+ "This is a non-trivial row reduced matrix.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import random,identity, zeros,array\n",
+ "n = random.randint(9)\n",
+ "print identity(n)\n",
+ "print 'This is an Identity matrix of order %d * %d'%(n,n)\n",
+ "print 'And It is a row reduced matrix.'\n",
+ "m = random.randint(0,9)\n",
+ "n = random.randint(9)\n",
+ "print zeros([m,n])\n",
+ "print 'This is an Zero matrix of order %d * %d'%(m,n)\n",
+ "print 'And It is also a row reduced matrix.'\n",
+ "a = array([[0, 1, -3, 0, 1.0/2],[0, 0, 0, 1, 2],[0, 0 ,0 ,0 ,0]])\n",
+ "print 'a = \\n',a\n",
+ "print 'This is a non-trivial row reduced matrix.'\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 14 Example 1.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "[[ 1 -2 1]\n",
+ " [ 2 1 1]\n",
+ " [ 0 5 -1]]\n",
+ "Applying row transformations:\n",
+ "R2 = R2 - 2*R1\n",
+ "A = \n",
+ "[[ 1 -2 1]\n",
+ " [ 0 5 -1]\n",
+ " [ 0 5 -1]]\n",
+ "R3 = R3 - R2\n",
+ "A = \n",
+ "[[ 1 -2 1]\n",
+ " [ 0 5 -1]\n",
+ " [ 0 0 0]]\n",
+ "R2 = 1/5*R2\n",
+ "A = \n",
+ "[[ 1 -2 1]\n",
+ " [ 0 1 0]\n",
+ " [ 0 0 0]]\n",
+ "R1 = R1 - 2*R2\n",
+ "A = \n",
+ "[[1 0 1]\n",
+ " [0 1 0]\n",
+ " [0 0 0]]\n",
+ "The condition that the system have a solution is:\n",
+ "2*y1 - y2 + y3 = 0\n",
+ "where, y1,y2,y3 are some scalars\n",
+ "If the condition is satisfied then solutions are obtained by assigning a value c to x3\n",
+ "Solutions are:\n",
+ "x2 = 1/5*c + 1/5*(y2 - 2*y1) x1 = -3/5*c + 1/5*(y1 + 2*y2)\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "A = array([[1, -2, 1],[2, 1, 1],[0, 5, -1]])\n",
+ "print 'A = \\n',A\n",
+ "print 'Applying row transformations:'\n",
+ "print 'R2 = R2 - 2*R1'\n",
+ "A[1,:] = A[1,:] - 2*A[0,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'R3 = R3 - R2'\n",
+ "A[2,:] = A[2,:] - A[1,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'R2 = 1/5*R2'\n",
+ "A[1,:] = 1.0/5*A[1,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'R1 = R1 - 2*R2'\n",
+ "A[0,:] = A[0,:] + 2*A[1,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'The condition that the system have a solution is:'\n",
+ "print '2*y1 - y2 + y3 = 0'\n",
+ "print 'where, y1,y2,y3 are some scalars'\n",
+ "print 'If the condition is satisfied then solutions are obtained by assigning a value c to x3'\n",
+ "print 'Solutions are:'\n",
+ "print 'x2 = 1/5*c + 1/5*(y2 - 2*y1)','x1 = -3/5*c + 1/5*(y1 + 2*y2)'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 17 Example 1.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a=\n",
+ "[[ 1 0]\n",
+ " [-3 1]]\n",
+ "b=\n",
+ "[[ 5 -1 2]\n",
+ " [15 4 8]]\n",
+ "ab = \n",
+ "[[ 5 -1 2]\n",
+ " [ 0 7 2]]\n",
+ "-----------------------------------------------------------------\n",
+ "a=\n",
+ "[[ 1 0]\n",
+ " [-2 3]\n",
+ " [ 5 4]\n",
+ " [ 0 1]]\n",
+ "b=\n",
+ "[[ 0 6 1]\n",
+ " [ 3 8 -2]]\n",
+ "ab = \n",
+ "[[ 0 6 1]\n",
+ " [ 9 12 -8]\n",
+ " [12 62 -3]\n",
+ " [ 3 8 -2]]\n",
+ "-----------------------------------------------------------------\n",
+ "a=\n",
+ "[[2 1]\n",
+ " [5 4]]\n",
+ "b=\n",
+ "[[1]\n",
+ " [6]]\n",
+ "ab = \n",
+ "[[ 8]\n",
+ " [29]]\n",
+ "-----------------------------------------------------------------\n",
+ "a=\n",
+ "[[-1]\n",
+ " [ 3]]\n",
+ "b=\n",
+ "[[2 4]]\n",
+ "ab = \n",
+ "[[-2 -4]\n",
+ " [ 6 12]]\n",
+ "-----------------------------------------------------------------\n",
+ "a=\n",
+ "[[2 4]]\n",
+ "b=\n",
+ "[[-1]\n",
+ " [ 3]]\n",
+ "ab = \n",
+ "[[10]]\n",
+ "-----------------------------------------------------------------\n",
+ "a=\n",
+ "[[0 1 0]\n",
+ " [0 0 0]\n",
+ " [0 0 0]]\n",
+ "b=\n",
+ "[[ 1 -5 2]\n",
+ " [ 2 3 4]\n",
+ " [ 9 -1 3]]\n",
+ "ab = \n",
+ "[[2 3 4]\n",
+ " [0 0 0]\n",
+ " [0 0 0]]\n",
+ "-----------------------------------------------------------------\n",
+ "a=\n",
+ "[[ 1 -5 2]\n",
+ " [ 2 3 4]\n",
+ " [ 9 -1 3]]\n",
+ "b=\n",
+ "[[0 1 0]\n",
+ " [0 0 0]\n",
+ " [0 0 0]]\n",
+ "ab = \n",
+ "[[0 1 0]\n",
+ " [0 2 0]\n",
+ " [0 9 0]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "#Part a\n",
+ "a = array([[1, 0],[-3, 1]])\n",
+ "b = array([[5, -1, 2],[15, 4, 8]])\n",
+ "print 'a=\\n',a\n",
+ "print 'b=\\n',b\n",
+ "print 'ab = \\n',a.dot(b)\n",
+ "\n",
+ "print '-----------------------------------------------------------------'\n",
+ "#Part b\n",
+ "a = array([[1, 0],[-2, 3],[5 ,4],[0, 1]])\n",
+ "b = array([[0, 6, 1],[3 ,8 ,-2]])\n",
+ "print 'a=\\n',a\n",
+ "print 'b=\\n',b\n",
+ "print 'ab = \\n',a.dot(b)\n",
+ "print '-----------------------------------------------------------------'\n",
+ "#Part c\n",
+ "a = array([[2, 1],[5, 4]])\n",
+ "b = array([[1],[6]])\n",
+ "print 'a=\\n',a\n",
+ "print 'b=\\n',b\n",
+ "print 'ab = \\n',a.dot(b)\n",
+ "print '-----------------------------------------------------------------'\n",
+ "#Part d\n",
+ "a = array([[-1],[3]])\n",
+ "b = array([[2, 4]])\n",
+ "print 'a=\\n',a\n",
+ "print 'b=\\n',b\n",
+ "print 'ab = \\n',a.dot(b)\n",
+ "print '-----------------------------------------------------------------'\n",
+ "#Part e\n",
+ "a = array([[2, 4]])\n",
+ "b = array([[-1],[3]])\n",
+ "print 'a=\\n',a\n",
+ "print 'b=\\n',b\n",
+ "print 'ab = \\n',a.dot(b)\n",
+ "print '-----------------------------------------------------------------'\n",
+ "#Part f\n",
+ "a = array([[0, 1 ,0],[0, 0, 0],[0, 0, 0]])\n",
+ "b = array([[1, -5, 2],[2, 3, 4],[9 ,-1, 3]])\n",
+ "print 'a=\\n',a\n",
+ "print 'b=\\n',b\n",
+ "print 'ab = \\n',a.dot(b)\n",
+ "print '-----------------------------------------------------------------'\n",
+ "#Part g\n",
+ "a = array([[1, -5, 2],[2, 3, 4],[9, -1, 3]])\n",
+ "b = array([[0, 1, 0],[0 ,0 ,0],[0, 0, 0]])\n",
+ "print 'a=\\n',a\n",
+ "print 'b=\\n',b\n",
+ "print 'ab = \\n',a.dot(b)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 22 Example 1.14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a = \n",
+ "[[0 1]\n",
+ " [1 0]]\n",
+ "inverse a = \n",
+ "[[ 0. 1.]\n",
+ " [ 1. 0.]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,linalg\n",
+ "a = array([[0, 1],[1, 0]])\n",
+ "print 'a = \\n',a\n",
+ "print 'inverse a = \\n',linalg.inv(a)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 25 Example 1.15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a = \n",
+ "[[ 2 -1]\n",
+ " [ 1 3]]\n",
+ "Applying row tranformations\n",
+ "Interchange R1 and R2\n",
+ "a = \n",
+ "[[ 1 3]\n",
+ " [ 2 -1]]\n",
+ "R2 = R2 - 2 * R1\n",
+ "a =\n",
+ " [[ 1 3]\n",
+ " [ 0 -7]]\n",
+ "R2 = R2 *1/(-7)\n",
+ "a = \n",
+ "[[1 3]\n",
+ " [0 1]]\n",
+ "R1 = R1 - 3 * R2\n",
+ "a = \n",
+ "[[1 0]\n",
+ " [0 1]]\n",
+ "Since a has become an identity matrix. So, a is invertible\n",
+ "inverse of a = \n",
+ "[[ 0.42857143 0.14285714]\n",
+ " [-0.14285714 0.28571429]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,linalg\n",
+ "a = array([[2, -1],[1 ,3]])\n",
+ "b = array([[2, -1],[1 ,3]]) #Temporary variable to store a\n",
+ "print 'a = \\n',a\n",
+ "print 'Applying row tranformations'\n",
+ "print 'Interchange R1 and R2'\n",
+ "a[0,:] = a[1,:]\n",
+ "a[1,:] = b[0,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'R2 = R2 - 2 * R1'\n",
+ "a[1,:] = a[1,:] - 2 * a[0,:]\n",
+ "print 'a =\\n ',a\n",
+ "print 'R2 = R2 *1/(-7)'\n",
+ "a[1,:] = (-1.0/7) * a[1,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'R1 = R1 - 3 * R2'\n",
+ "a[0,:] = a[0,:] - 3 * a[1,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'Since a has become an identity matrix. So, a is invertible'\n",
+ "print 'inverse of a = '\n",
+ "print linalg.inv(b)# #a was stored in b"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 25 Example 1.16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a = \n",
+ "[[ 1. 0.5 0.33333333]\n",
+ " [ 0.5 0.33333333 0.25 ]\n",
+ " [ 0.33333333 0.25 0.2 ]]\n",
+ "b = \n",
+ "[[ 1. 0. 0.]\n",
+ " [ 0. 1. 0.]\n",
+ " [ 0. 0. 1.]]\n",
+ "Applying row transformations on a and b simultaneously,\n",
+ "R2 = R2 - 1/2 * R1 and R3 = R3 - 1/3*R1\n",
+ "a = \n",
+ "[[ 1. 0.5 0.33333333]\n",
+ " [ 0. 0.08333333 0.08333333]\n",
+ " [ 0. 0.08333333 0.08888889]]\n",
+ "b = \n",
+ "[[ 1. 0. 0. ]\n",
+ " [-0.5 1. 0. ]\n",
+ " [-0.33333333 0. 1. ]]\n",
+ "R3 = R3 - R2\n",
+ "a = \n",
+ "[[ 1.00000000e+00 5.00000000e-01 3.33333333e-01]\n",
+ " [ 0.00000000e+00 8.33333333e-02 8.33333333e-02]\n",
+ " [ 0.00000000e+00 2.77555756e-17 5.55555556e-03]]\n",
+ "b = \n",
+ "[[ 1. 0. 0. ]\n",
+ " [-0.5 1. 0. ]\n",
+ " [ 0.16666667 -1. 1. ]]\n",
+ "R2 = R2 * 12 and R3 = R3 * 180\n",
+ "a = \n",
+ "[[ 1.00000000e+00 5.00000000e-01 3.33333333e-01]\n",
+ " [ 0.00000000e+00 1.00000000e+00 1.00000000e+00]\n",
+ " [ 0.00000000e+00 4.99600361e-15 1.00000000e+00]]\n",
+ "b = \n",
+ "[[ 1. 0. 0.]\n",
+ " [ -6. 12. 0.]\n",
+ " [ 30. -180. 180.]]\n",
+ "R2 = R2 - R3 and R1 = R1 - 1/3*R3\n",
+ "a = \n",
+ "[[ 1.00000000e+00 5.00000000e-01 -4.44089210e-16]\n",
+ " [ 0.00000000e+00 1.00000000e+00 -1.33226763e-15]\n",
+ " [ 0.00000000e+00 4.99600361e-15 1.00000000e+00]]\n",
+ "b = \n",
+ "[[ -9. 60. -60.]\n",
+ " [ -36. 192. -180.]\n",
+ " [ 30. -180. 180.]]\n",
+ "R1 = R1 - 1/2 * R2\n",
+ "a = \n",
+ "[[ 1. 0. 0.]\n",
+ " [ 0. 1. -0.]\n",
+ " [ 0. 0. 1.]]\n",
+ "b = \n",
+ "[[ 9. -36. 30.]\n",
+ " [ -36. 192. -180.]\n",
+ " [ 30. -180. 180.]]\n",
+ "Since, a = identity matrix of order 3*3. So, b is inverse of a\n",
+ "inverse(a) = \n",
+ "[[ 9. -36. 30.]\n",
+ " [ -36. 192. -180.]\n",
+ " [ 30. -180. 180.]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,identity,matrix\n",
+ "a = array([[1 ,1./2, 1.0/3],[1.0/2 ,1.0/3, 1.0/4],[1.0/3, 1.0/4, 1.0/5]])\n",
+ "print 'a = \\n',a\n",
+ "b = identity(3)\n",
+ "print 'b = \\n',b\n",
+ "print 'Applying row transformations on a and b simultaneously,'\n",
+ "print 'R2 = R2 - 1/2 * R1 and R3 = R3 - 1/3*R1'\n",
+ "a[1,:] = a[1,:] - 1.0/2 * a[0,:]\n",
+ "a[2,:] = a[2,:] - 1.0/3 * a[0,:]\n",
+ "b[1,:] = b[1,:] - 1.0/2 * b[0,:]\n",
+ "b[2,:] = b[2,:] - 1.0/3 * b[0,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'b = \\n',b\n",
+ "print 'R3 = R3 - R2'\n",
+ "a[2,:] = a[2,:] - a[1,:]#\n",
+ "b[2,:] = b[2,:] - b[1,:]\n",
+ "print 'a = \\n',a\n",
+ "print 'b = \\n',b\n",
+ "print 'R2 = R2 * 12 and R3 = R3 * 180'\n",
+ "a[1,:] = a[1,:] *12#\n",
+ "a[2,:] = a[2,:] * 180#\n",
+ "b[1,:] = b[1,:] * 12#\n",
+ "b[2,:] = b[2,:] * 180#\n",
+ "print 'a = \\n',a\n",
+ "print 'b = \\n',b\n",
+ "print 'R2 = R2 - R3 and R1 = R1 - 1/3*R3'\n",
+ "a[1,:] = a[1,:] - a[2,:]#\n",
+ "a[0,:] = a[0,:] - 1./3 * a[2,:]#\n",
+ "b[1,:] = b[1,:] - b[2,:]#\n",
+ "b[0,:] = b[0,:] - 1./3 * b[2,:]#\n",
+ "print 'a = \\n',a\n",
+ "print 'b = \\n',b\n",
+ "print 'R1 = R1 - 1/2 * R2'\n",
+ "a[0,:] = a[0,:] - 1./2 * a[1,:]#\n",
+ "b[0,:] = b[0,:] - 1./2 * b[1,:]#\n",
+ "print 'a = \\n',matrix.round(a)\n",
+ "print 'b = \\n',b\n",
+ "print 'Since, a = identity matrix of order 3*3. So, b is inverse of a'\n",
+ "print 'inverse(a) = \\n',b"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter2_ctyqn3t.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter2_ctyqn3t.ipynb
new file mode 100644
index 00000000..5659e3a2
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter2_ctyqn3t.ipynb
@@ -0,0 +1,792 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 2 - Vector spaces"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 37 Example 2.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a1 = [1, 2, 0, 3, 0]\n",
+ "a2 = [0, 0, 1, 4, 0]\n",
+ "a3 = [0, 0, 0, 0, 1]\n",
+ "By theorem 3, vector a is in subspace W of F**5 spanned by a1, a2, a3\n",
+ "if and only if there exist scalars c1, c2, c3 such that\n",
+ "a= c1a1 + c2a2 + c3a3\n",
+ "So, a = (c1,2*c1,c2,3c1+4c2,c3)\n",
+ "c1 = -3\n",
+ "c2 = 1\n",
+ "c3 = 2\n",
+ "Therefore, a = [0, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]\n",
+ "This shows, a is in W\n",
+ "And (2,4,6,7,8) is not in W as there is no value of c1 c2 c3 that satisfies the equation\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "a1 = [1, 2 ,0 ,3, 0]#\n",
+ "a2 =[0, 0 ,1 ,4 ,0]#\n",
+ "a3 = [0 ,0 ,0 ,0, 1]#\n",
+ "print 'a1 = ',a1\n",
+ "print 'a2 = ',a2\n",
+ "print 'a3 = ',a3\n",
+ "print 'By theorem 3, vector a is in subspace W of F**5 spanned by a1, a2, a3'\n",
+ "print 'if and only if there exist scalars c1, c2, c3 such that'\n",
+ "print 'a= c1a1 + c2a2 + c3a3'\n",
+ "print 'So, a = (c1,2*c1,c2,3c1+4c2,c3)'\n",
+ "c1 = -3#\n",
+ "c2 = 1#\n",
+ "c3 = 2#\n",
+ "a = c1*a1 + c2*a2 + c3*a3#\n",
+ "print 'c1 = ',c1\n",
+ "print 'c2 = ',c2\n",
+ "print 'c3 = ',c3\n",
+ "print 'Therefore, a = ',a\n",
+ "print 'This shows, a is in W'\n",
+ "print 'And (2,4,6,7,8) is not in W as there is no value of c1 c2 c3 that satisfies the equation'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 38 Example 2.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "[[1 2 0 3 0]\n",
+ " [0 0 1 4 0]\n",
+ " [0 0 0 0 1]]\n",
+ "The subspace of F**5 spanned by a1 a2 a3(row vectors of A) is called row space of A.\n",
+ "a1 = [1 2 0 3 0]\n",
+ "a2 = [0 0 1 4 0]\n",
+ "a3 = [0 0 0 0 1]\n",
+ "And, it is also the row space of B.\n",
+ "B = \n",
+ "[[ 1 2 0 3 0]\n",
+ " [ 0 0 1 4 0]\n",
+ " [ 0 0 0 0 1]\n",
+ " [-4 -8 1 -8 0]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "\n",
+ "A = array([[1, 2, 0 ,3 ,0],[0, 0, 1, 4, 0],[0, 0, 0, 0, 1]])\n",
+ "print 'A = \\n',A\n",
+ "print 'The subspace of F**5 spanned by a1 a2 a3(row vectors of A) is called row space of A.'\n",
+ "a1 = A[0,:]\n",
+ "a2 = A[1,:]\n",
+ "a3 = A[2,:]\n",
+ "print 'a1 = ',a1\n",
+ "print 'a2 = ',a2\n",
+ "print 'a3 = ',a3\n",
+ "print 'And, it is also the row space of B.'\n",
+ "B = array([[1, 2, 0, 3, 0],[0, 0, 1, 4, 0],[0, 0, 0, 0, 1],[-4, -8, 1 ,-8, 0]])\n",
+ "print 'B = \\n',B"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 39 Example 2.11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "V is the space of all polynomial functions over F.\n",
+ "S contains the functions as:\n",
+ "n = 5\n",
+ "f0(x) = 1\n",
+ "f1(x) = x\n",
+ "f2(x) = x**2\n",
+ "f3(x) = x**3\n",
+ "f4(x) = x**4\n",
+ "Then, V is the subspace spanned by set S.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol\n",
+ "from numpy import random\n",
+ "print 'V is the space of all polynomial functions over F.'\n",
+ "print 'S contains the functions as:'\n",
+ "x = Symbol(\"x\")\n",
+ "#n = round(rand()*10)#\n",
+ "n=random.randint(0,19)\n",
+ "print 'n = ',n\n",
+ "for i in range (0,n):\n",
+ " f = x**i#\n",
+ " print 'f%d(x) = '%(i,),f\n",
+ " \n",
+ "\n",
+ "print 'Then, V is the subspace spanned by set S.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 41 Example 2.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a1 = [ 3 0 -3]\n",
+ "a2 = [-1 1 2]\n",
+ "a3 = [ 4 2 -2]\n",
+ "a4 = [2 1 1]\n",
+ " Since, 2 * a1 + 2 * a2 - a3 + 0 * a4 = [0 0 0] = 0\n",
+ "a1,a2,a3,a4 are linearly independent\n",
+ "Now, e1 = [1, 0, 0]\n",
+ "e2 = [0, 1, 0]\n",
+ "e3 = [0, 0, 1]\n",
+ "Also, e1,e2,e3 are linearly independent.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "a1 = array([3 ,0, -3])\n",
+ "a2 = array([-1 ,1 ,2])\n",
+ "a3 = array([4 ,2, -2])\n",
+ "a4 = array([2 ,1, 1])\n",
+ "print 'a1 = ',a1\n",
+ "print 'a2 = ',a2\n",
+ "print 'a3 = ',a3\n",
+ "print 'a4 = ',a4\n",
+ "t = 2 * a1 + 2 * a2 - a3 + 0 * a4\n",
+ "print ' Since, 2 * a1 + 2 * a2 - a3 + 0 * a4 = ',t,'= 0'\n",
+ "print 'a1,a2,a3,a4 are linearly independent'\n",
+ "e1 = [1, 0, 0]#\n",
+ "e2 = [0 ,1 ,0]#\n",
+ "e3 = [0 ,0, 1]#\n",
+ "print 'Now, e1 = ',e1\n",
+ "print 'e2 = ',e2\n",
+ "print 'e3 = ',e3\n",
+ "print 'Also, e1,e2,e3 are linearly independent.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 41 Example 2.13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "S is the subset of F**n consisting of n vectors.\n",
+ "n = 1\n",
+ "e1 = \n",
+ "[ 1.]\n",
+ "x1,x2,x3...xn are the scalars in F\n",
+ "Putting a = x1*e1 + x2*e2 + x3*e3 + .... + xn*en\n",
+ "So, a = (x1,x2,x3,...,xn)\n",
+ "Therefore, e1,e2..,en span F**n\n",
+ "a = 0 if x1 = x2 = x3 = .. = xn = 0\n",
+ "So,e1,e2,e3,..,en are linearly independent.\n",
+ "The set S = {e1,e2,..,en} is called standard basis of F**n\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,identity\n",
+ "print 'S is the subset of F**n consisting of n vectors.'\n",
+ "#n = round(rand() *10 + 1)#\\\n",
+ "n=random.randint(0,19)\n",
+ "print 'n = ',n\n",
+ "I = identity(n)\n",
+ "for i in range(0,n):\n",
+ " e = I[i,:]\n",
+ " print 'e%d = '%(i+1)\n",
+ " print e\n",
+ "\n",
+ "print 'x1,x2,x3...xn are the scalars in F'\n",
+ "print 'Putting a = x1*e1 + x2*e2 + x3*e3 + .... + xn*en'\n",
+ "print 'So, a = (x1,x2,x3,...,xn)'\n",
+ "print 'Therefore, e1,e2..,en span F**n'\n",
+ "print 'a = 0 if x1 = x2 = x3 = .. = xn = 0'\n",
+ "print 'So,e1,e2,e3,..,en are linearly independent.'\n",
+ "print 'The set S = {e1,e2,..,en} is called standard basis of F**n'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 54 Example 2.20"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "P = \n",
+ "[[-1 4 5]\n",
+ " [ 0 2 -3]\n",
+ " [ 0 0 8]]\n",
+ "\n",
+ "inverse(P) = \n",
+ "[[-1. 2. 1.375 ]\n",
+ " [ 0. 0.5 0.1875]\n",
+ " [ 0. 0. 0.125 ]]\n",
+ "The vectors forming basis of F**3 are a1, a2, a3\n",
+ "a1' = \n",
+ "[-1 0 0]\n",
+ "\n",
+ "a2' = \n",
+ "[4 2 0]\n",
+ "\n",
+ "a3' = \n",
+ "[ 5 -3 8]\n",
+ "The coordinates x1,x2,x3 of vector a = [x1,x2,x3] is given by inverse(P)*[x1# x2# x3]\n",
+ "And, -10*a1 - 1/2*a2 - a3 = [ 3. 2. -8.]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,transpose,linalg\n",
+ "P = array([[-1, 4, 5],[ 0, 2, -3],[ 0, 0, 8]])\n",
+ "print 'P = \\n',P\n",
+ "print '\\ninverse(P) = \\n',linalg.inv(P)\n",
+ "a1 = P[:,0]\n",
+ "a2 = P[:,1]\n",
+ "a3 = P[:,2]\n",
+ "print 'The vectors forming basis of F**3 are a1'', a2'', a3'''\n",
+ "print \"a1' = \\n\",transpose(a1)\n",
+ "print \"\\na2' = \\n\",transpose(a2)\n",
+ "print \"\\na3' = \\n\",transpose(a3)\n",
+ "print 'The coordinates x1'',x2'',x3'' of vector a = [x1,x2,x3] is given by inverse(P)*[x1# x2# x3]'\n",
+ "t = -10*a1 - 1./2*a2 - a3#\n",
+ "print 'And, -10*a1'' - 1/2*a2'' - a3'' = ',t"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 60 Example 2.21"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Given row vectors are:\n",
+ "a1 = [1, 2, 2, 1]\n",
+ "a2 = [0, 2, 0, 1]\n",
+ "a3 = [-2, 0, -4, 3]\n",
+ "The matrix A from these vectors will be:\n",
+ "A = \n",
+ "[[ 1 2 2 1]\n",
+ " [ 0 2 0 1]\n",
+ " [-2 0 -4 3]]\n",
+ "Finding Row reduced echelon matrix of A that is given by R\n",
+ "And applying same operations on identity matrix Q such that R = QA\n",
+ "Q = \n",
+ "[[ 1. 0. 0.]\n",
+ " [ 0. 1. 0.]\n",
+ " [ 0. 0. 1.]]\n",
+ "Applying row transformations on A and Q,we get\n",
+ "R1 = R1-R2\n",
+ "A = \n",
+ "[[ 1 0 2 0]\n",
+ " [ 0 2 0 1]\n",
+ " [-2 0 -4 3]]\n",
+ "Q = \n",
+ "[[ 1. -1. 0.]\n",
+ " [ 0. 1. 0.]\n",
+ " [ 0. 0. 1.]]\n",
+ "R3 = R3 + 2*R1\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 2 0 1]\n",
+ " [0 0 0 3]]\n",
+ "Q = \n",
+ "[[ 1. -1. 0.]\n",
+ " [ 0. 1. 0.]\n",
+ " [ 2. -2. 1.]]\n",
+ "R3 = R3/3\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 2 0 1]\n",
+ " [0 0 0 1]]\n",
+ "Q = \n",
+ "[[ 1. -1. 0. ]\n",
+ " [ 0. 1. 0. ]\n",
+ " [ 0.66666667 -0.66666667 0.33333333]]\n",
+ "R2 = R2/2\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 1 0 0]\n",
+ " [0 0 0 1]]\n",
+ "Q = \n",
+ "[[ 1. -1. 0. ]\n",
+ " [ 0. 5. 0. ]\n",
+ " [ 0.66666667 -0.66666667 0.33333333]]\n",
+ "R2 = R2 - 1/2*R3\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 1 0 0]\n",
+ " [0 0 0 1]]\n",
+ "Q = \n",
+ "[[ 1. -1. 0. ]\n",
+ " [-0.33333333 5.33333333 -0.16666667]\n",
+ " [ 0.66666667 -0.66666667 0.33333333]]\n",
+ "Row reduced echelon matrix:\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 1 0 0]\n",
+ " [0 0 0 1]]\n",
+ "Q = \n",
+ "[[ 1. -1. 0. ]\n",
+ " [-0.33333333 5.33333333 -0.16666667]\n",
+ " [ 0.66666667 -0.66666667 0.33333333]]\n",
+ "rank of R = 2\n",
+ "Since, Rank of R is 3, so a1, a2, a3 are independent\n",
+ "Now, basis for W can be given by row vectors of R i.e. p1,p2,p3\n",
+ "b is any vector in W. b = [b1 b2 b3 b4]\n",
+ "Span of vectors p1,p2,p3 consist of vector b with b3 = 2*b1\n",
+ "So,b = b1p1 + b2p2 + b4p3\n",
+ "And,[p1 p2 p3] = R = Q*A\n",
+ "So, b = [b1 b2 b3]* Q * A\n",
+ "hence, b = x1a1 + x2a2 + x3a3 where x1 = [b1 b2 b4] * Q(1) and so on\n",
+ "Now, given 3 vectors a1 a2 a3:\n",
+ "a1 = [1, 0, 2, 0]\n",
+ "a2 = [0, 2, 0, 1]\n",
+ "a3 = [0, 0, 0, 3]\n",
+ "Since a1 a2 a3 are all of the form (y1 y2 y3 y4) with y3 = 2*y1, hence they are in W.\n",
+ "So, they are independent.\n",
+ "Required matrix P such that X = PX is:\n",
+ "P = \n",
+ "[[ 0. -0. 2.]\n",
+ " [-0. 0. -2.]\n",
+ " [ 0. -0. 1.]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,identity,rank,vstack\n",
+ "a1 = [1 ,2 ,2, 1]#\n",
+ "a2 = [0 ,2 ,0 ,1]#\n",
+ "a3 = [-2, 0, -4, 3]#\n",
+ "print 'Given row vectors are:'\n",
+ "print 'a1 = ',a1\n",
+ "print 'a2 = ',a2\n",
+ "print 'a3 = ',a3\n",
+ "print 'The matrix A from these vectors will be:'\n",
+ "#A = [a1],[a2], [a3]]\n",
+ "A=array([a1,a2,a3])\n",
+ "print 'A = \\n',A\n",
+ "\n",
+ "print 'Finding Row reduced echelon matrix of A that is given by R'\n",
+ "print 'And applying same operations on identity matrix Q such that R = QA'\n",
+ "Q = identity(3)\n",
+ "print 'Q = \\n',Q\n",
+ "T = A# #Temporary matrix to store A\n",
+ "print 'Applying row transformations on A and Q,we get'\n",
+ "print 'R1 = R1-R2'\n",
+ "A[0,:] = A[0,:] - A[1,:]\n",
+ "Q[0,:] = Q[0,:] - Q[1,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'Q = \\n',Q\n",
+ "print 'R3 = R3 + 2*R1'\n",
+ "A[2,:] = A[2,:] + 2*A[0,:]\n",
+ "Q[2,:] = Q[2,:] + 2*Q[0,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'Q = \\n',Q\n",
+ "print 'R3 = R3/3'\n",
+ "A[2,:] = 1./3*A[2,:]\n",
+ "Q[2,:] = 1./3*Q[2,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'Q = \\n',Q\n",
+ "print 'R2 = R2/2'\n",
+ "A[1,:] = 1./2*A[1,:]\n",
+ "Q[1,:] = 10/2*Q[1,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'Q = \\n',Q\n",
+ "print 'R2 = R2 - 1/2*R3'\n",
+ "A[1,:] = A[1,:] - 1./2*A[2,:]\n",
+ "Q[1,:] = Q[1,:] - 1./2*Q[2,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'Q = \\n',Q\n",
+ "R = A#\n",
+ "A = T#\n",
+ "print 'Row reduced echelon matrix:'\n",
+ "print 'A = \\n',A\n",
+ "print 'Q = \\n',Q\n",
+ "#part a\n",
+ "print 'rank of R = ',rank(R)\n",
+ "\n",
+ "print 'Since, Rank of R is 3, so a1, a2, a3 are independent'\n",
+ "#part b\n",
+ "print 'Now, basis for W can be given by row vectors of R i.e. p1,p2,p3'\n",
+ "print 'b is any vector in W. b = [b1 b2 b3 b4]'\n",
+ "print 'Span of vectors p1,p2,p3 consist of vector b with b3 = 2*b1'\n",
+ "print 'So,b = b1p1 + b2p2 + b4p3'\n",
+ "print 'And,[p1 p2 p3] = R = Q*A'\n",
+ "print 'So, b = [b1 b2 b3]* Q * A'\n",
+ "print 'hence, b = x1a1 + x2a2 + x3a3 where x1 = [b1 b2 b4] * Q(1) and so on' # #Equation 1\n",
+ "#part c\n",
+ "print 'Now, given 3 vectors a1'' a2'' a3'':'\n",
+ "c1 = [1, 0, 2, 0]#\n",
+ "c2 = [0 ,2 ,0, 1]#\n",
+ "c3 = [0 ,0 ,0 ,3]#\n",
+ "print 'a1'' = ',c1\n",
+ "print 'a2'' = ',c2\n",
+ "print 'a3'' = ',c3\n",
+ "print 'Since a1'' a2'' a3'' are all of the form (y1 y2 y3 y4) with y3 = 2*y1, hence they are in W.'\n",
+ "print 'So, they are independent.'\n",
+ "#part d\n",
+ "c = array([c1,c2,c3])\n",
+ "P = identity(3)\n",
+ "for i in range(0,3):\n",
+ " b1 = c[i,0]\n",
+ " b2 = c[i,1]\n",
+ " b4 = c[i,3]\n",
+ " x1 = array([b1, b2, b4]) * Q[:,0]\n",
+ " x2 = array([b1, b2, b4])*Q[:,1]\n",
+ " x3 = array([b1, b2, b4])*Q[:,2]\n",
+ " \n",
+ "\n",
+ "print 'Required matrix P such that X = PX'' is:'\n",
+ "P=vstack([x1,x2,x3])\n",
+ "print 'P = \\n',P\n",
+ "#print x1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 63 Example 2.22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "[[ 1 2 0 3 0]\n",
+ " [ 1 2 -1 -1 0]\n",
+ " [ 0 0 1 4 0]\n",
+ " [ 2 4 1 10 1]\n",
+ " [ 0 0 0 0 1]]\n",
+ "Taking an identity matrix P:\n",
+ "P = \n",
+ "[[ 1. 0. 0. 0. 0.]\n",
+ " [ 0. 1. 0. 0. 0.]\n",
+ " [ 0. 0. 1. 0. 0.]\n",
+ " [ 0. 0. 0. 1. 0.]\n",
+ " [ 0. 0. 0. 0. 1.]]\n",
+ "Applying row transformations on P and A to get a row reduced echelon matrix R:\n",
+ "R2 = R2 - R1 and R4 = R4 - 2* R1\n",
+ "A = \n",
+ "[[ 1 2 0 3 0]\n",
+ " [ 0 0 -1 -4 0]\n",
+ " [ 0 0 1 4 0]\n",
+ " [ 0 0 1 4 1]\n",
+ " [ 0 0 0 0 1]]\n",
+ "P = \n",
+ "[[ 1. 0. 0. 0. 0.]\n",
+ " [-1. 1. 0. 0. 0.]\n",
+ " [ 0. 0. 1. 0. 0.]\n",
+ " [-2. 0. 0. 1. 0.]\n",
+ " [ 0. 0. 0. 0. 1.]]\n",
+ "R2 = -R2 , R3 = R3 - R1 + R2 and R4 = R4 - R1 + R2\n",
+ "A = \n",
+ "[[1 2 0 3 0]\n",
+ " [0 0 1 4 0]\n",
+ " [0 0 0 0 0]\n",
+ " [0 0 0 0 1]\n",
+ " [0 0 0 0 1]]\n",
+ "P = \n",
+ "[[ 1. 0. 0. 0. 0.]\n",
+ " [ 1. -1. -0. -0. -0.]\n",
+ " [-1. 1. 1. 0. 0.]\n",
+ " [-3. 1. 0. 1. 0.]\n",
+ " [-3. 1. 0. 1. 0.]]\n",
+ "Mutually interchanging R3, R4 and R5\n",
+ "Row reduced echelon matrix R = \n",
+ "[[1 2 0 3 0]\n",
+ " [0 0 1 4 0]\n",
+ " [0 0 0 0 1]\n",
+ " [0 0 0 0 1]\n",
+ " [0 0 0 0 0]]\n",
+ "Invertible Matrix P = \n",
+ "[[ 1. 0. 0. 0. 0.]\n",
+ " [ 1. -1. -0. -0. -0.]\n",
+ " [-3. 1. 0. 1. 0.]\n",
+ " [-3. 1. 0. 1. 0.]\n",
+ " [ 0. 0. 0. 0. 0.]]\n",
+ "Invertible matrix P is not unique. There can be many that depends on operations used to reduce A\n",
+ "-----------------------------------------\n",
+ "For the basis of row space W of A, we can take the non-zero rows of R\n",
+ "It can be given by p1, p2, p3\n",
+ "p1 = [1 2 0 3 0]\n",
+ "p2 = [0 0 1 4 0]\n",
+ "p3 = [0 0 0 0 1]\n",
+ "-----------------------------------------\n",
+ "The row space W consists of vectors of the form:\n",
+ "b = c1p1 + c2p2 + c3p3\n",
+ "i.e. b = (c1,2*c1,c2,3*c1+4*c2,c3) where, c1 c2 c3 are scalars.\n",
+ "So, if b2 = 2*b1 and b4 = 3*b1 + 4*b3 => (b1,b2,b3,b4,b5) = b1p1 + b3p2 + b5p3\n",
+ "then,(b1,b2,b3,b4,b5) is in W\n",
+ "-----------------------------------------\n",
+ "The coordinate matrix of the vector (b1,2*b1,b2,3*b1+4*b2,b3) in the basis (p1,p2,p3) is column matrix of b1,b2,b3 such that:\n",
+ " b1\n",
+ " b2\n",
+ " b3\n",
+ "-----------------------------------------\n",
+ "Now, to write each vector in W as a linear combination of rows of A:\n",
+ "Let b = (b1,b2,b3,b4,b5) and if b is in W, then\n",
+ "we know,b = (b1,2*b1,b3,3*b1 + 4*b3,b5) => [b1,b3,b5,0,0]*R\n",
+ "=> b = [b1,b3,b5,0,0] * P*A => b = [b1+b3,-b3,0,0,b5] * A\n",
+ "if b = (-5,-10,1,-11,20)\n",
+ "b = ( [-4, -1, 0, 0, 20] ) *[ [[1 2 0 3 0]\n",
+ " [0 0 1 4 0]\n",
+ " [0 0 0 0 1]\n",
+ " [0 0 0 0 1]\n",
+ " [0 0 0 0 0]] ]\n",
+ "-----------------------------------------\n",
+ "The equations in system RX = 0 are given by R * [x1 x2 x3 x4 x5]\n",
+ "i.e., x1 + 2*x2 + 3*x4\n",
+ "x3 + 4*x4\n",
+ "x5\n",
+ "so, V consists of all columns of the form\n",
+ "[ X=\n",
+ " -2*x2 - 3*x4\n",
+ " x2\n",
+ " -4*x4\n",
+ " x4\n",
+ " 0\n",
+ "where x2 and x4 are arbitrary ]\n",
+ "-----------------------------------------\n",
+ "Let x2 = 1,x4 = 0 then the given column forms a basis of V\n",
+ "[[-2], [1], [0], [0], [0]]\n",
+ "Similarly,if x2 = 0,x4 = 1 then the given column forms a basis of V\n",
+ "[[-3], [0], [-4], [1], [0]]\n",
+ "-----------------------------------------\n",
+ "The equation AX = Y has solutions X if and only if\n",
+ "-y1 + y2 + y3 = 0\n",
+ "-3*y1 + y2 + y4 -y5 = 0\n",
+ "where, Y = (y1 y2 y3 y4 y5)\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,identity\n",
+ "A = array([[1, 2, 0, 3, 0],[1, 2, -1, -1, 0],[0 ,0 ,1 ,4 ,0],[2, 4 ,1 ,10, 1],[0 ,0 ,0 ,0 ,1]])\n",
+ "print 'A = \\n',A\n",
+ "#part a\n",
+ "T = A# #Temporary storing A in T\n",
+ "print 'Taking an identity matrix P:'\n",
+ "P = identity(5)\n",
+ "print 'P = \\n',P\n",
+ "print 'Applying row transformations on P and A to get a row reduced echelon matrix R:'\n",
+ "print 'R2 = R2 - R1 and R4 = R4 - 2* R1'\n",
+ "A[1,:] = A[1,:] - A[0,:]\n",
+ "P[1,:] = P[1,:] - P[0,:]\n",
+ "A[3,:] = A[3,:] - 2 * A[0,:]\n",
+ "P[3,:] = P[3,:] - 2 * P[0,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'P = \\n',P\n",
+ "print 'R2 = -R2 , R3 = R3 - R1 + R2 and R4 = R4 - R1 + R2'\n",
+ "A[1,:] = -A[1,:]\n",
+ "P[1,:] = -P[1,:]\n",
+ "A[2,:] = A[2,:] - A[1,:]\n",
+ "P[2,:] = P[2,:] - P[1,:]\n",
+ "A[3,:] = A[3,:] - A[1,:]\n",
+ "P[3:] = P[3,:] - P[1,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'P = \\n',P\n",
+ "print 'Mutually interchanging R3, R4 and R5'\n",
+ "x = A[2,:]\n",
+ "A[2,:] = A[4,:]\n",
+ "y = A[3,:]\n",
+ "A[3,:] = x#\n",
+ "A[4,:] = y - A[2,:]\n",
+ "x = P[2,:]\n",
+ "P[2,:] = P[4,:]\n",
+ "y = P[3,:]\n",
+ "P[3,:] = x#\n",
+ "P[4,:] = y - P[2,:]\n",
+ "R = A#\n",
+ "A = T#\n",
+ "print 'Row reduced echelon matrix R = \\n',R\n",
+ "print 'Invertible Matrix P = \\n',P\n",
+ "print 'Invertible matrix P is not unique. There can be many that depends on operations used to reduce A'\n",
+ "print '-----------------------------------------'\n",
+ "#part b\n",
+ "print 'For the basis of row space W of A, we can take the non-zero rows of R'\n",
+ "print 'It can be given by p1, p2, p3'\n",
+ "p1 = R[0,:]\n",
+ "p2 = R[1,:]\n",
+ "p3 = R[2,:]\n",
+ "print 'p1 = ',p1\n",
+ "print 'p2 = ',p2\n",
+ "print 'p3 = ',p3\n",
+ "print '-----------------------------------------'\n",
+ "#part c\n",
+ "print 'The row space W consists of vectors of the form:'\n",
+ "print 'b = c1p1 + c2p2 + c3p3'\n",
+ "print 'i.e. b = (c1,2*c1,c2,3*c1+4*c2,c3) where, c1 c2 c3 are scalars.'\n",
+ "print 'So, if b2 = 2*b1 and b4 = 3*b1 + 4*b3 => (b1,b2,b3,b4,b5) = b1p1 + b3p2 + b5p3'\n",
+ "print 'then,(b1,b2,b3,b4,b5) is in W'\n",
+ "print '-----------------------------------------'\n",
+ "#part d\n",
+ "print 'The coordinate matrix of the vector (b1,2*b1,b2,3*b1+4*b2,b3) in the basis (p1,p2,p3) is column matrix of b1,b2,b3 such that:'\n",
+ "print ' b1'\n",
+ "print ' b2'\n",
+ "print ' b3'\n",
+ "print '-----------------------------------------'\n",
+ "#part e\n",
+ "print 'Now, to write each vector in W as a linear combination of rows of A:'\n",
+ "print 'Let b = (b1,b2,b3,b4,b5) and if b is in W, then'\n",
+ "print 'we know,b = (b1,2*b1,b3,3*b1 + 4*b3,b5) => [b1,b3,b5,0,0]*R'\n",
+ "print '=> b = [b1,b3,b5,0,0] * P*A => b = [b1+b3,-b3,0,0,b5] * A'\n",
+ "print 'if b = (-5,-10,1,-11,20)'\n",
+ "b1 = -5#\n",
+ "b2 = -10#\n",
+ "b3 = 1#\n",
+ "b4 = -11#\n",
+ "b5 = 20#\n",
+ "x = [b1 + b3,-b3,0,0,b5]#\n",
+ "print 'b = (',x,')','*[',A,']'\n",
+ "print '-----------------------------------------'\n",
+ "#part f\n",
+ "print 'The equations in system RX = 0 are given by R * [x1 x2 x3 x4 x5]'\n",
+ "print 'i.e., x1 + 2*x2 + 3*x4'\n",
+ "print 'x3 + 4*x4'\n",
+ "print 'x5'\n",
+ "print 'so, V consists of all columns of the form'\n",
+ "print '[','X='\n",
+ "print ' -2*x2 - 3*x4'\n",
+ "print ' x2'\n",
+ "print ' -4*x4'\n",
+ "print ' x4'\n",
+ "print ' 0'\n",
+ "print 'where x2 and x4 are arbitrary',']'\n",
+ "print '-----------------------------------------'\n",
+ "#part g\n",
+ "print 'Let x2 = 1,x4 = 0 then the given column forms a basis of V'\n",
+ "\n",
+ "x2 = 1#\n",
+ "x4 = 0#\n",
+ "print [[-2*x2-3*x4],[ x2],[ -4*x4],[ x4],[ 0]]\n",
+ "print 'Similarly,if x2 = 0,x4 = 1 then the given column forms a basis of V'\n",
+ "x2 = 0#\n",
+ "x4 = 1#\n",
+ "print [[-2*x2-3*x4],[ x2],[ -4*x4],[ x4],[ 0]]\n",
+ "print '-----------------------------------------'\n",
+ "#part h\n",
+ "print 'The equation AX = Y has solutions X if and only if'\n",
+ "print '-y1 + y2 + y3 = 0'\n",
+ "print '-3*y1 + y2 + y4 -y5 = 0'\n",
+ "print 'where, Y = (y1 y2 y3 y4 y5)'"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter3_UNgU4ev.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter3_UNgU4ev.ipynb
new file mode 100644
index 00000000..4007526a
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter3_UNgU4ev.ipynb
@@ -0,0 +1,631 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 3 - Linear transformation"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 70 Example 3.6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a1 = [1, 2]\n",
+ "a2 = [3, 4]\n",
+ "a1 and a2 are linearly independent and hence form a basis for R**2\n",
+ "According to theorem 1, there is a linear transformation from R**2 to R**3 with the transformation functions as:\n",
+ "Ta1 = [3, 2, 1]\n",
+ "Ta2 = [6, 5, 4]\n",
+ "Now, we find scalars c1 and c2 for that we know T(c1a1 + c2a2) = c1(Ta1) + c2(Ta2))\n",
+ "if(1,0) = c1(1,2) + c2(3,4), then \n",
+ "c1 = 1\n",
+ "c2 = 3\n",
+ "The transformation function T(1,0) will be:\n",
+ "T(1,0) = [3, 2, 1, 6, 5, 4, 6, 5, 4, 6, 5, 4]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "a1 = [1, 2]#\n",
+ "a2 = [3 ,4]#\n",
+ "print 'a1 = ',a1\n",
+ "print 'a2 = ',a2\n",
+ "print 'a1 and a2 are linearly independent and hence form a basis for R**2'\n",
+ "print 'According to theorem 1, there is a linear transformation from R**2 to R**3 with the transformation functions as:'\n",
+ "Ta1 = [3 ,2 ,1]#\n",
+ "Ta2 = [6, 5, 4]#\n",
+ "print 'Ta1 = ',Ta1\n",
+ "print 'Ta2 = ',Ta2\n",
+ "print 'Now, we find scalars c1 and c2 for that we know T(c1a1 + c2a2) = c1(Ta1) + c2(Ta2))'\n",
+ "print 'if(1,0) = c1(1,2) + c2(3,4), then '\n",
+ "#c = inv([a1#a2]') * [1#0]#\n",
+ "c=array([a1,a2]).dot(array([[1],[0]]))\n",
+ "c1 = c[0,0]\n",
+ "c2 = c[1,0]\n",
+ "print 'c1 = ',c1\n",
+ "print 'c2 = ',c2\n",
+ "print 'The transformation function T(1,0) will be:'\n",
+ "T = c1*Ta1 + c2*Ta2#\n",
+ "print 'T(1,0) = ',T\n",
+ "#end"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 81 Example 3.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "x1 = 3\n",
+ "x2 = 8\n",
+ "T(3,8) = [11, 3]\n",
+ "If, T(x1,x2) = 0, then\n",
+ "x1 = x2 = 0\n",
+ "So, T is non-singular\n",
+ "z1,z2 are two scalars in F\n",
+ "z1 = 0\n",
+ "z2 = 4\n",
+ "So, x1 = 4\n",
+ "x2 = -4\n",
+ "Hence, T is onto.\n",
+ "inverse(T) = [4, -4]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random\n",
+ "#x = round(rand(1,2) * 10)#\n",
+ "x1 = random.randint(1,9)\n",
+ "x2 = random.randint(1,9)\n",
+ "T = [x1+x2 ,x1]\n",
+ "print 'x1 = ',x1\n",
+ "print 'x2 = ',x2\n",
+ "print 'T(%d,%d) = '%(x1,x2),\n",
+ "print T\n",
+ "print 'If, T(x1,x2) = 0, then'\n",
+ "print 'x1 = x2 = 0'\n",
+ "print 'So, T is non-singular'\n",
+ "print 'z1,z2 are two scalars in F'\n",
+ "\n",
+ "z1 = random.randint(0,9)\n",
+ "z2 = random.randint(0,9)\n",
+ "print 'z1 = ',z1\n",
+ "print 'z2 = ',z2\n",
+ "x1 = z2#\n",
+ "x2 = z1 - z2#\n",
+ "print 'So, x1 = ',x1\n",
+ "print 'x2 = ',x2\n",
+ "print 'Hence, T is onto.'\n",
+ "Tinv = [z2, z1-z2]# \n",
+ "print 'inverse(T) = ',Tinv"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 89 Example 3.14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "T is a linear operator on F**2 defined as:\n",
+ "T(x1,x2) = (x1,0)\n",
+ "B = {e1,e2} is a standard ordered basis for F**2,then\n",
+ "So, Te1 = T(1,0) = [1, 0]\n",
+ "So, Te2 = T(0,1) = [0, 0]\n",
+ "so,matrix T in ordered basis B is: \n",
+ "T = \n",
+ "[[1, 0], [0, 0]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "print 'T is a linear operator on F**2 defined as:'\n",
+ "print 'T(x1,x2) = (x1,0)'\n",
+ "print 'B = {e1,e2} is a standard ordered basis for F**2,then'\n",
+ "x1 = 1#\n",
+ "x2 = 0#\n",
+ "Te1 = [x1, 0]#\n",
+ "x1 = 0#\n",
+ "x2 = 1#\n",
+ "Te2 = [x1 ,0]#\n",
+ "print 'So, Te1 = T(1,0) = ',Te1\n",
+ "print 'So, Te2 = T(0,1) = ',Te2\n",
+ "print 'so,matrix T in ordered basis B is: '\n",
+ "T = [Te1,Te2]\n",
+ "print 'T = \\n',T"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 89 Example 3.15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Differentiation operator D is defined as:\n",
+ "(Df1)(x) = 0\n",
+ "(Df2)(x) = 1\n",
+ "(Df3)(x) = 2*x\n",
+ "(Df4)(x) = 3*x**2\n",
+ "Matrix of D in ordered basis is:\n",
+ "[D] = \n",
+ "[[ 0. 1. 0. 0.]\n",
+ " [ 0. 0. 2. 0.]\n",
+ " [ 0. 0. 0. 3.]\n",
+ " [ 0. 0. 0. 0.]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,zeros\n",
+ "from sympy import Symbol,diff\n",
+ "print 'Differentiation operator D is defined as:'\n",
+ "D = zeros([4,4])\n",
+ "x=Symbol('x')\n",
+ "for i in range(1,5):\n",
+ " t= i-1#\n",
+ " f = diff(x**t,'x')\n",
+ " print '(Df%d)(x) = '%(i),\n",
+ " print f\n",
+ " if not(i == 1):\n",
+ " D[i-2,i-1] = i-1#\n",
+ " \n",
+ "\n",
+ "print 'Matrix of D in ordered basis is:'\n",
+ "print '[D] = \\n',D"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 92 Example 3.16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "T is a linear operator on R**2 defined as T(x1,x2) = (x1,0)\n",
+ "So, the matrix T in standard ordered basis B = {e1,e2} is \n",
+ "[T]B = [[1 0]\n",
+ " [0 0]]\n",
+ "Let B is the ordered basis for R**2 consisting of vectors:\n",
+ "E1 = [1 1]\n",
+ "E2 = [2 1]\n",
+ "So, matrix P = \n",
+ "[[1 2]\n",
+ " [1 1]]\n",
+ "P inverse = \n",
+ "[[-1. 2.]\n",
+ " [ 1. -1.]]\n",
+ "So, matrix T in ordered basis B is [T]B = \n",
+ "[[-1. 0.]\n",
+ " [ 0. -0.]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,transpose,linalg\n",
+ "print 'T is a linear operator on R**2 defined as T(x1,x2) = (x1,0)'\n",
+ "print 'So, the matrix T in standard ordered basis B = {e1,e2} is '\n",
+ "T = array([[1, 0],[0, 0]])\n",
+ "print '[T]B = ',T\n",
+ "print 'Let B'' is the ordered basis for R**2 consisting of vectors:'\n",
+ "E1 = array([1, 1])\n",
+ "E2 = array([2 ,1])\n",
+ "print 'E1 = ',E1\n",
+ "print 'E2 = ',E2\n",
+ "P = transpose(([E1,E2]))\n",
+ "print 'So, matrix P = \\n',P\n",
+ "Pinv=linalg.inv(P)\n",
+ "print 'P inverse = \\n',Pinv\n",
+ "T1 = Pinv*T*P#\n",
+ "print 'So, matrix T in ordered basis B'' is [T]B'' = \\n',T1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 93 Example 3.17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "g1 = f1\n",
+ "g2 = t*f1 + f2\n",
+ "g3 = t**2*f1 + 2*t*f2 + f3\n",
+ "g4 = t**3*f1 + 3*t**2*f2 + 3*t*f3 + f4\n",
+ "P = \n",
+ "Matrix([[1, t, t**2, t**3], [0, 1, 2*t, 3*t**2], [0, 0, 1, 3*t], [0, 0, 0, 1]])\n",
+ "inverse P = \n",
+ "Matrix([[1, -t, t**2, -t**3], [0, 1, -2*t, 3*t**2], [0, 0, 1, -3*t], [0, 0, 0, 1]])\n",
+ "Matrix of differentiation operator D in ordered basis B is:\n",
+ "D = \n",
+ "Matrix([[0, 1, 0, 0], [0, 0, 2, 0], [0, 0, 0, 3], [0, 0, 0, 0]])\n",
+ "Matrix of D in ordered basis B is:\n",
+ "inverse(P) * D * P = Matrix([[0, 1, 0, 0], [0, 0, 2, 0], [0, 0, 0, 3], [0, 0, 0, 0]])\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol, Matrix\n",
+ "t = Symbol(\"t\")\n",
+ "print 'g1 = f1'\n",
+ "print 'g2 = t*f1 + f2'\n",
+ "print 'g3 = t**2*f1 + 2*t*f2 + f3'\n",
+ "print 'g4 = t**3*f1 + 3*t**2*f2 + 3*t*f3 + f4'\n",
+ "P = Matrix(([1, t, t**2, t**3],[0 ,1 ,2*t, 3*t**2],[0, 0, 1, 3*t],[0, 0, 0, 1]))\n",
+ "print 'P = \\n',P\n",
+ "\n",
+ "print 'inverse P = \\n',Matrix.inv(P)\n",
+ "\n",
+ "\n",
+ "\n",
+ "print 'Matrix of differentiation operator D in ordered basis B is:'# #As found in example 15\n",
+ "D = Matrix(([0, 1, 0, 0],[0, 0, 2, 0],[0, 0, 0, 3],[0, 0, 0, 0]))\n",
+ "print 'D = \\n',D\n",
+ "print 'Matrix of D in ordered basis B'' is:'\n",
+ "print 'inverse(P) * D * P = ',Matrix.inv(P)*D*P\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 98 Example 3.19"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "n = 5\n",
+ "A = \n",
+ "[[ 5. 9. 7. 8. 6.]\n",
+ " [ 3. 3. 2. 7. 6.]\n",
+ " [ 5. 1. 3. 2. 6.]\n",
+ " [ 1. 2. 10. 4. 1.]\n",
+ " [ 9. 0. 7. 5. 7.]]\n",
+ "Trace of A:\n",
+ "tr(A) = 22.0\n",
+ "--------------------------------\n",
+ "c = 2\n",
+ "B = \n",
+ "[[ 6. 8. 8. 2. 4.]\n",
+ " [ 7. 6. 4. 3. 7.]\n",
+ " [ 6. 9. 8. 4. 8.]\n",
+ " [ 1. 4. 8. 4. 6.]\n",
+ " [ 10. 8. 2. 1. 6.]]\n",
+ "Trace of B:\n",
+ "tr(B) = 30.0\n",
+ "tr(cA + B) = 74.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random\n",
+ "def trace_matrix(M,n):\n",
+ " tr=0\n",
+ " for i in range(0,n):\n",
+ " tr = tr + M[i,i]#\n",
+ " return tr\n",
+ "#n = round(rand() * 10 + 2)#\n",
+ "n=random.randint(1,9)\n",
+ "print 'n = ',n\n",
+ "#A = round(rand(n,n) * 10)#\n",
+ "A=random.rand(n,n)\n",
+ "for x in range(0,n):\n",
+ " for y in range(0,n):\n",
+ " A[x,y]=round(A[x,y]*10)\n",
+ "print 'A = \\n',A\n",
+ "\n",
+ "\n",
+ "tr = 0#\n",
+ "print 'Trace of A:'\n",
+ "tr1 = trace_matrix(A,n)#\n",
+ "print 'tr(A) = ',tr1\n",
+ "print '--------------------------------'\n",
+ "#c = round(rand() * 10 + 2)#\n",
+ "c=random.randint(2,9)\n",
+ "print 'c = ',c\n",
+ "\n",
+ "B=random.rand(n,n)\n",
+ "for x in range(0,n):\n",
+ " for y in range(0,n):\n",
+ " B[x,y]=round(B[x,y]*10)\n",
+ "print 'B = \\n',B\n",
+ "\n",
+ "print 'Trace of B:'\n",
+ "tr2 = trace_matrix(B,n)#\n",
+ "print 'tr(B) = ',tr2\n",
+ "print 'tr(cA + B) = ',(c*tr1+tr2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 103 Example 3.23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Matrix represented by given linear functionals on R**4:\n",
+ "A = \n",
+ "[[ 1 2 2 1]\n",
+ " [ 0 2 0 1]\n",
+ " [-2 0 -4 3]]\n",
+ "To find Row reduced echelon matrix of A given by R:\n",
+ "Applying row transformations on A,we get\n",
+ "R1 = R1-R2\n",
+ "A = \n",
+ "[[ 1 0 2 0]\n",
+ " [ 0 2 0 1]\n",
+ " [-2 0 -4 3]]\n",
+ "R3 = R3 + 2*R1\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 2 0 1]\n",
+ " [0 0 0 3]]\n",
+ "R3 = R3/3\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 2 0 1]\n",
+ " [0 0 0 1]]\n",
+ "R2 = R2/2\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 1 0 0]\n",
+ " [0 0 0 1]]\n",
+ "R2 = R2 - 1/2*R3\n",
+ "A = \n",
+ "[[1 0 2 0]\n",
+ " [0 1 0 0]\n",
+ " [0 0 0 1]]\n",
+ "Row reduced echelon matrix of A is:\n",
+ "R = \n",
+ "[[1 0 2 0]\n",
+ " [0 1 0 0]\n",
+ " [0 0 0 1]]\n",
+ "Therefore,linear functionals g1,g2,g3 span the same subspace of (R**4)* as f1,f2,f3 are given by:\n",
+ "g1(x1,x2,x3,x4) = x1 + 2*x3\n",
+ "g1(x1,x2,x3,x4) = x2\n",
+ "g1(x1,x2,x3,x4) = x4\n",
+ "The subspace consists of the vectors with\n",
+ "x1 = -2*x3\n",
+ "x2 = x4 = 0\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "print 'Matrix represented by given linear functionals on R**4:'\n",
+ "A = array([[1, 2 ,2 ,1],[0, 2, 0, 1],[-2 ,0 ,-4, 3]])\n",
+ "print 'A = \\n',A\n",
+ "T = A #Temporary matrix to store A\n",
+ "print 'To find Row reduced echelon matrix of A given by R:'\n",
+ "print 'Applying row transformations on A,we get'\n",
+ "print 'R1 = R1-R2'\n",
+ "A[0,:] = A[0,:] - A[1,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'R3 = R3 + 2*R1'\n",
+ "A[2,:] = A[2,:] + 2*A[0,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'R3 = R3/3'\n",
+ "A[2,:] = 1./3*A[2,:]#\n",
+ "print 'A = \\n',A\n",
+ "print 'R2 = R2/2'\n",
+ "A[1,:] = 1./2*A[1,:]\n",
+ "print 'A = \\n',A\n",
+ "print 'R2 = R2 - 1/2*R3'\n",
+ "A[1,:] = A[1,:] - 1./2*A[2,:]\n",
+ "print 'A = \\n',A\n",
+ "R = A#\n",
+ "A = T#\n",
+ "print 'Row reduced echelon matrix of A is:'\n",
+ "print 'R = \\n',R\n",
+ "print 'Therefore,linear functionals g1,g2,g3 span the same subspace of (R**4)* as f1,f2,f3 are given by:'\n",
+ "print 'g1(x1,x2,x3,x4) = x1 + 2*x3'\n",
+ "print 'g1(x1,x2,x3,x4) = x2'\n",
+ "print 'g1(x1,x2,x3,x4) = x4'\n",
+ "print 'The subspace consists of the vectors with'\n",
+ "print 'x1 = -2*x3'\n",
+ "print 'x2 = x4 = 0'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 104 Example 3.24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "W be the subspace of R**5 spanned by vectors:\n",
+ "a1 = [2, -2, 3, 4, -1]\n",
+ "a2 = [-1, 1, 2, 5, 2]\n",
+ "a3 = [0, 0, -1, -2, 3]\n",
+ "a4 = [1, -1, 2, 3, 0]\n",
+ "Matrix A by the row vectors a1,a2,a3,a4 will be:\n",
+ "A = \n",
+ "[[ 2 -2 3 4 -1]\n",
+ " [-1 1 2 5 2]\n",
+ " [ 0 0 -1 -2 3]\n",
+ " [ 1 -1 2 3 0]]\n",
+ "After Applying row transformations, we get the row reduced echelon matrix R of A\n",
+ "R = \n",
+ "[[ 1 -1 0 -1 0]\n",
+ " [ 0 0 1 2 0]\n",
+ " [ 0 0 0 0 1]\n",
+ " [ 0 0 0 0 0]]\n",
+ "Then we obtain all the linear functionals f by assigning arbitrary values to c2 and c4\n",
+ "Let c2 = a, c4 = b then c1 = a+b, c3 = -2b, c5 = 0.\n",
+ "So, W0 consists all linear functionals f of the form\n",
+ "f(x1,x2,x3,x4,x5) = (a+b)x1 + ax2 -2bx3 + bx4\n",
+ "Dimension of W0 = 2 and basis {f1,f2} can be found by first taking a = 1, b = 0. Then a = 0,b = 1\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "print 'W be the subspace of R**5 spanned by vectors:'\n",
+ "a1 = [2, -2, 3 ,4 ,-1]#\n",
+ "a2 = [-1, 1, 2, 5, 2]#\n",
+ "a3 = [0 ,0 ,-1, -2, 3]#\n",
+ "a4 = [1 ,-1, 2, 3 ,0]#\n",
+ "print 'a1 = ',a1\n",
+ "print 'a2 = ',a2\n",
+ "print 'a3 = ',a3\n",
+ "print 'a4 = ',a4\n",
+ "print 'Matrix A by the row vectors a1,a2,a3,a4 will be:'\n",
+ "A = array([a1,a2,a3,a4])\n",
+ "print 'A = \\n',A\n",
+ "print 'After Applying row transformations, we get the row reduced echelon matrix R of A'\n",
+ "\n",
+ "T = A# #Temporary matrix to store A\n",
+ "#R1 = R1 - R4 and R2 = R2 + R4\n",
+ "A[0,:] = A[0,:] - A[3,:]#\n",
+ "A[1,:] = A[1,:] + A[3,:]#\n",
+ "#R2 = R2/2\n",
+ "A[1,:] = 1./2 * A[1,:]#\n",
+ "#R3 = R3 + R2 and R4 = R4 - R1\n",
+ "A[2,:] = A[2,:] + A[1,:]#\n",
+ "A[3,:] = A[3,:] - A[0,:]#\n",
+ "#R3 = R3 - R4\n",
+ "A[2,:] = A[2,:] - A[3,:]#\n",
+ "#R3 = R3/3\n",
+ "A[2,:] = 1./3 * A[2,:]#\n",
+ "#R2 = R2 - R3\n",
+ "A[1,:] = A[1,:] - A[2,:]#\n",
+ "#R2 = R2/2 and R4 = R4 - R2 - R3\n",
+ "A[1,:] = 1./2 * A[1,:]#\n",
+ "A[3,:] = A[3,:] - A[1,:] - A[2,:]#\n",
+ "#R1 = R1 - R2 + R3\n",
+ "A[0,:] = A[0,:] - A[1,:] + A[2,:]#\n",
+ "R = A#\n",
+ "A = T#\n",
+ "print 'R = \\n',R\n",
+ "print 'Then we obtain all the linear functionals f by assigning arbitrary values to c2 and c4'\n",
+ "print 'Let c2 = a, c4 = b then c1 = a+b, c3 = -2b, c5 = 0.'\n",
+ "print 'So, W0 consists all linear functionals f of the form'\n",
+ "print 'f(x1,x2,x3,x4,x5) = (a+b)x1 + ax2 -2bx3 + bx4'\n",
+ "print 'Dimension of W0 = 2 and basis {f1,f2} can be found by first taking a = 1, b = 0. Then a = 0,b = 1'"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter4_JbH1k27.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter4_JbH1k27.ipynb
new file mode 100644
index 00000000..c3b1c0c4
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter4_JbH1k27.ipynb
@@ -0,0 +1,327 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 4 - Polynomials"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 121 Example 4.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "C is the field of complex numbers\n",
+ "f = x**2 + 2\n",
+ "if a = C and z belongs to C, then f(z) = z**2 + 2\n",
+ "f(2) = 6\n",
+ "f(1+1J/1-1J) = (1+0j)\n",
+ "----------------------------------------\n",
+ "If a is the algebra of all 2*2 matrices over C and\n",
+ "B = \n",
+ "[[ 1 0]\n",
+ " [-1 2]]\n",
+ "[[ 3. 0.]\n",
+ " [ 1. 6.]] then, f(B) = \n",
+ "----------------------------------------\n",
+ "If a is algebra of all linear operators on C**3\n",
+ "And T is element of a as:\n",
+ "T(c1,c2,c3) = (i*2**1/2*c1,c2,i*2**1/2*c3)\n",
+ "Then, f(T)(c1,c2,c3) = (0,3*c2,0)\n",
+ "----------------------------------------\n",
+ "If a is the algebra of all polynomials over C\n",
+ "And, g = x**4 + 3.0*I\n",
+ "Then f(g) = (16+3j)\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,identity\n",
+ "from sympy import Symbol\n",
+ "print 'C is the field of complex numbers'\n",
+ "x = Symbol(\"x\")\n",
+ "def f(x):\n",
+ " ff= x**2 + 2\n",
+ " return ff\n",
+ "print 'f = ',f(x)\n",
+ "#part a\n",
+ "print 'if a = C and z belongs to C, then f(z) = z**2 + 2'\n",
+ "print 'f(2) = ',f(2)\n",
+ "\n",
+ "\n",
+ "print 'f(1+1J/1-1J) = ',f((1+1J)/(1-1J))\n",
+ "print '----------------------------------------'\n",
+ "\n",
+ "\n",
+ "#part b\n",
+ "print 'If a is the algebra of all 2*2 matrices over C and'\n",
+ "B = array([[1 ,0],[-1, 2]])\n",
+ "print 'B = \\n',B\n",
+ "print 2*identity(2) + B**2,'then, f(B) = '\n",
+ "print '----------------------------------------'\n",
+ "\n",
+ "#part c\n",
+ "print 'If a is algebra of all linear operators on C**3'\n",
+ "print 'And T is element of a as:'\n",
+ "print 'T(c1,c2,c3) = (i*2**1/2*c1,c2,i*2**1/2*c3)'\n",
+ "print 'Then, f(T)(c1,c2,c3) = (0,3*c2,0)'\n",
+ "print '----------------------------------------'\n",
+ "#part d\n",
+ "print 'If a is the algebra of all polynomials over C'\n",
+ "def g(x):\n",
+ " gg= x**4 + 3*1J\n",
+ " return gg\n",
+ "print 'And, g = ',g(x)\n",
+ "print 'Then f(g) = ',g(2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 131 Example 4.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "M = (x+2)F[x] + (x**2 + 8x + 16)F[x]\n",
+ "We assert, M = F[x]\n",
+ "M contains: x**2 - x*(x + 2) + 8*x + 16\n",
+ "And hence M contains: x**2 - x*(x + 2) + 2*x + 4\n",
+ "Thus the scalar polynomial 1 belongs to M as well all its multiples.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol\n",
+ "x = Symbol('x')\n",
+ "p1 = x + 2#\n",
+ "p2 = x**2 + 8*x + 16#\n",
+ "print 'M = (x+2)F[x] + (x**2 + 8x + 16)F[x]'\n",
+ "print 'We assert, M = F[x]'\n",
+ "print 'M contains:',\n",
+ "t = p2 - x*p1#\n",
+ "print t\n",
+ "print 'And hence M contains:',\n",
+ "print t - 6*p1\n",
+ "print 'Thus the scalar polynomial 1 belongs to M as well all its multiples.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 133 Example 4.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "p1 = x + 2\n",
+ "p2 = x**2 + 8*x + 16\n",
+ "M = (x+2)F[x] + (x**2 + 8x + 16)F[x]\n",
+ "We assert, M = F[x]\n",
+ "M contains: x**2 - x*(x + 2) + 8*x + 16\n",
+ "And hence M contains: x**2 - x*(x + 2) + 2*x + 4\n",
+ "Thus the scalar polynomial 1 belongs to M as well all its multiples\n",
+ "So, gcd(p1,p2) = 1\n",
+ "----------------------------------------------\n",
+ "p1 = (x - 2)**2*(x + 1.0*I)\n",
+ "p2 = (x - 2)*(x**2 + 1)\n",
+ "M = (x - 2)**2*(x+1J)F[x] + (x-2)*(x**2 + 1\n",
+ "The ideal M contains p1 - p2 i.e., (x - 2)**2*(x + 1.0*I) - (x - 2)*(x**2 + 1)\n",
+ "Hence it contains (x-2)(x+i), which is monic and divides both,\n",
+ "So, gcd(p1,p2) = (x-2)(x+i)\n",
+ "----------------------------------------------\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol\n",
+ "x = Symbol('x')\n",
+ "\n",
+ "#part a\n",
+ "p1 = x + 2#\n",
+ "p2 = x**2 + 8*x + 16#\n",
+ "print 'p1 = ',p1\n",
+ "print 'p2 = ',p2\n",
+ "print 'M = (x+2)F[x] + (x**2 + 8x + 16)F[x]'\n",
+ "print 'We assert, M = F[x]'\n",
+ "print 'M contains:',\n",
+ "t = p2 - x*p1#\n",
+ "print t\n",
+ "print 'And hence M contains:',\n",
+ "print t - 6*p1\n",
+ "print 'Thus the scalar polynomial 1 belongs to M as well all its multiples'\n",
+ "print 'So, gcd(p1,p2) = 1'\n",
+ "print '----------------------------------------------'\n",
+ "#part b\n",
+ "p1 = (x - 2)**2*(x+1J)#\n",
+ "p2 = (x-2)*(x**2 + 1)#\n",
+ "print 'p1 = ',p1\n",
+ "print 'p2 = ',p2\n",
+ "print 'M = (x - 2)**2*(x+1J)F[x] + (x-2)*(x**2 + 1'\n",
+ "print 'The ideal M contains p1 - p2 i.e.,',\n",
+ "print p1 - p2\n",
+ "print 'Hence it contains (x-2)(x+i), which is monic and divides both,'\n",
+ "print 'So, gcd(p1,p2) = (x-2)(x+i)'\n",
+ "print '----------------------------------------------'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 133 Example 4.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "M is the ideal in F[x] generated by:\n",
+ "(x-1)*(x+2)**2\n",
+ "(x+2)**2*(x+3)\n",
+ "(x-3) and\n",
+ "M = (x-1)*(x+2)**2 F[x] + (x+2)**2*(x-3) + (x-3)\n",
+ "Then M contains: 0\n",
+ "i.e., M contains (x+2)**2\n",
+ "and since, (x+2)**2 = (x-3)(x-7) - 17\n",
+ "So M contains the scalar polynomial 1.\n",
+ "So, M = F[x] and given polynomials are relatively prime.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol\n",
+ "x = Symbol('x')\n",
+ "\n",
+ "print 'M is the ideal in F[x] generated by:'\n",
+ "print '(x-1)*(x+2)**2'\n",
+ "print '(x+2)**2*(x+3)'\n",
+ "print '(x-3)','and'\n",
+ "p1 = (x-1)*(x+2)**2#\n",
+ "p2 = (x+2)**2*(x-3)#\n",
+ "p3 = (x-3)#\n",
+ "print 'M = (x-1)*(x+2)**2 F[x] + (x+2)**2*(x-3) + (x-3)'\n",
+ "print 'Then M contains:',\n",
+ "t = 1/2*(x+2)**2*((x-1) - (x-3))#\n",
+ "print t\n",
+ "print 'i.e., M contains (x+2)**2'\n",
+ "print 'and since, (x+2)**2 = (x-3)(x-7) - 17'\n",
+ "print 'So M contains the scalar polynomial 1.'\n",
+ "print 'So, M = F[x] and given polynomials are relatively prime.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 135 Example 4.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "x**2 + 1 P = \n",
+ "P is reducible over complex numbers as: = x**2 + 1\n",
+ "(x-i)(x+i)\n",
+ "Whereas, P is irreducible over real numbers as: = x**2 + 1\n",
+ "(ax + b)(ax + b)\n",
+ "For, a,a,b,b to be in R,\n",
+ "aa = 1\n",
+ "ab + ba = 0\n",
+ "bb = 1\n",
+ "=> a**2 + b**2 = 0\n",
+ "=> a = b = 0\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol\n",
+ "x = Symbol('x')\n",
+ "P = x**2 + 1#\n",
+ "print P,'P = '\n",
+ "print 'P is reducible over complex numbers as: ',\n",
+ "print '=',P\n",
+ "print '(x-i)(x+i)'\n",
+ "print 'Whereas, P is irreducible over real numbers as:',\n",
+ "print '=',P\n",
+ "print '(ax + b)(a''x + b'')'\n",
+ "print 'For, a,a'',b,b'' to be in R,'\n",
+ "print 'aa'' = 1'\n",
+ "print 'ab'' + ba'' = 0'\n",
+ "print 'bb'' = 1'\n",
+ "print '=> a**2 + b**2 = 0'\n",
+ "print '=> a = b = 0'"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter5_0VUnA6n.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter5_0VUnA6n.ipynb
new file mode 100644
index 00000000..aa99d655
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter5_0VUnA6n.ipynb
@@ -0,0 +1,357 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 5 - Determinants"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 143 Example 5.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "[[ 7. 9.]\n",
+ " [ 1. 8.]]\n",
+ "D1(A) = 56.0\n",
+ "D2(A) = -9.0\n",
+ "D(A) = D1(A) + D2(A) = 47.0\n",
+ "That is, D is a 2-linear function.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import random\n",
+ "A = random.rand(2,2)\n",
+ "for x in range(0,2):\n",
+ " for y in range(0,2):\n",
+ " A[x,y]=round(A[x,y]*10)\n",
+ "print 'A = \\n',A\n",
+ "\n",
+ "D1 = A[0,0]*A[1,1]\n",
+ "D2 = - A[0,1]*A[1,0]\n",
+ "print 'D1(A) = ',D1\n",
+ "print 'D2(A) = ',D2\n",
+ "print 'D(A) = D1(A) + D2(A) = ',D1 + D2\n",
+ "print 'That is, D is a 2-linear function.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 145 Example 5.4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "Matrix([[x, 0, -x**2], [0, 1, 0], [1, 0, x**3]])\n",
+ "e1,e2,e3 are the rows of 3*3 identity matrix, then\n",
+ "e1 = [ 1. 0. 0.]\n",
+ "e2 = [ 0. 1. 0.]\n",
+ "e3 = [ 0. 0. 1.]\n",
+ "D(A) = D(x*e1 - x**2*e3, e2, e1 + x**3*e3)\n",
+ "Since, D is linear as a function of each row,\n",
+ "D(A) = x*D(e1,e2,e1 + x**3*e3) - x**2*D(e3,e2,e1 + x**3*e3)\n",
+ "D(A) = x*D(e1,e2,e1) + x**4*D(e1,e2,e3) - x**2*D(e3,e2,e1) - x**5*D(e3,e2,e3)\n",
+ "As D is alternating, So\n",
+ "D(A) = (x**4 + x**2)*D(e1,e2,e3)\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,identity\n",
+ "from sympy import Symbol,Matrix\n",
+ "\n",
+ "x = Symbol(\"x\")\n",
+ "A = Matrix(([x, 0, -x**2],[0, 1, 0],[1, 0, x**3]))\n",
+ "print 'A = \\n',A\n",
+ "print 'e1,e2,e3 are the rows of 3*3 identity matrix, then'\n",
+ "T = identity(3)\n",
+ "e1 = T[0,:]\n",
+ "e2 = T[1,:]\n",
+ "e3 = T[2,:]\n",
+ "print 'e1 = ',e1\n",
+ "print 'e2 = ',e2\n",
+ "print 'e3 = ',e3\n",
+ "print 'D(A) = D(x*e1 - x**2*e3, e2, e1 + x**3*e3)'\n",
+ "print 'Since, D is linear as a function of each row,'\n",
+ "print 'D(A) = x*D(e1,e2,e1 + x**3*e3) - x**2*D(e3,e2,e1 + x**3*e3)'\n",
+ "print 'D(A) = x*D(e1,e2,e1) + x**4*D(e1,e2,e3) - x**2*D(e3,e2,e1) - x**5*D(e3,e2,e3)'\n",
+ "print 'As D is alternating, So'\n",
+ "print 'D(A) = (x**4 + x**2)*D(e1,e2,e3)'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 147 Example 5.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "Matrix([[x - 1, x**2, x**3], [0, x - 2, 1], [0, 0, x - 3]])\n",
+ "\n",
+ "E(A) = x**3 - 6*x**2 + 11*x - 6\n",
+ "--------------------------------------\n",
+ "A = \n",
+ "Matrix([[0, 1, 0], [0, 0, 1], [1, 0, 0]])\n",
+ "\n",
+ "E(A) = 1\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol, Matrix\n",
+ "\n",
+ "#part a\n",
+ "x = Symbol('x')\n",
+ "A = Matrix(([x-1, x**2, x**3],[0, x-2, 1],[0, 0, x-3]))\n",
+ "print 'A = \\n',A\n",
+ "print '\\nE(A) = ',A.det()\n",
+ "print '--------------------------------------'\n",
+ "#part b\n",
+ "A = Matrix(([0 ,1, 0],[0, 0, 1],[1 ,0, 0]))\n",
+ "print 'A = \\n',A\n",
+ "print '\\nE(A) = ',A.det()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 158 Example 5.6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Given Matrix:\n",
+ "A = \n",
+ "[[ 1 -1 2 3]\n",
+ " [ 2 2 0 2]\n",
+ " [ 4 1 -1 -1]\n",
+ " [ 1 2 3 0]]\n",
+ "After, Subtracting muliples of row 1 from rows 2 3 4\n",
+ "R2 = R2 - 2*R1\n",
+ "R3 = R3 - 4*R1\n",
+ "R4 = R4 - R1\n",
+ "A = \n",
+ "[[ 1 -1 2 3]\n",
+ " [ 0 4 -4 -4]\n",
+ " [ 0 5 -9 -13]\n",
+ " [ 0 3 1 -3]]\n",
+ "We obtain the same determinant as before.\n",
+ "Now, applying some more row transformations as:\n",
+ "R3 = R3 - 5/4 * R2\n",
+ "R4 = R4 - 3/4 * R2\n",
+ "We get B as:\n",
+ "B = \n",
+ "[[ 1 -1 2 3]\n",
+ " [ 0 4 -4 -4]\n",
+ " [ 0 0 -4 -8]\n",
+ " [ 0 0 4 0]]\n",
+ "Now,determinant of A and B will be same\n",
+ "det A = det B = 128.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,linalg\n",
+ "\n",
+ "print 'Given Matrix:'\n",
+ "A = array([[1, -1, 2, 3],[ 2, 2, 0, 2],[ 4, 1 ,-1, -1],[1, 2, 3, 0]])\n",
+ "print 'A = \\n',A\n",
+ "print 'After, Subtracting muliples of row 1 from rows 2 3 4'\n",
+ "print 'R2 = R2 - 2*R1'\n",
+ "A[1,:] = A[1,:] - 2 * A[0,:]\n",
+ "print 'R3 = R3 - 4*R1'\n",
+ "A[2,:] = A[2,:] - 4 * A[0,:]\n",
+ "print 'R4 = R4 - R1'\n",
+ "A[3,:] = A[3,:] - A[0,:]\n",
+ "print 'A = \\n',A\n",
+ "T = A# #Temporary matrix to store A\n",
+ "print 'We obtain the same determinant as before.'\n",
+ "print 'Now, applying some more row transformations as:'\n",
+ "print 'R3 = R3 - 5/4 * R2'\n",
+ "T[2,:] = T[2,:] - 5./4 * T[1,:]\n",
+ "print 'R4 = R4 - 3/4 * R2'\n",
+ "T[3,:] = T[3,:] - 3./4 * T[1,:]\n",
+ "B = T#\n",
+ "print 'We get B as:'\n",
+ "print 'B = \\n',B\n",
+ "print 'Now,determinant of A and B will be same'\n",
+ "print 'det A = det B = ',linalg.det(B)\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 160 Example 5.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "Matrix([[x**2 + x, x + 1], [x - 1, 1]])\n",
+ "B = \n",
+ "Matrix([[x**2 - 1, x + 2], [x**2 - 2*x + 3, x]])\n",
+ "det A = x + 1\n",
+ "det B = -6\n",
+ "Thus, A is not invertible over K whereas B is invertible\n",
+ "adj A = Matrix([[(x + 1)*((x - 1)/(x*(x + 1)) + 1/(x*(x + 1))), -x - 1], [-x + 1, x*(x + 1)]])\n",
+ "adj B = Matrix([[-6*(x + 2)*(-x**2/6 + 1/6)*(x**2 - 2*x + 3)/(x**2 - 1)**2 - 6/(x**2 - 1), 6*(x + 2)*(-x**2/6 + 1/6)/(x**2 - 1)], [6*(-x**2/6 + 1/6)*(x**2 - 2*x + 3)/(x**2 - 1), x**2 - 1]])\n",
+ "(adj A)A = (x+1)I\n",
+ "(adj B)B = -6I\n",
+ "B inverse = Matrix([[(x + 2)*(-x**2/6 + 1/6)*(x**2 - 2*x + 3)/(x**2 - 1)**2 + 1/(x**2 - 1), -(x + 2)*(-x**2/6 + 1/6)/(x**2 - 1)], [-(-x**2/6 + 1/6)*(x**2 - 2*x + 3)/(x**2 - 1), -x**2/6 + 1/6]])\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol, Matrix\n",
+ "\n",
+ "x = Symbol(\"x\")\n",
+ "A = Matrix(([x**2+x, x+1],[x-1, 1]))\n",
+ "B = Matrix(([x**2-1, x+2],[x**2-2*x+3, x]))\n",
+ "print 'A = \\n',A\n",
+ "print 'B = \\n',B\n",
+ "print 'det A = ',A.det()\n",
+ "print 'det B = ',B.det()\n",
+ "print 'Thus, A is not invertible over K whereas B is invertible'\n",
+ "\n",
+ "print 'adj A = ',(A**-1)*A.det()\n",
+ "print 'adj B = ',(B**-1)*B.det()\n",
+ "print '(adj A)A = (x+1)I'\n",
+ "print '(adj B)B = -6I'\n",
+ "print 'B inverse = ',B**-1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 161 Example 5.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "[[1 2]\n",
+ " [3 4]]\n",
+ "det A = Determinant of A is: -2.0\n",
+ "Adjoint of A is: [[-2. -0. ]\n",
+ " [-0. -0.5]]\n",
+ "Thus, A is not invertible as a matrix over the ring of integers.\n",
+ "But, A can be regarded as a matrix over field of rational numbers.\n",
+ "Then, A is invertible and Inverse of A is: [[-2. 1. ]\n",
+ " [ 1.5 -0.5]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,linalg,identity\n",
+ "\n",
+ "A = array([[1, 2],[3, 4]])\n",
+ "print 'A = \\n',A\n",
+ "d = linalg.det(A)#\n",
+ "print 'det A = ','Determinant of A is:',d\n",
+ "\n",
+ "\n",
+ "ad = (d* identity(2)) / A\n",
+ "print 'Adjoint of A is:',ad\n",
+ "\n",
+ "\n",
+ "print 'Thus, A is not invertible as a matrix over the ring of integers.'\n",
+ "print 'But, A can be regarded as a matrix over field of rational numbers.'\n",
+ "In = linalg.inv(A)#\n",
+ "#The A inverse matrix given in book has a wrong entry of 1/2. It should be -1/2.\n",
+ "print 'Then, A is invertible and Inverse of A is:',In\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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter6_Vet62xI.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter6_Vet62xI.ipynb
new file mode 100644
index 00000000..5499419a
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter6_Vet62xI.ipynb
@@ -0,0 +1,503 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 6 - Elementary canonical forms"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 184 Example 6.1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Standard ordered matrix for Linear operator T on R**2 is:\n",
+ "A = \n",
+ "Matrix([[0, -1], [1, 0]])\n",
+ "The characteristic polynomial for T or A is: Matrix([[x, 1], [-1, x]])\n",
+ "Since this polynomial has no real roots,T has no characteristic values.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol,Matrix,eye\n",
+ "print 'Standard ordered matrix for Linear operator T on R**2 is:'\n",
+ "A = Matrix(([0, -1],[1 ,0]))\n",
+ "print 'A = \\n',A\n",
+ "print 'The characteristic polynomial for T or A is:',\n",
+ "x = Symbol(\"x\")\n",
+ "p = (x*eye(2)-A)\n",
+ "print p\n",
+ "print 'Since this polynomial has no real roots,T has no characteristic values.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 184 Example 6.2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "Matrix([[3, 1, -1], [2, 2, -1], [2, 2, 0]])\n",
+ "Characteristic polynomial for A is: x**3 - 5*x**2 + 8*x - 4\n",
+ "or\n",
+ "(x-1)(x-2)**2\n",
+ "The characteristic values of A are:\n",
+ "[1, 2]\n",
+ "Now, A-I = \n",
+ "Matrix([[2, 1, -1], [2, 1, -1], [2, 2, -1]])\n",
+ "rank of A - I= 2\n",
+ "So, nullity of T-I = 1\n",
+ "The vector that spans the null space of T-I = [1, 0, 2]\n",
+ "Now,A-2I = \n",
+ "Matrix([[1, 1, -1], [2, 0, -1], [2, 2, -2]])\n",
+ "rank of A - 2I= 2\n",
+ "T*alpha = 2*alpha if alpha is a scalar multiple of a2\n",
+ "a2 = [1, 1, 2]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from sympy import Symbol,Matrix,eye,solve\n",
+ "A = Matrix(([3, 1, -1],[ 2, 2, -1],[2, 2, 0]))\n",
+ "print 'A = \\n',A\n",
+ "print 'Characteristic polynomial for A is:',\n",
+ "x=Symbol('x')\n",
+ "p = A.charpoly(x)#\n",
+ "print p.as_expr()\n",
+ "print 'or'\n",
+ "print '(x-1)(x-2)**2'\n",
+ "\n",
+ "r = solve(p.as_expr())#\n",
+ "[m,n] = A.shape\n",
+ "print 'The characteristic values of A are:'\n",
+ "print r #print round(r)\n",
+ "B = A-eye(m)\n",
+ "print 'Now, A-I = \\n',B\n",
+ "\n",
+ "print 'rank of A - I= ',B.rank()\n",
+ "print 'So, nullity of T-I = 1'\n",
+ "a1 = [1 ,0 ,2]#\n",
+ "print 'The vector that spans the null space of T-I = ',a1\n",
+ "B = A-2*eye(m)\n",
+ "print 'Now,A-2I = \\n',B\n",
+ "print 'rank of A - 2I= ',B.rank()\n",
+ "print 'T*alpha = 2*alpha if alpha is a scalar multiple of a2'\n",
+ "a2 = [1 ,1 ,2]\n",
+ "print 'a2 = ',a2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 187 Example 6.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Standard ordered matrix for Linear operator T on R**3 is:\n",
+ "A = \n",
+ "Matrix([[5, -6, -6], [-1, 4, 2], [3, -6, -4]])\n",
+ "xI - A = \n",
+ "Matrix([[x - 5, 6, 6], [1, x - 4, -2], [-3, 6, x + 4]])\n",
+ "Applying row and column transformations:\n",
+ "C2 = C2 - C3\n",
+ "=>\n",
+ "Matrix([[x - 5, 0, 6], [1, x - 2, -2], [-3, -x + 2, x + 4]])\n",
+ "Taking (x-2) common from C2\n",
+ "=>\n",
+ " * x - 2\n",
+ "Matrix([[x - 5, 0, 6], [1, 1, -2], [-3, (-x + 2)/(x - 2), x + 4]])\n",
+ "R3 = R3 + R2\n",
+ "=>\n",
+ " * x - 2\n",
+ "Matrix([[x - 5, 0, 6], [1, 1, -2], [-2, (-x + 2)/(x - 2) + 1, x + 2]])\n",
+ "=>\n",
+ " * x - 2\n",
+ "Matrix([[x - 5, 6], [-2, x + 2]])\n",
+ "=>\n",
+ " * x - 2\n",
+ "x**2 - 3*x + 2\n",
+ "This is the characteristic polynomial\n",
+ "Now, A - I = Matrix([[4, -6, -6], [-1, 3, 2], [3, -6, -5]])\n",
+ "And, A- 2I = Matrix([[3, -6, -6], [-1, 2, 2], [3, -6, -6]])\n",
+ "rank(A-I) = 2\n",
+ "rank(A-2I) = 2\n",
+ "W1,W2 be the spaces of characteristic vectors associated with values 1,2\n",
+ "So by theorem 2, T is diagonalizable\n",
+ "Null space of (T- I) i.e basis of W1 is spanned by a1 = [[ 3 -1 3]]\n",
+ "Null space of (T- 2I) i.e. basis of W2 is spanned by vectors x1,x2,x3 such that x1 = 2x1 + 2x3\n",
+ "One example :\n",
+ "a2 = [[2 1 0]]\n",
+ "a3 = [[2 0 1]]\n",
+ "The diagonal matrix is:\n",
+ "D = [[1 0 0]\n",
+ " [0 2 0]\n",
+ " [0 0 2]]\n",
+ "The standard basis matrix is denoted as:\n",
+ "P = [[ 3 2 2]\n",
+ " [-1 1 0]\n",
+ " [ 3 0 1]]\n",
+ "AP = Matrix([[3, 4, 4], [-1, 2, 0], [3, 0, 2]])\n",
+ "PD = [[3 0 0]\n",
+ " [0 2 0]\n",
+ " [0 0 2]]\n",
+ "That is, AP = PD\n",
+ "=> inverse(P)*A*P = D\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,transpose,vstack,rank\n",
+ "from sympy import Symbol,Matrix,eye\n",
+ "print 'Standard ordered matrix for Linear operator T on R**3 is:'\n",
+ "A = Matrix(([5, -6, -6],[ -1, 4, 2],[ 3, -6, -4]))\n",
+ "print 'A = \\n',A\n",
+ "print 'xI - A = '\n",
+ "B = eye(3)\n",
+ "x = Symbol('x')\n",
+ "P = x*B - A#\n",
+ "print P\n",
+ "\n",
+ "print 'Applying row and column transformations:'\n",
+ "print 'C2 = C2 - C3'\n",
+ "P[:,1] = P[:,1] - P[:,2]\n",
+ "print '=>'\n",
+ "print P\n",
+ "print 'Taking (x-2) common from C2'\n",
+ "c = x-2#\n",
+ "P[:,1] = P[:,1] / (x-2)\n",
+ "print '=>'\n",
+ "print ' * ', c\n",
+ "print P\n",
+ "print 'R3 = R3 + R2'\n",
+ "P[2,:] = P[2,:] + P[1,:]\n",
+ "print '=>'\n",
+ "print ' * ', c\n",
+ "print P\n",
+ "P = Matrix(([P[0,0], P[0,2]],[P[2,0], P[2,2]]))\n",
+ "print '=>'\n",
+ "print ' * ', c\n",
+ "print P\n",
+ "print '=>'\n",
+ "print ' * ',c\n",
+ "print P.det()\n",
+ "print 'This is the characteristic polynomial'\n",
+ "\n",
+ "print 'Now, A - I = ',A-B\n",
+ "print 'And, A- 2I = ',A-2*B\n",
+ "print 'rank(A-I) = ',rank(A-B)\n",
+ "\n",
+ "print 'rank(A-2I) = ',rank(A-2*B)\n",
+ "print 'W1,W2 be the spaces of characteristic vectors associated with values 1,2'\n",
+ "print 'So by theorem 2, T is diagonalizable'\n",
+ "a1 = array([[3, -1 ,3]])\n",
+ "a2 = array([[2, 1, 0]])\n",
+ "a3 = array([[2, 0, 1]])\n",
+ "print 'Null space of (T- I) i.e basis of W1 is spanned by a1 = ',a1\n",
+ "print 'Null space of (T- 2I) i.e. basis of W2 is spanned by vectors x1,x2,x3 such that x1 = 2x1 + 2x3'\n",
+ "print 'One example :'\n",
+ "print 'a2 = ',a2\n",
+ "print 'a3 = ',a3\n",
+ "print 'The diagonal matrix is:'\n",
+ "D = array([[1 ,0 ,0 ],[0, 2, 0],[0, 0, 2]])\n",
+ "print 'D = ',D\n",
+ "print 'The standard basis matrix is denoted as:'\n",
+ "P = transpose(vstack([a1,a2,a3]))\n",
+ "print 'P = ',P\n",
+ "print 'AP = ',A*P\n",
+ "print 'PD = ',P*D\n",
+ "print 'That is, AP = PD'\n",
+ "print '=> inverse(P)*A*P = D'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 193 Example 6.4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "[[ 5 -6 -6]\n",
+ " [-1 4 2]\n",
+ " [ 3 -6 -4]]\n",
+ "Characteristic polynomial of A is:\n",
+ "f = (x-1)(x-2)**2\n",
+ "i.e., f = (x - 2)**2*(x - 1)\n",
+ "(A-I)(A-2I) = Matrix([[0, 0, 0], [0, 0, 0], [0, 0, 0]])\n",
+ "Since, (A-I)(A-2I) = 0. So, Minimal polynomial for above is:\n",
+ "p = (x - 2)*(x - 1)\n",
+ "---------------------------------------\n",
+ "A = \n",
+ "[[ 3 1 -1]\n",
+ " [ 2 2 -1]\n",
+ " [ 2 2 0]]\n",
+ "Characteristic polynomial of A is:\n",
+ "f = (x-1)(x-2)**2\n",
+ "i.e., f = (x - 2)**2*(x - 1)\n",
+ "(A-I)(A-2I) = Matrix([[2, 0, -1], [2, 0, -1], [4, 0, -2]])\n",
+ "Since, (A-I)(A-2I) is not equal to 0. T is not diagonalizable. So, Minimal polynomial cannot be p.\n",
+ "---------------------------------------\n",
+ "A = \n",
+ "[[ 0 -1]\n",
+ " [ 1 0]]\n",
+ "Characteristic polynomial of A is:\n",
+ "f = x**2 + 1\n",
+ "A**2 + I = Matrix([[1, 1], [1, 1]])\n",
+ "Since, A**2 + I = 0, so minimal polynomial is\n",
+ "p = x**2 + 1\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,transpose,vstack,rank\n",
+ "from sympy import Symbol,Matrix,eye\n",
+ "\n",
+ "x = Symbol(\"x\")\n",
+ "A = array([[5, -6, -6],[ -1, 4 ,2],[ 3, -6, -4]]) #Matrix given in Example 3\n",
+ "print 'A = \\n',A\n",
+ "f = (x-1)*(x-2)**2# \n",
+ "print 'Characteristic polynomial of A is:'\n",
+ "print 'f = (x-1)(x-2)**2'\n",
+ "print 'i.e., f = ',f\n",
+ "p = (x-1)*(x-2)#\n",
+ "print '(A-I)(A-2I) = ',(A-eye(3))*(A-2 * eye(3))\n",
+ "print 'Since, (A-I)(A-2I) = 0. So, Minimal polynomial for above is:'\n",
+ "print 'p = ',p\n",
+ "print '---------------------------------------'\n",
+ "\n",
+ "A = array([[3, 1 ,-1],[ 2, 2 ,-1],[2, 2, 0]]) #Matrix given in Example 2\n",
+ "print 'A = \\n',A\n",
+ "f = (x-1)*(x-2)**2# \n",
+ "print 'Characteristic polynomial of A is:'\n",
+ "print 'f = (x-1)(x-2)**2'\n",
+ "print 'i.e., f = ',f\n",
+ "print '(A-I)(A-2I) = ',(A-eye(3))*(A-2 * eye(3))\n",
+ "print 'Since, (A-I)(A-2I) is not equal to 0. T is not diagonalizable. So, Minimal polynomial cannot be p.'\n",
+ "print '---------------------------------------'\n",
+ "A = array([[0, -1],[1, 0]])\n",
+ "print 'A = \\n',A\n",
+ "f = x**2 + 1#\n",
+ "print 'Characteristic polynomial of A is:'\n",
+ "print 'f = ',f\n",
+ "print 'A**2 + I = ',A**2 + eye(2)\n",
+ "print 'Since, A**2 + I = 0, so minimal polynomial is'\n",
+ "p = x**2 + 1\n",
+ "print 'p = ',p"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 197 Example 6.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " A = \n",
+ "[[0 1 0 1]\n",
+ " [1 0 1 0]\n",
+ " [0 1 0 1]\n",
+ " [1 0 1 0]]\n",
+ "Computing powers on A:\n",
+ "A**2 = \n",
+ "[[0 1 0 1]\n",
+ " [1 0 1 0]\n",
+ " [0 1 0 1]\n",
+ " [1 0 1 0]]\n",
+ "A**3 = \n",
+ "[[0 1 0 1]\n",
+ " [1 0 1 0]\n",
+ " [0 1 0 1]\n",
+ " [1 0 1 0]]\n",
+ "if p = x**3 - 4x, then\n",
+ "p(A) = [[ 0 -3 0 -3]\n",
+ " [-3 0 -3 0]\n",
+ " [ 0 -3 0 -3]\n",
+ " [-3 0 -3 0]]\n",
+ "Minimal polynomial for A is: x**3 - 4*x\n",
+ "Characteristic values for A are: [-2, 0, 2]\n",
+ "Rank(A) = 2\n",
+ "So, from theorem 2, characteristic polynomial for A is: x**4 - 4*x**2\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,transpose,vstack,rank\n",
+ "from sympy import Symbol,Matrix,eye,solve\n",
+ "A = array([[0, 1, 0, 1],[1, 0 ,1 ,0],[0, 1, 0, 1],[1, 0, 1, 0]])\n",
+ "print 'A = \\n',A\n",
+ "print 'Computing powers on A:'\n",
+ "print 'A**2 = \\n',A*A\n",
+ "print 'A**3 = \\n',A*A*A\n",
+ "def p(x):\n",
+ " pp = x**3 - 4*x\n",
+ " return pp\n",
+ "print 'if p = x**3 - 4x, then'\n",
+ "print 'p(A) = ',p(A)\n",
+ "x = Symbol(\"x\")\n",
+ "f = x**3 - 4*x\n",
+ "print 'Minimal polynomial for A is: ',f\n",
+ "print 'Characteristic values for A are:',solve(f,x)\n",
+ "print 'Rank(A) = ',rank(A)\n",
+ "print 'So, from theorem 2, characteristic polynomial for A is:',Matrix(A).charpoly(x).as_expr()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 210 Example 6.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "[[ 9. 3. 3.]\n",
+ " [ 7. 4. 4.]\n",
+ " [ 1. 1. 2.]]\n",
+ "A transpose is:\n",
+ "A' = \n",
+ "[[ 9. 7. 1.]\n",
+ " [ 3. 4. 1.]\n",
+ " [ 3. 4. 2.]]\n",
+ "Since, A' is not equal to A, A is not a symmetric matrix.\n",
+ "Since, A' is not equal to -A, A is not a skew-symmetric matrix.\n",
+ "A can be expressed as sum of A1 and A2\n",
+ "i.e., A = A1 + A2\n",
+ "A1 = \n",
+ "[[ 9. 5. 2. ]\n",
+ " [ 5. 4. 2.5]\n",
+ " [ 2. 2.5 2. ]]\n",
+ "A2 = \n",
+ "[[ 0. -2. 1. ]\n",
+ " [ 2. 0. 1.5]\n",
+ " [-1. -1.5 0. ]]\n",
+ "A1 + A2 = \n",
+ "[[ 9. 3. 3.]\n",
+ " [ 7. 4. 4.]\n",
+ " [ 1. 1. 2.]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,transpose,random,equal\n",
+ "\n",
+ "A = random.rand(3,3)\n",
+ "for i in range(0,3):\n",
+ " for j in range(0,3):\n",
+ " A[i,j]=round(A[i,j]*10)\n",
+ " \n",
+ "print 'A = \\n',A\n",
+ "print 'A transpose is:\\n',\n",
+ "Adash=transpose(A)\n",
+ "print \"A' = \\n\",Adash\n",
+ "if equal(Adash,A).all():\n",
+ " print \"Since, A' = A, A is a symmetric matrix.\"\n",
+ "else:\n",
+ " print \"Since, A' is not equal to A, A is not a symmetric matrix.\"\n",
+ "\n",
+ "if equal(Adash,-A).all():\n",
+ " print \"Since, A' = -A, A is a skew-symmetric matrix.\"\n",
+ "else:\n",
+ " print \"Since, A' is not equal to -A, A is not a skew-symmetric matrix.\"\n",
+ "\n",
+ "A1 = 1./2*(A + Adash)\n",
+ "A2 = 1./2*(A - Adash)\n",
+ "print 'A can be expressed as sum of A1 and A2'\n",
+ "print 'i.e., A = A1 + A2'\n",
+ "print 'A1 = \\n',A1\n",
+ "print 'A2 = \\n',A2\n",
+ "print 'A1 + A2 = \\n',A1 + A2"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter7_TclM939.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter7_TclM939.ipynb
new file mode 100644
index 00000000..a6ddec49
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter7_TclM939.ipynb
@@ -0,0 +1,240 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 7 - The rational and jordan forms"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 239 Example 7.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "Matrix([[5, -6, -6], [-1, 4, 2], [3, -6, -4]])\n",
+ "Characteristic polynomial for linear operator T on R**3 will be:\n",
+ "f = x**3 - 5*x**2 + 8*x - 4\n",
+ "or\n",
+ "(x-1)(x-2)**2\n",
+ "The minimal polynomial for T is:\n",
+ "p = (x - 2)*(x - 1)\n",
+ "or\n",
+ "p = (x-1)(x-2)\n",
+ "So in cyclic decomposition of T, a1 will have p as its T-annihilator.\n",
+ "Another vector a2 that generate cyclic subspace of dimension 1 will have its T-annihilator as p2.\n",
+ "p2 = x - 2\n",
+ "pp2 = (x - 2)**2*(x - 1)\n",
+ "i.e., pp2 = f\n",
+ "Therefore, A is similar to B\n",
+ "B = \n",
+ "[[ 0 -2 0]\n",
+ " [ 1 3 0]\n",
+ " [ 0 0 2]]\n",
+ "Thus, we can see thet Matrix of T in ordered basis is B\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "from sympy import Symbol,Matrix\n",
+ "A = Matrix(([5, -6, -6],[-1, 4 ,2],[3, -6, -4]))\n",
+ "print 'A = \\n',A\n",
+ "x=Symbol('x')\n",
+ "f = A.charpoly(x).as_expr()\n",
+ "print 'Characteristic polynomial for linear operator T on R**3 will be:'\n",
+ "print 'f = ',f\n",
+ "print 'or'\n",
+ "print '(x-1)(x-2)**2'\n",
+ "print 'The minimal polynomial for T is:'\n",
+ "p = (x-1)*(x-2)#\n",
+ "print 'p = ',p\n",
+ "print 'or'\n",
+ "print 'p = (x-1)(x-2)'\n",
+ "print 'So in cyclic decomposition of T, a1 will have p as its T-annihilator.'\n",
+ "print 'Another vector a2 that generate cyclic subspace of dimension 1 will have its T-annihilator as p2.'\n",
+ "p2 = x-2#\n",
+ "print 'p2 = ',p2\n",
+ "print 'pp2 = ',p*p2\n",
+ "print 'i.e., pp2 = f'\n",
+ "print 'Therefore, A is similar to B'\n",
+ "B = array([[0, -2, 0],[1, 3, 0],[0, 0 ,2]])\n",
+ "print 'B = \\n',B\n",
+ "print 'Thus, we can see thet Matrix of T in ordered basis is B'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 247 Example 7.6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "2 0 0\n",
+ "a 2 0\n",
+ "b c -1\n",
+ "A = \n",
+ "Matrix([[2, 0, 0], [1, 2, 0], [0, 0, -1]])\n",
+ "Characteristic polynomial for A is:\n",
+ "p = x**3 - 3*x**2 + 4\n",
+ "In this case, minimal polynomial is same as characteristic polynomial.\n",
+ "-----------------------------------------\n",
+ "A = \n",
+ "Matrix([[2, 0, 0], [0, 2, 0], [0, 0, -1]])\n",
+ "Characteristic polynomial for A is:\n",
+ "p = x**3 - 3*x**2 + 4\n",
+ "In this case, minimal polynomial is: (x-2)(x+1)\n",
+ "or\n",
+ "(x - 2)*(x + 1)\n",
+ "(A-2I)(A+I) = \n",
+ "0 0 0\n",
+ "3a 0 0\n",
+ "ac 0 0\n",
+ "if a = 0, A is similar to diagonal matrix.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "from sympy import Symbol,Matrix\n",
+ "\n",
+ "print 'A = '\n",
+ "print '2 0 0'\n",
+ "print 'a 2 0'\n",
+ "print 'b c -1'\n",
+ "a = 1#\n",
+ "b = 0#\n",
+ "c = 0#\n",
+ "A = Matrix(([2, 0, 0],[a, 2, 0],[b, c, -1]))\n",
+ "print 'A = \\n',A\n",
+ "print 'Characteristic polynomial for A is:'\n",
+ "x=Symbol('x')\n",
+ "print 'p = ',A.charpoly(x).as_expr()\n",
+ "print 'In this case, minimal polynomial is same as characteristic polynomial.'\n",
+ "print '-----------------------------------------'\n",
+ "a = 0#\n",
+ "b = 0#\n",
+ "c = 0#\n",
+ "A = Matrix(([2, 0, 0],[a, 2, 0],[b, c, -1]))\n",
+ "print 'A = \\n',A\n",
+ "print 'Characteristic polynomial for A is:'\n",
+ "x=Symbol('x')\n",
+ "print 'p = ',A.charpoly(x).as_expr()\n",
+ "print 'In this case, minimal polynomial is:',\n",
+ "print '(x-2)(x+1)'\n",
+ "print 'or'\n",
+ "s = (x-2)*(x+1)#\n",
+ "print s\n",
+ "print '(A-2I)(A+I) = '\n",
+ "print '0 0 0'\n",
+ "print '3a 0 0'\n",
+ "print 'ac 0 0'\n",
+ "print 'if a = 0, A is similar to diagonal matrix.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 247 Example 7.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = \n",
+ "2 0 0 0\n",
+ "1 2 0 0\n",
+ "0 0 2 0\n",
+ "0 0 a 2\n",
+ "Considering a = 1\n",
+ "Characteristic polynomial for A is:\n",
+ "p = x**4 - 8*x**3 + 24*x**2 - 32*x + 16\n",
+ "or\n",
+ "(x-2)**4\n",
+ "Minimal polynomial for A =\n",
+ "(x-2)**2\n",
+ "For a = 0 and a = 1, characteristic and minimal polynomial are same.\n",
+ "But for a=0, the solution space of (A - 2I) has 3 dimension whereas for a = 1, it has 2 dimension. \n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array\n",
+ "from sympy import Symbol,Matrix\n",
+ "print 'A = '\n",
+ "print '2 0 0 0'\n",
+ "print '1 2 0 0'\n",
+ "print '0 0 2 0'\n",
+ "print '0 0 a 2'\n",
+ "print 'Considering a = 1'\n",
+ "A = Matrix(([2, 0 ,0 ,0],[1, 2, 0, 0],[0, 0 ,2 ,0],[0, 0, 1, 2]))\n",
+ "x=Symbol('x')\n",
+ "p = A.charpoly(x).as_expr()\n",
+ "print 'Characteristic polynomial for A is:'\n",
+ "print 'p = ',p\n",
+ "print 'or'\n",
+ "print '(x-2)**4'\n",
+ "print 'Minimal polynomial for A ='\n",
+ "print '(x-2)**2'\n",
+ "print 'For a = 0 and a = 1, characteristic and minimal polynomial are same.'\n",
+ "print 'But for a=0, the solution space of (A - 2I) has 3 dimension whereas for a = 1, it has 2 dimension. '"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter8_O8vLz4s.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter8_O8vLz4s.ipynb
new file mode 100644
index 00000000..6759a185
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter8_O8vLz4s.ipynb
@@ -0,0 +1,560 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 8 - Inner product spaces"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 271 Example 8.1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "n = 4\n",
+ "a = [[ 1. 5. 4. 1.]]\n",
+ "b = [[ 8. 6. 6. 8.]]\n",
+ "Then, (a|b) = \n",
+ "\n",
+ "[[ 8. 40. 32. 8.]\n",
+ " [ 6. 30. 24. 6.]\n",
+ " [ 6. 30. 24. 6.]\n",
+ " [ 8. 40. 32. 8.]]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,transpose\n",
+ "n=random.randint(2,9)\n",
+ "a=random.rand(1,n)\n",
+ "b=random.rand(1,n)\n",
+ "for i in range(0,n):\n",
+ " a[0,i]=round(a[0,i]*10)\n",
+ " b[0,i]=round(b[0,i]*10)\n",
+ "print 'n = ',n\n",
+ "print 'a = ',a\n",
+ "print 'b = ',b\n",
+ "print 'Then, (a|b) = \\n\\n',a*transpose(b)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 271 Example 8.2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a = [[ 9. 4.]]\n",
+ "b = [[ 1. 9.]]\n",
+ "Then, a|b = 68.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,transpose\n",
+ "a=random.rand(1,2)\n",
+ "b=random.rand(1,2)\n",
+ "for i in range(0,2):\n",
+ " a[0,i]=round(a[0,i]*10)\n",
+ " b[0,i]=round(b[0,i]*10)\n",
+ "print 'a = ',a\n",
+ "print 'b = ',b\n",
+ "x1 = a[0,0]#\n",
+ "x2 = a[0,1]#\n",
+ "y1 = b[0,0]#\n",
+ "y2 = b[0,1]#\n",
+ "t = x1*y1 - x2*y1 - x1*y2 + 4*x2*y2#\n",
+ "print 'Then, a|b = ',t"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 307 Example 8.28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "x1 and x2 are two real nos. i.e., x1**2 + x2**2 = 1\n",
+ "x1 = 0.248003219206\n",
+ "x2 = 0.968759208092\n",
+ "B = \n",
+ "[[ 0.24800322 0.96875921 0. ]\n",
+ " [ 0. 1. 0. ]\n",
+ " [ 0. 0. 1. ]]\n",
+ "Applying Gram-Schmidt process to B:\n",
+ "a1 = [ 0.24800322 0.96875921 0. ]\n",
+ "a2 = [-0.2402554 0.0615056 0. ]\n",
+ "a3 = [0 0 1]\n",
+ "U = \n",
+ "[[[ 0.24800322 0.96875921 0. ]]\n",
+ "\n",
+ " [[-0.96875921 0.24800322 0. ]]\n",
+ "\n",
+ " [[ 0. 0. 1. ]]]\n",
+ "M = \n",
+ "[[ 1. 0. 0. ]\n",
+ " [-3.90623642 4.03220572 0. ]\n",
+ " [ 0. 0. 1. ]]\n",
+ "inverse(M) * U = [[[ 0.24800322 -0. -0. ]\n",
+ " [ 0.2402554 0.2402554 0. ]\n",
+ " [ 0. 0. 0. ]]\n",
+ "\n",
+ " [[-0.96875921 -0. -0. ]\n",
+ " [-0.9384944 0.0615056 0. ]\n",
+ " [-0. 0. 0. ]]\n",
+ "\n",
+ " [[ 0. -0. -0. ]\n",
+ " [ 0. 0. 0. ]\n",
+ " [ 0. 0. 1. ]]]\n",
+ "So, B = inverse(M) * U\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,transpose,linalg,sqrt\n",
+ "print 'x1 and x2 are two real nos. i.e., x1**2 + x2**2 = 1'\n",
+ "x1 = random.rand()\n",
+ "x2 = sqrt(1 - x1**2)\n",
+ "print 'x1 = ',x1\n",
+ "print 'x2 = ',x2\n",
+ "B = array([[x1, x2, 0],[0, 1, 0],[0, 0, 1]])\n",
+ "print 'B = \\n',B\n",
+ "print 'Applying Gram-Schmidt process to B:'\n",
+ "a1 = array([x1, x2, 0])\n",
+ "a2 = array([0 ,1 ,0]) - x2 * array([x1 ,x2 ,0])\n",
+ "a3 = array([0, 0, 1])\n",
+ "print 'a1 = ',a1\n",
+ "print 'a2 = ',a2\n",
+ "print 'a3 = ',a3\n",
+ "U = array([[a1],[a2/x1],[a3]])\n",
+ "print 'U = \\n',U\n",
+ "M = array([[1, 0, 0],[-x2/x1, 1/x1, 0],[0, 0, 1]])\n",
+ "print 'M = \\n',M\n",
+ "print 'inverse(M) * U = ',linalg.inv(M) * U\n",
+ "print 'So, B = inverse(M) * U'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 278 Example 8.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(x,y) = [[ 7. 4.]]\n",
+ "(-y,x) = [-4.0, 7.0]\n",
+ "Inner product of these vectors is:\n",
+ "(x,y)|(-y,x) = 0.0\n",
+ "So, these are orthogonal.\n",
+ "------------------------------------------\n",
+ "If inner product is defined as:\n",
+ "(x1,x2)|(y1,y2) = x1y1- x2y1 - x1y2 + 4x2y2\n",
+ "Then, (x,y)|(-y,x) = -x*y+y**2-x**2+4*x*y = 0 if,\n",
+ "y = 1/2(-3 + sqrt(13))*x\n",
+ "or\n",
+ "y = 1/2(-3 - sqrt(13))*x\n",
+ "Hence,\n",
+ "[[ 7. 4.]]\n",
+ "is orthogonal to\n",
+ "[-4.0, 7.0]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,transpose,linalg,sqrt\n",
+ "#a = round(rand(1,2) * 10)#\n",
+ "a=random.rand(1,2)\n",
+ "for j in [0,1]:\n",
+ " a[0,j]=round(a[0,j]*10)\n",
+ "\n",
+ "x = a[0,0]\n",
+ "y = a[0,1]\n",
+ "b = [-y, x]#\n",
+ "print '(x,y) = ',a\n",
+ "print '(-y,x) = ',b\n",
+ "print 'Inner product of these vectors is:'\n",
+ "t = -x*y + y*x#\n",
+ "print '(x,y)|(-y,x) = ',t\n",
+ "\n",
+ "print 'So, these are orthogonal.'\n",
+ "print '------------------------------------------'\n",
+ "print 'If inner product is defined as:'\n",
+ "print '(x1,x2)|(y1,y2) = x1y1- x2y1 - x1y2 + 4x2y2'\n",
+ "print 'Then, (x,y)|(-y,x) = -x*y+y**2-x**2+4*x*y = 0 if,'\n",
+ "print 'y = 1/2(-3 + sqrt(13))*x'\n",
+ "print 'or'\n",
+ "print 'y = 1/2(-3 - sqrt(13))*x'\n",
+ "print 'Hence,'\n",
+ "if y == (1./2*(-3 + sqrt(13))*x) or (1./2*(-3 - sqrt(13))*x):\n",
+ " print a\n",
+ " print 'is orthogonal to'\n",
+ " print b\n",
+ "else:\n",
+ " print a\n",
+ " print 'is not orthogonal to'\n",
+ " print b\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 282 Example 8.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "b1 = [3 0 4]\n",
+ "b2 = [-1 0 7]\n",
+ "b3 = [ 2 9 11]\n",
+ "Applying the Gram-Schmidt process to b1,b2,b3:\n",
+ "a1 = [3 0 4]\n",
+ "a2 = [2 0 3]\n",
+ "a3 = [2 9 4]\n",
+ "{a1,a2,a3} are mutually orthogonal and hence forms orthogonal basis for R**3\n",
+ "Any arbitrary vector {x1,x2,x3} in R**3 can be expressed as:\n",
+ "y = {x1,x2,x3} = (3*x1 + 4*x3)/25*a1 + (-4*x1 + 3*x3)/25*a2 + x2/9*a3\n",
+ "x1 = 1\n",
+ "x2 = 2\n",
+ "x3 = 3\n",
+ "y = [0 0 0]\n",
+ "i.e. y = [x1 x2 x3], according to above equation.\n",
+ "Hence, we get the orthonormal basis as:\n",
+ ", [ 0.6 0. 0.8]\n",
+ ", [ 0.4 0. 0.6]\n",
+ "[ 0.22222222 1. 0.44444444]\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,transpose,linalg,sqrt\n",
+ "b1 = array([3, 0, 4])\n",
+ "b2 = array([-1 ,0 ,7])\n",
+ "b3 = array([2 ,9 ,11])\n",
+ "print 'b1 = ',b1\n",
+ "print 'b2 = ',b2\n",
+ "print 'b3 = ',b3\n",
+ "print 'Applying the Gram-Schmidt process to b1,b2,b3:'\n",
+ "a1 = b1\n",
+ "print 'a1 = ',a1\n",
+ "a2 = b2-(transpose((b2*transpose(b1)))/25*b1)\n",
+ "print 'a2 = ',a2\n",
+ "a3 = b3-(transpose(b3*transpose(b1))/25*b1) - (transpose(b3*transpose(a2))/25*a2)\n",
+ "print 'a3 = ',a3\n",
+ "print '{a1,a2,a3} are mutually orthogonal and hence forms orthogonal basis for R**3'\n",
+ "print 'Any arbitrary vector {x1,x2,x3} in R**3 can be expressed as:'\n",
+ "print 'y = {x1,x2,x3} = (3*x1 + 4*x3)/25*a1 + (-4*x1 + 3*x3)/25*a2 + x2/9*a3'\n",
+ "x1 = 1#\n",
+ "x2 = 2#\n",
+ "x3 = 3#\n",
+ "y = (3*x1 + 4*x3)/25*a1 + (-4*x1 + 3*x3)/25*a2 + x2/9*a3#\n",
+ "print 'x1 = ',x1\n",
+ "print 'x2 = ',x2\n",
+ "print 'x3 = ',x3\n",
+ "print 'y = ',y\n",
+ "print 'i.e. y = [x1 x2 x3], according to above equation.'\n",
+ "print 'Hence, we get the orthonormal basis as:'\n",
+ "\n",
+ "print ',',1./5*a1\n",
+ "print ',',1./5*a2\n",
+ "print 1/9.*a3"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 283 Example 8.13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "A = [[ 1.83351494 1.26265003]\n",
+ " [ 0.46651205 0.76790774]]\n",
+ "b1 = [ 1.83351494 1.26265003]\n",
+ "b2 = [ 0.46651205 0.76790774]\n",
+ "Applying the orthogonalization process to b1,b2:\n",
+ "[1.8335149394280341, 1.2626500316837608] a1 = \n",
+ "[] a2 = \n",
+ "a2 is not equal to zero if and only if b1 and b2 are linearly independent.\n",
+ "That is, if determinant of A is non-zero.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,transpose,linalg,sqrt\n",
+ "A = random.rand(2,2)\n",
+ "A[0,:] = A[0,:] + 1# #so b1 is not equal to zero\n",
+ "a = A[0,0]\n",
+ "b = A[0,1]\n",
+ "c = A[1,0]\n",
+ "d = A[1,1]\n",
+ "b1 = A[0,:]\n",
+ "b2 = A[1,:]\n",
+ "print 'A = ',A\n",
+ "print 'b1 = ',b1\n",
+ "print 'b2 = ',b2\n",
+ "print 'Applying the orthogonalization process to b1,b2:'\n",
+ "\n",
+ "a1 = [a, b]\n",
+ "a2 = (linalg.det(A)/(a**2 + b**2))*[-transpose(b), transpose(a)]\n",
+ "print a1,'a1 = '\n",
+ "print a2,'a2 = '\n",
+ "print 'a2 is not equal to zero if and only if b1 and b2 are linearly independent.'\n",
+ "print 'That is, if determinant of A is non-zero.'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 286 Example 8.14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "v = [-10 2 8]\n",
+ "u = [ 3 12 -1]\n",
+ "Orthogonal projection of v1 on subspace W spanned by v2 is given by:\n",
+ "[-3 0 1]\n",
+ "Orthogonal projection of R**3 on W is the linear transformation E given by:\n",
+ "(x1,x2,x3) -> (3*x1 + 12*x2 - x3)/%d * (3 12 -1) 154\n",
+ "Rank(E) = 1\n",
+ "Nullity(E) = 2\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import array,random,transpose,linalg,sqrt\n",
+ "v = array([-10 ,2 ,8])\n",
+ "u = array([3, 12, -1])\n",
+ "print 'v = ',v\n",
+ "print 'u = ',u\n",
+ "print 'Orthogonal projection of v1 on subspace W spanned by v2 is given by:'\n",
+ "a = (transpose(u*transpose(v)))/(u[0]**2 + u[1]**2 + u[2]**2) * u\n",
+ "print a\n",
+ "print 'Orthogonal projection of R**3 on W is the linear transformation E given by:'\n",
+ "print '(x1,x2,x3) -> (3*x1 + 12*x2 - x3)/%d * (3 12 -1)',(u[0]**2 + u[1]**2 + u[2]**2)\n",
+ "print 'Rank(E) = 1'\n",
+ "print 'Nullity(E) = 2'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 288 Example 8.15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "f = (sqrt(2)*cos(2*pi*t) + sqrt(2)*sin(4*pi*t))**2\n",
+ "Integration (f dt) in limits 0 to 1 = 2.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "from mpmath import quad,cos,sin,pi,sqrt\n",
+ "\n",
+ "#part c\n",
+ "print 'f = (sqrt(2)*cos(2*pi*t) + sqrt(2)*sin(4*pi*t))**2'\n",
+ "print 'Integration (f dt) in limits 0 to 1 = ',\n",
+ "x0 = 0#\n",
+ "x1 = 1#\n",
+ "X = quad(lambda t:(sqrt(2)*cos(2*pi*t) + sqrt(2)*sin(4*pi*t))**2,[x0,x1])\n",
+ "print X"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Page 294 Example 8.17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Matrix of projection E in orthonormal basis is:\n",
+ "A = 1/154 * [[ 9 36 -3]\n",
+ " [ 36 144 -12]\n",
+ " [ -3 -12 1]]\n",
+ "A* = [[ 9 36 -3]\n",
+ " [ 36 144 -12]\n",
+ " [ -3 -12 1]]\n",
+ "Since, E = E* and A = A*, then A is also the matrix of E*\n",
+ "a1 = [154, 0, 0]\n",
+ "a2 = [145, -36, 3]\n",
+ "a3 = [-36, 10, 12]\n",
+ "{a1,a2,a3} is the basis.\n",
+ "Ea1 = [9, 36, -3]\n",
+ "Ea2 = [0, 0, 0]\n",
+ "Ea3 = [0, 0, 0]\n",
+ "Matrix B of E in the basis is:\n",
+ "B = \n",
+ "[[-1 0 0]\n",
+ " [-1 0 0]\n",
+ " [ 0 0 0]]\n",
+ "B* = \n",
+ "[[-1 -1 0]\n",
+ " [ 0 0 0]\n",
+ " [ 0 0 0]]\n",
+ "Since, B is not equal to B*, B is not the matrix of E*\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import vstack,array,transpose,conj\n",
+ "#Equation given in example 14 is used.\n",
+ "def transform(x,y,z):\n",
+ " x1 = 3*x#\n",
+ " x2 = 12*y#\n",
+ " x3 = -z#\n",
+ " m = [x1 ,x2, x3]\n",
+ " return m\n",
+ "\n",
+ "print 'Matrix of projection E in orthonormal basis is:'\n",
+ "t1 = transform(3,3,3)#\n",
+ "t2 = transform(12,12,12)#\n",
+ "t3 = transform(-1,-1,-1)#\n",
+ "A = vstack([t1,t2,t3])#[t1# t2# t3]#\n",
+ "print 'A = 1/154 * ',A\n",
+ "\n",
+ "A1 = transpose(conj(A))\n",
+ "print 'A* = ',A1\n",
+ "print 'Since, E = E* and A = A*, then A is also the matrix of E*'\n",
+ "a1 = [154, 0, 0]#\n",
+ "a2 = [145 ,-36, 3]#\n",
+ "a3 = [-36 ,10 ,12]#\n",
+ "print 'a1 = ',a1\n",
+ "print 'a2 = ',a2\n",
+ "print 'a3 = ',a3\n",
+ "print '{a1,a2,a3} is the basis.'\n",
+ "Ea1 = [9 ,36 ,-3]#\n",
+ "Ea2 = [0 ,0, 0]#\n",
+ "Ea3 = [0 ,0 ,0]#\n",
+ "print 'Ea1 = ',Ea1\n",
+ "print 'Ea2 = ',Ea2\n",
+ "print 'Ea3 = ',Ea3\n",
+ "B = array([[-1, 0, 0],[-1, 0 ,0],[0, 0, 0]])\n",
+ "print 'Matrix B of E in the basis is:'\n",
+ "print 'B = \\n',B\n",
+ "B1 = transpose(conj(B))\n",
+ "print 'B* = \\n',B1\n",
+ "print 'Since, B is not equal to B*, B is not the matrix of E*'"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/InverseMatrix_4IPKcOB.png b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/InverseMatrix_4IPKcOB.png
new file mode 100644
index 00000000..90f061e8
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/InverseMatrix_4IPKcOB.png
Binary files differ
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_1i9RBkK.png b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_1i9RBkK.png
new file mode 100644
index 00000000..f75da6e2
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_1i9RBkK.png
Binary files differ
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_vUnUNjM.png b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_vUnUNjM.png
new file mode 100644
index 00000000..f75da6e2
--- /dev/null
+++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/screenshots/scalorpolynomial_vUnUNjM.png
Binary files differ