Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Assuming I have the graph of a function $f(x)$ is there function $f_1(f(x))$ that will give me a rotated version of the graph of that function?

For example if I plot $\sin(x)$ I will get a sine wave which straddles the $x$-axis, can I apply a function to $\sin(x)$ to yield a wave that straddles the line that would result from $y = 2x$?

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

Once you rotate, it need not remain a function (i.e. one $x$ value can have multiple $y$ values corresponding to it).

But you can use the following transformation

$$x' = x\cos \theta - y \sin \theta$$ $$y' = x \sin \theta + y \cos \theta$$

to rotate by an angle of $\theta$. Point $(x,y)$ gets rotated to point $(x',y')$. Note: this is a rotation about the origin.

In your case of $y = 2x$, you need to rotate by $\arctan(2)$.

See this for more info: Rotation Matrix.

share|improve this answer
    
In the specific case of sin(x) if you rotate by something in the range (-pi/4,pi/4) you still have a function because the slope of sin(x) is always less than 1 in absolute value. –  Ross Millikan Jan 12 '11 at 17:34
    
I think this is what I want. I want to animate something so that it undulates as if it were following a sin wave but not always in parallel to the x axis. –  Omar Kooheji Jan 12 '11 at 17:43
    
@Omar: It looks like the parameterization that Rasmus refers to will suit you nicely. It gives you x and y each as a function of t and avoids the "double x" problem. –  Ross Millikan Jan 12 '11 at 19:25
add comment

In general, the answer is no since the rotated version of the graph might not be the graph of a function. For instance it could happen that your rotated version of the graph contains two different points with the same $x$-value -- this cannot happen for the graph of a function.

A way out could be to parametrise your graph. So instead of a map $x\mapsto y(x)$ you look at the map $t\mapsto (t,y(t))$. After rotating the trajectory of this thing (not the graph!) it will still be the trajectory of a map $$t\mapsto (x(t),y(t)).$$

share|improve this answer
add comment

You can do the rotation as Moron says, or you can write $y=2x+\sin(x)$. This will remain a function, but doesn't have the same shape as a sine wave. It depends upon what you want.

share|improve this answer
    
I've tried this and it yields okay results for what I want to do. I might use this for something else. I'd been trying to multiply when I should have been adding... –  Omar Kooheji Jan 12 '11 at 17:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.