{ "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 }