* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Linear Equations in 3D Space
Linear least squares (mathematics) wikipedia , lookup
Matrix (mathematics) wikipedia , lookup
Determinant wikipedia , lookup
Gaussian elimination wikipedia , lookup
Jordan normal form wikipedia , lookup
Orthogonal matrix wikipedia , lookup
Perron–Frobenius theorem wikipedia , lookup
Cross product wikipedia , lookup
Cayley–Hamilton theorem wikipedia , lookup
Exterior algebra wikipedia , lookup
Eigenvalues and eigenvectors wikipedia , lookup
Non-negative matrix factorization wikipedia , lookup
System of linear equations wikipedia , lookup
Singular-value decomposition wikipedia , lookup
Matrix multiplication wikipedia , lookup
Laplace–Runge–Lenz vector wikipedia , lookup
Vector space wikipedia , lookup
Euclidean vector wikipedia , lookup
Vector field wikipedia , lookup
Covariance and contravariance of vectors wikipedia , lookup
Experimental Mathematics 25 August 2011 Linear Transformations and Ranks Recall from Linear Algebra I: Let V and W be vector spaces. A linear transformation T :V W is a function with the following properties: (i ) T (u v) T (u ) T (v) for all u, v V (ii ) T (cv) cT (v) for all v V , c R Basic example of a linear transformation An m n matrix A determines a linear tra nsformatio n T : Rn Rm given by T (x) Ax Visualizing Vectors To visualize linear transformations, we need to be able to visualize vectors first. Try the following in Sage: v = vector([1,2]) w = vector([4,1]) plot(v) + plot(w) + plot(v - w) The Sage function on the next slide plots the vectors in a list L in different colors (it is not necessary to understand the details of the function, we just use it as a tool). Vector Plotting Function def vector_plotter(vec_list, points=False): l = float(len(vec_list)) pic = Graphics() for i, v in enumerate(vec_list): if points: pic += point(v,hue=(i/l)) else: pic += plot(v,hue=(i/l)) return pic Example1 L=[vector([1,0]),vector([0,1]),vector([-1,0]),vector([0,-1])] vector_plotter(L) Example 2 L=[vector([1,0]),vector([0.75,0.25]),vector([0.5,0.5]),vector([0.25,0.75])] vector_plotter(L,points=true) Note: points=true has the effect that vectors are represented by points instead of arrows. Visualization of Linear Transformations We will visualize 2D linear transformations by applying them to vectors in the plot on the following slide. Example 3 L = [vector([cos(i),sin(i)]) for i in srange(0,2*pi,2*pi/20,universe=RDF)] vector_plotter(L) Note: srange(a,b,c) returns the list of numbers in [a,b) starting with a and with step size c. universe=RDF makes sure the number are in double precision floating point format. Problem 1 Modify Example 3 so that an ellipse with axes of length 2 and 3 is shown. The map Function Python has a built in map function which can be used to apply a function f to all entries of a list L. Syntax: map(f,L) Examples: L=range(5) def f(x): return x^2 map(f,L) # output [0,1,4,9,16] Multiply all vectors in a list with a matrix: L=[vector([1,0]),vector([0,1])] M=matrix([[3,5],[1,2]]) def f(v): return M*v map(f,L) Problem 2 • Let L be the list of vectors from Example 3. Use the map function to multiply all vectors in L with the matrix [[1,0.3],[0.3,0.8]] and plot the resulting list using the vector_plotter function. • Try this for other matrices. What are the possible “shapes” that can arise? Recall from Linear Algebra I: Rank of a matrix A maximum number of linearly independen t rows of A maximum number of linearly independen t columns of A number of nonzero rows in a row - echelon form a A kernel of A set of all vectors x with Ax 0 Problem 3 • Try the matrix [[1,0.3],[2,0.6]] in Problem 2. • Find the (unique) matrix for Problem 2 for which the plot collapses to a single point. • What is the connection between the rank of the matrices and the “shape” of the plot? Example 4: Plot a Random Sample of Vectors (as Points) L = [vector([random(),random()]) for i in range(20)] vector_plotter(L, points=True) Problem 4 • Let L be the list of vectors from Example 4. Use the map function to multiply all vectors in L with the matrix [[1,0.3],[2,0.6]] and plot the resulting list using the vector_plotter function (with points=true). • Observe carefully exactly where each original point lands. Is it random? Example 5: Plot Vectors on a Certain Line L = [random()*vector([3,-10]) for i in range(100)] vector_plotter(L, points=True) Problem 5 a. Let L be the list of vectors from Example 4. Use the map function to multiply all vectors in L with the matrix [[1,0.3],[2,0.6]] and plot the resulting list using the vector_plotter function (with points=true). b. What happens? Note: Numbers of absolute value <1e-15 can be considered as 0 (occur due to round off errors) c. Compute the kernel of the matrix [[1,0.3],[2,0.6]]. Note: for a matrix A the sage-command A.right_kernel() returns a representation of the kernel of A. d. What is the connection between the kernel of [[1,0.3],[2,0.6]] and the plot from part a? Problem 6 The following generates random 4x5 matrices and computes their rank and kernel: m = random_matrix(QQ, 4, 5, algorithm='echelonizable', rank=randint(0,4), upper_bound=60) print m print m.rank() m.right_kernel() Repeat this several times and especially take note of the connection between the rank and the dimension of the kernel. What is the mathematical theorem behind this?