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
You can give it a list of points, and in another plot look at the list of
transfrmed points.
#V is a list of vectuors
vector_plotter(V)
vector_plotter([M*v for v in V])
On Sunday, March 2, 2014 11:52:32 PM UTC+8, martyall wrote:
>
> I would like to plot the "effects" of an 2 by 2 matrix over the reals on
> the unit sphere in the p-norm. By effects I mean I would like to plot the
> unit sphere and it's image under a given matrix. In clearest case when p=2
> I found the following code from trac #9728 which does exactly what I want.
>
> @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.
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.