9
$\begingroup$

My aim is to get a "cosine looking" curve rotated 45° counterclockwise.

When I graph : g(x)= x + cos(x) , I get a curve that has lost the nice and regular wavering of the ordinary f(x)= cos(x) curve.

Adding a coefficient does not work, but rather aggravates the change of form.

Is there a possible equation that would produce the curve I am aiming at?

Thanks for your help.

enter image description here

$\endgroup$
11
$\begingroup$

Unfortunately, you can't with an explicit equation $y=f(x)$.

You need to resort to a parametric form such as

$$\begin{cases}x=t+\cos t,\\y=t-\cos t\end{cases},$$ obtained by rotation.

enter image description here

It is not possible to invert $x=t+\cos t$ analytically.


It is also possible to approximate this effect by assembling replicas and symmetries of the graph of a function like

$$y=\sqrt[n]{1-x^n}$$ computed in the interval $[0,1]$.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ out of curiosity I've just asked How do we know that is not possible to invert $x=t+\cos t$ analytically? $\endgroup$ – uhoh Feb 23 at 1:50
  • 1
    $\begingroup$ Apart from the slope it's periodic, perhaps Fourier analysis on x=t+cos(t),y=-cos(t) could yield f() such that y=x+f(x). $\endgroup$ – Jasen Feb 23 at 3:51
  • 1
    $\begingroup$ @Jasen: Fourier analysis on a parametric curve is difficult. And due to the vertical slope, the Fourier series will converge very poorly, with strong Gibbs oscillations. Not a good idea. $\endgroup$ – Yves Daoust Feb 24 at 7:36
  • $\begingroup$ yes, I tried doing it numerically (using a speadsheet because I don't know how to drive Octave) I do see stong Gibbs phenomonon near the vertical it seems to converge slowly and takes about 14 terms before it even starts looking good this is possibly helped by the vertical part being a point rather than a line segment, $\endgroup$ – Jasen Feb 24 at 21:50
14
$\begingroup$

If you have the points of the form $\bigl(x,\cos(x)\bigr)$, you have the graph of the $\cos$ function. Now, multiply this by the matrix$$\begin{bmatrix}1&-1\\1&1\end{bmatrix}\left(=\sqrt2\begin{bmatrix}\cos\left(\frac\pi4\right)&-\sin\left(\frac\pi4\right)\\\sin\left(\frac\pi4\right)&\cos\left(\frac\pi4\right)\end{bmatrix}\right).$$In other words, consider the points of the form $\bigl(x-\cos(x),x+\cos(x)\bigr)$.

$\endgroup$
8
$\begingroup$

Wanting to consider the general case of roto-translation, writing in Wolfram Mathematica 12.0:

R[θ_] := {{Cos[θ], Sin[θ]}, {-Sin[θ], Cos[θ]}}
{xC, yC} = {2, 1};

xAxis = {xC, yC} + {t, 0}.R[θ];
yAxis = {xC, yC} + {0, t}.R[θ];
fun = {xC, yC} + {t, Cos[t]}.R[θ];

frames = Table[Magnify[ParametricPlot[{xAxis, yAxis, fun}, {t, -12, 12},
                       Epilog -> {Text[StringJoin["θ = ", ToString[TraditionalForm[θ]]],
                       {5, 9}], Black, PointSize[Large], Point[{xC, yC}]},
                       PlotRange -> {{-10, 10}, {-10, 10}},                                   
                       PlotStyle -> {Blue, Red, Green}], 2],
               {θ, 0, 2π, π/20}];

Export["image.gif", frames, "AnimationRepetitions" -> ∞, "DisplayDurations" -> 1];

we get:

enter image description here

$\endgroup$
5
$\begingroup$

As pointed out by user76284 in a comment, this can be done by writing an equation like $y-x=\cos(x+y)$. This form helps us to understand why we can't write down a closed-form equation for $y$ in terms of $x$, using only elementary functions. Such an equation would be a solution to a transcendental equation, which normally can't be expressed in this way. It also shows how we could probably write down a closed-form equation if we were willing to resort to special functions. For example, I would guess that you could write this function in terms of the Lambert W function or something similar.

$\endgroup$
  • $\begingroup$ More generally, if $\theta$ is the desired angle of rotation, we have $u = \cos v$ where $u = x \cos \theta + y \sin \theta$ and $v = x \cos (\theta + \frac{\pi}{2}) + y \sin (\theta + \frac{\pi}{2})$. $\endgroup$ – user76284 Feb 23 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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