A few minutes ago, I wondered how to write a function whose graph would be a sine curve, but one that undulated above and below the diagonal line y=x, rather than the x-axis, as is usually the case. How to accomplish such a 45 degree counterclockwise rotation?
Well, first, I abandoned degrees, set Geometer’s Sketchpad to radians, and then simply constructed plots for both y = x and y = sin(x). Next, I added them together. The result is the green curve (and equation) you see above.
This only half-solves the problem. Does it undulate above and below y=x? Yes, it does. However, if you rotate this whole thing, clockwise, one-eighth of a complete turn, so that you are looking at the green curve going along the x-axis, you’ll notice that it is not a true sine curve, but a distorted one. Why? Because it was generated by adding y-values along the original x-axis, not by a true rotation.
I’m not certain how to correct for this distortion, or otherwise solve the problem. If anyone has a suggestion, please leave it in a comment. [Note: an astute follower of this blog has now done exactly that, so I refer the reader to the comments for the rest of the story here.]
I would define x’ = x cos(pi / 4) + y sin(pi / 4) and y’ = x sin(pi / 4) – y cos (pi / 4). This rotates the axes 45 degrees from (x,y) to (x’,y’).
Then I would graph y’ as a function of x’. I tried it on Excel just to be sure. I made a column of x varying from 0 to 6.3 in steps of 0.1, a column of y defined as sin(x), and two columns for x’ and y’, then graphed y’ as a function of x’ in an xy scatter plot.
(It also simplifies to x’ = (x + y) / sqrt(2) and y’ = (x – y) / sqrt(2).)
LikeLiked by 1 person
Thanks for the help! I’ll update the post to redirect people to the comments for, well, the end of the story.
LikeLiked by 1 person
Thank you for stirring my interest. 🙂
LikeLike
Hi – great post. Frankly, I still do not understand how this corrects your issue. So instead of “h(x) = sin(x) + x” what should the function be?
LikeLike
do you know how to make the diagonal go where ever you want like have it more vertical or horizontal
LikeLike
Well, all I did was add y = x to the sine function. For other slopes, use y = kx instead of y = x, with k not equal to one. This still only “half-solves” it, though; the resultant wave is skewed.
LikeLike
I was able to find an implicit function that graphs what you want. y=sqrt(2)(sin((x+y)/sqrt(2))+x
LikeLiked by 1 person
Thank you!
LikeLike
I realize this is very far behind but you could possibly use polar coordinates, set R as your independent variable and have the sine wave oscillate about the function theta=45deg.
LikeLiked by 1 person
Simplifing chrismcmullen’s further more:
x.cos(0.25pi) – y.sin(0.25pi) = sin(x.sin(0.25pi) + y.cos(0.25pi))
LikeLiked by 1 person