{ "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": 1, "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": [ "import numpy as np\n", "import sympy as sp\n", "A = sp.Matrix(([5, -6, -6],[-1, 4 ,2],[3, -6, -4]))\n", "print 'A = \\n',A\n", "x=sp.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 = np.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": 2, "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": [ "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 = sp.Matrix(([2, 0, 0],[a, 2, 0],[b, c, -1]))\n", "print 'A = \\n',A\n", "print 'Characteristic polynomial for A is:'\n", "x=sp.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 = sp.Matrix(([2, 0, 0],[a, 2, 0],[b, c, -1]))\n", "print 'A = \\n',A\n", "print 'Characteristic polynomial for A is:'\n", "x=sp.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": 3, "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": [ "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 = sp.Matrix(([2, 0 ,0 ,0],[1, 2, 0, 0],[0, 0 ,2 ,0],[0, 0, 1, 2]))\n", "x=sp.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 }