{"nbformat": 3, "worksheets": [{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Behavior of Elimination Matrices"]}, {"outputs": [], "cell_type": "code", "prompt_number": 3, "language": "python", "metadata": {}, "collapsed": false, "input": ["import numpy as np"]}, {"outputs": [], "cell_type": "code", "prompt_number": 30, "language": "python", "metadata": {}, "collapsed": false, "input": ["n = 4"]}, {"cell_type": "markdown", "metadata": {}, "source": ["----------------\n", "Let's create some elimination matrices:"]}, {"outputs": [{"output_type": "pyout", "prompt_number": 40, "text": ["array([[ 1. , 0. , 0. , 0. ],\n", " [ 0.5, 1. , 0. , 0. ],\n", " [ 0. , 0. , 1. , 0. ],\n", " [ 0. , 0. , 0. , 1. ]])"], "metadata": {}}], "cell_type": "code", "prompt_number": 40, "language": "python", "metadata": {}, "collapsed": false, "input": ["M1 = np.eye(n)\n", "M1[1,0] = 0.5\n", "M1"]}, {"outputs": [{"output_type": "pyout", "prompt_number": 41, "text": ["array([[ 1., 0., 0., 0.],\n", " [ 0., 1., 0., 0.],\n", " [ 0., 0., 1., 0.],\n", " [ 4., 0., 0., 1.]])"], "metadata": {}}], "cell_type": "code", "prompt_number": 41, "language": "python", "metadata": {}, "collapsed": false, "input": ["M2 = np.eye(n)\n", "M2[3,0] = 4\n", "M2"]}, {"outputs": [{"output_type": "pyout", "prompt_number": 42, "text": ["array([[ 1. , 0. , 0. , 0. ],\n", " [ 0. , 1. , 0. , 0. ],\n", " [ 0. , 1.3, 1. , 0. ],\n", " [ 0. , 0. , 0. , 1. ]])"], "metadata": {}}], "cell_type": "code", "prompt_number": 42, "language": "python", "metadata": {}, "collapsed": false, "input": ["M3 = np.eye(n)\n", "M3[2,1] = 1.3\n", "M3"]}, {"cell_type": "markdown", "metadata": {}, "source": ["-------------------\n", "Now play around with them:"]}, {"outputs": [{"output_type": "pyout", "prompt_number": 43, "text": ["array([[ 1. , 0. , 0. , 0. ],\n", " [ 0.5, 1. , 0. , 0. ],\n", " [ 0. , 0. , 1. , 0. ],\n", " [ 4. , 0. , 0. , 1. ]])"], "metadata": {}}], "cell_type": "code", "prompt_number": 43, "language": "python", "metadata": {}, "collapsed": false, "input": ["M1.dot(M2)"]}, {"outputs": [{"output_type": "pyout", "prompt_number": 44, "text": ["array([[ 1. , 0. , 0. , 0. ],\n", " [ 0.5, 1. , 0. , 0. ],\n", " [ 0. , 0. , 1. , 0. ],\n", " [ 4. , 0. , 0. , 1. ]])"], "metadata": {}}], "cell_type": "code", "prompt_number": 44, "language": "python", "metadata": {}, "collapsed": false, "input": ["M2.dot(M1)"]}, {"outputs": [{"output_type": "pyout", "prompt_number": 45, "text": ["array([[ 1. , 0. , 0. , 0. ],\n", " [ 0.5, 1. , 0. , 0. ],\n", " [ 0. , 1.3, 1. , 0. ],\n", " [ 4. , 0. , 0. , 1. ]])"], "metadata": {}}], "cell_type": "code", "prompt_number": 45, "language": "python", "metadata": {}, "collapsed": false, "input": ["M1.dot(M2).dot(M3)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["BUT:"]}, {"outputs": [{"output_type": "pyout", "prompt_number": 47, "text": ["array([[ 1. , 0. , 0. , 0. ],\n", " [ 0.5 , 1. , 0. , 0. ],\n", " [ 0.65, 1.3 , 1. , 0. ],\n", " [ 4. , 0. , 0. , 1. ]])"], "metadata": {}}], "cell_type": "code", "prompt_number": 47, "language": "python", "metadata": {}, "collapsed": false, "input": ["M3.dot(M1).dot(M2)"]}], "metadata": {}}], "metadata": {"signature": "sha256:ae14d4fed9cb3eea47f84acf30b6c66f2b6197ee976dfa82b001efd14a844f09", "name": ""}, "nbformat_minor": 0}