@interact
def linear_transformation(
theta = slider(0, 2*pi, .1),
r = slider(0.1, 2, .1, default=1),
A = input_grid(2, 2, default = [[1,2],[0,2]],
to_value=matrix)):
"""An interact which illustrates ...
"""
v=vector([r*cos(theta), r*sin(theta)])
w = A*v
unit_sphere = circle((0,0), radius = 1, rgbcolor = (1,0,0))
var('t')
image_of_sphere = parametric_plot(A*vector([sin(t),cos(t)]),
(t, 0, 2*pi), rgbcolor=(0,0,1))
html("$v = %s,; %s w=%s$"%(v.n(4),latex(A),w.n(4)))
show(v.plot(rgbcolor=(1,0,0)) +
w.plot(rgbcolor=(0,0,1)) +
unit_sphere + image_of_sphere,
aspect_ratio=1)
I'm a total newb when it comes to plotting in sage, so I would very much appreciate the help.
We used something like this for a class once. You can follow which point is transformed where
def vector_plotter(vec_list, points=False, **kwds):
pic = Graphics()
for c, v in zip(rainbow(len(vec_list), 'rgbtuple'), vec_list):
if points:
pic += point(v, rgbcolor=c, **kwds)
else:
pic += plot(v, rgbcolor=c, **kwds)
return pic
#V is a list of vectuors
vector_plotter(V)
vector_plotter([M*v for v in V])