Download presentation
Presentation is loading. Please wait.
Published byLawrence Johns Modified over 9 years ago
1
Experimental Mathematics 25 August 2011 Linear Transformations and Ranks
2
Recall from Linear Algebra I: Let V and W be vector spaces. A linear transformation is a function with the following properties: Basic example of a linear transformation
3
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).
4
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
5
Example1 L=[vector([1,0]),vector([0,1]),vector([-1,0]),vector([0,-1])] vector_plotter(L)
6
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.
7
Visualization of Linear Transformations We will visualize 2D linear transformations by applying them to vectors in the plot on the following slide.
8
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.
9
Problem 1 Modify Example 3 so that an ellipse with axes of length 2 and 3 is shown.
10
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)
11
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?
12
Recall from Linear Algebra I:
13
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?
14
Example 4: Plot a Random Sample of Vectors (as Points) L = [vector([random(),random()]) for i in range(20)] vector_plotter(L, points=True)
15
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?
16
Example 5: Plot Vectors on a Certain Line L = [random()*vector([3,-10]) for i in range(100)] vector_plotter(L, points=True)
17
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?
18
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?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.