How can I find cos(theta) and sin(theta) for the transformation matrix?
To rotate a vector in the plane by an angle of 𝜃 (radians), the matrix related to this transformation is given by:
𝑀=[cos𝜃 −sin𝜃]
[sin𝜃 cos𝜃]
How can I find cos(theta) and sin(theta) for the transformation matrix?
To rotate a vector in the plane by an angle of 𝜃 (radians), the matrix related to this transformation is given by:
𝑀=[cos𝜃 −sin𝜃]
[sin𝜃 cos𝜃]
Those are known, well-defined functions, right? If you know the value of \theta then np.sin
and np.cos
will give you the value of the sine and cosine of \theta.
I feel like I understand the transformation matrix, am getting failed tests despite coding using the numpy methods for sin/cosine as above. Is it possible I’m messing up the negative sine from the second vector? I’d be grateful for some input/hints, am willing to share my notebook if that’s helpful.
When rotating a vector counterclockwise by an angle θ, the rotation matrix should have a positive sine component. However, if the rotation is clockwise, then the sine component should be negative.
TL;DR:
I can take a look at your notebook to provide more specific guidance. Feel free to share it in Private Messages!
Thanks for your response. Clearly the whole clockwise/counterclockwise was something a smarter person would’ve picked up on, but I’m wondering how it affects the other values in the transformation matrix. I’ve tried several things ((np.sin(theta) * -1), np.arcsin(theta) that haven’t panned out either, would love some input on the attached at your convenience.
Best,
Tom
{moderator edit - solution code removed}
They show you in the instructions what the matrix needs to look like for a simple rotation. The code you wrote is not the same as what they show, right?
Please keep in mind that you cannot share your answers here! However, you can share your answers with mentors in Private Messages (Click on Profile → Message).
Upon reviewing your code, I noticed a minor issue with the transformation matrix T
. Your upper-right element of the matrix needs to be adjusted!
Thank you! was wondering that!