Commit 088afdab authored by Jim Hefferon's avatar Jim Hefferon

all slides; fix angle plot so it shows signed angle

parent 148032c0
......@@ -194,6 +194,8 @@ def plot_before_after_action(a, b, c, d, pts, colors=None):
p = plot(G)
return p
# Find the signed angle between the planar vector v and Mv
# See http://math.stackexchange.com/a/879474/12012
def find_angles(a,b,c,d,num_pts,lower_limit=None,upper_limit=None):
"""Apply the matrix to points around the upper half circle, and
return the angle between the input and output vectors.
......@@ -215,12 +217,42 @@ def find_angles(a,b,c,d,num_pts,lower_limit=None,upper_limit=None):
v = vector(RDF, pt)
w = v*M
try:
angle = arccos(w*v/(1.0*w.norm()*v.norm()))
dot = v[0]*w[0] + v[1]*w[1] # dot product
det = v[0]*w[1] - v[1]*w[0] # determinant
angle = atan2(det, dot) # atan2(y, x) or atan2(sin, cos)
except:
angle = None
r.append((t,angle))
return r
# This finds the positive angle between the vectors.
# def find_angles(a,b,c,d,num_pts,lower_limit=None,upper_limit=None):
# """Apply the matrix to points around the upper half circle, and
# return the angle between the input and output vectors.
# a, b, c, d reals Upper left, ur, ll, lr of matrix.
# num_pts positive integer number of points
# lower_limit=0, upper_limit=pi ignore angles outside these limits
# """
# if lower_limit is None:
# lower_limit=0
# if upper_limit is None:
# upper_limit=pi
# r = []
# M = Matrix(RDF, [[a, b], [c, d]])
# for i in range(num_pts):
# t = i*pi/num_pts
# if ((t<lower_limit) or (t>upper_limit)):
# continue
# pt = (cos(t), sin(t))
# v = vector(RDF, pt)
# w = v*M
# try:
# angle_size = arccos(w*v/(1.0*w.norm()*v.norm()))
# except:
# angle = None
# r.append((t,angle))
# return r
MARKERSIZE = 2
TICKS = ([0,pi/4,pi/2,3*pi/4,pi], [0,pi/2,pi])
def color_angles_list(a, b, c, d, num_pts, colors):
......
......@@ -27,7 +27,7 @@ p=plot_before_after_action(2,2,0,2,[(cos(pi/6),sin(pi/6))],['orange'])
p.set_axes_range(-0.1,2.1,-0.1,2.75)
p.save("graphics/five_ii_a_skew4.pdf")
p = plot_color_angles(2,2,0,2)
p.set_axes_range(0,pi,0,pi)
p.set_axes_range(0,pi,-pi,pi)
p.save("graphics/five_ii_a_skew5.pdf", figsize=3, tick_formatter=[pi,pi])
......@@ -38,8 +38,12 @@ q.save("graphics/five_ii_a_generic1.pdf")
p = plot_circle_action(1,3,2,4)
p.set_axes_range(-3, 3, -4.5, 4.5)
p.save("graphics/five_ii_a_generic2.pdf")
# positive angle:
# p = plot_color_angles(1,3,2,4)
# p.set_axes_range(0,pi,0,pi)
# p.save("graphics/five_ii_a_generic3.pdf", figsize=3, tick_formatter=[pi,pi])
p = plot_color_angles(1,3,2,4)
p.set_axes_range(0,pi,0,pi)
p.set_axes_range(0,pi,-pi,pi)
p.save("graphics/five_ii_a_generic3.pdf", figsize=3, tick_formatter=[pi,pi])
......@@ -51,6 +55,6 @@ p = plot_circle_action(-1,0,0,2)
p.set_axes_range(-2.5, 2.5, -2.5, 2.5)
p.save("graphics/five_ii_a_diagonal2.pdf")
p = plot_color_angles(-1,0,0,2)
p.set_axes_range(0,pi,0,pi)
p.set_axes_range(0,pi,-pi,pi)
p.save("graphics/five_ii_a_diagonal3.pdf", figsize=3, tick_formatter=[pi,pi])
......@@ -376,14 +376,14 @@ Here is the diagram, specialized for this case.
\Re^2_{\wrt{B}} @>t_{\pi/6}>\hat{H}> \Re^2_{\wrt{D}}
\end{CD}
\end{equation*}
To get $H$ we move down from the upper left, across, and then back up.
To get $\hat{H}$ we move up from the upper left, across, and then down.
\end{frame}
\begin{frame}
With respect to the standard basis real vectors represent themselves,
so the matrix representing moving up is easy.
\begin{equation*}
\rep{id}{B,\stdbasis_2}
\begin{mat}
=\begin{mat}
1 &1 \\
1 &-1
\end{mat}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment