In a previous lesson you plotted a parabola. Plotting something
like $y=x^2$ might seem pretty easy. But what if you wanted to draw a parabola that was rotated by say $15^\circ$?
How would you do that?

It turns out that if you want to rotate an $(x,y)$ point through an angle of $\theta$, you can use
these equations to compute a new $(x,y)$ pair, that is *rotated* through and angle $\theta$:

$xp = x \cos\theta - y \sin\theta$

$yp = x \sin\theta + y \cos\theta$

In this notation, if $x$ and $y$ are your unrotated (or "normal") points, then $xp$ and $yp$ will be where the point would be, if rotated through $\theta$ degrees.

Type your code here:

See your results here:

You can use

`dcos(..)`

and `dsin(..)`

for sin and cos functions that use degrees, or `math.cos(..)`

and `math.sin(..)`

for functions that use radians.
When done rotating a parabola, trying rotating a sine-wave, or a line, a $x^4$ polynomial, or any other math function you want! Dismiss.

Does your code work? Want to run it on your iPhone?

Here's your code:

- Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
- Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
this page
- Then click the "Use on iPhone" button that you'll see.