Rotate a parametric plot

asked 2020-01-07 10:47:17 +0100

asya432856 gravatar image

updated 2020-01-07 15:14:27 +0100

Iguananaut gravatar image

Hi,

I am trying to rotate a plot given by


t=var("t")
P=parametric_plot((cos(2*t),  sin(3*t) ), (t,-10*pi,10*pi),rgbcolor=(1,0,0), thickness=2,scale='linear')
. I can rotate P by using the rotation matrix
PR=parametric_plot( (R(theta)*vector([cos(2*t), sin(3*t)])), (t,-10*pi,10*pi),rgbcolor=(1,0,0), thickness=2,scale='linear')

But is there a way to rotate it without drawing it again?

edit retag flag offensive close merge delete

Comments

What do you mean by "without drawing it again"? If you just want to perform the rotation then just perform the rotation: R(theta)*vector([cos(2*t), sin(3*t)]). This is the actual application of the rotation matrix to a vector; you just need to supply values for t. parametric_plot only plots your vectors for some range of t., but of course you can perform these calculations without plotting them. What are you trying to accomplish exactly?

Iguananaut gravatar imageIguananaut ( 2020-01-07 15:18:28 +0100 )edit

Thank you very much for your quick answer! I am trying to covert some exercises from Maple to Sage, and in Maple there is the following possibility to rotate a plot

with(plots): with(plottools): showRotation:=proc(theta) local T; T:=theta->transform((x,y)->convert(R(theta).<x,y>,list)): display( T(theta)(P), P); end proc:

showRotation(Pi/3)

And I was trying to find an analougue of it in Sage. Thank you very much in advance!

asya432856 gravatar imageasya432856 ( 2020-01-07 17:44:53 +0100 )edit

I don't know Maple so I don't know exactly how to interpret that example. But what do you mean by "rotate a plot"? That could have several different interpretations. In the example you gave in Sage you didn't rotate the plot so much as you rotated a vector field and that plotted the rotated vector field. Do you want to rotate the axes? The entire image?

Iguananaut gravatar imageIguananaut ( 2020-01-07 17:52:08 +0100 )edit

Exactly, I want to rotate the entire image, if it is possible.

asya432856 gravatar imageasya432856 ( 2020-01-07 18:03:28 +0100 )edit

As in just, rotating all the pixels of the image, including axes? I'm still not sure why you would want to do that. And also the question is: rotate by an arbitrary amount, or just by 90 degrees? Since rotating images by arbitrary angles means you need some way to deal with clipping. Perhaps you could just add some example images of what results you're trying to obtain...

Iguananaut gravatar imageIguananaut ( 2020-01-08 16:18:59 +0100 )edit