diff options
Diffstat (limited to 'Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10.ipynb')
-rw-r--r--[-rwxr-xr-x] | Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10.ipynb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10.ipynb b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10.ipynb index 1c137a08..24d02247 100755..100644 --- a/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10.ipynb +++ b/Linear_Algebra_by_K._Hoffman_and_R._Kunze/Chapter10.ipynb @@ -46,7 +46,7 @@ } ], "source": [ - "import numpy as np\n", + "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", @@ -54,12 +54,12 @@ "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 = np.array([[1, 1],[1, 1]])\n", + "fb = array([[1, 1],[1, 1]])\n", "print '[f]B = \\n',fb\n", - "P = np.array([[1 ,1],[-1, 1]])\n", + "P = array([[1 ,1],[-1, 1]])\n", "print 'P = \\n',P\n", "print 'Thus, [f]B'' = P''*[f]B*P'\n", - "fb1 = np.transpose(P) * fb * P\n", + "fb1 = transpose(P) * fb * P\n", "print '[f]B'' = \\n',fb1" ] }, @@ -81,23 +81,23 @@ "name": "stdout", "output_type": "stream", "text": [ - "n = 56.0\n", - "a = 410.0\n", - "b = 70.0\n", - "f(a,b) = 28700.0\n", + "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": [ - "import numpy as np\n", - "n = round(np.random.randint(2,90))\n", - "a = round(np.random.randint(1,n) * 10)#\n", - "b = round(np.random.randint(1,n) * 10)#\n", + "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 * np.transpose(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" |