How can you create a function with same shape that the cosine function but with thorns?

131 Views Asked by At

While I was playing with Wolfram Alpha online calculator, I've found what seems an exceptional recreation. Create a function with the same shape of a cosine function, more or less the same shape, but with thorns. I call to a function of such kind a cactus-cosine.

Variants of my example

$$ \left\{ x \right\}^{ \left\{ x \right\} }\cos(x), $$ where $ \left\{ x \right\} $ is the fractional part function, that I believe that aren't periodic functions, are written in Wolfram Language as

plot frac(x)^frac(x)cos(x/2), for 0<x<50

or

plot frac(x)^frac(x)cos(x/4), for 0<x<50

I would like to know new expressions or methods to obtain a similar result. Isn't required that yourself method to draw a cactus-cosine will provide us periodic functions, only is required that seems periodic more or less and with the same shape of a cosine. But it is required that you use the cosine function in your expression, formula or recurrence, to avoid simple answers based in fractals of triangles.

Question. Can you make a different cosine with thorns in a segment using in your expression, formula or recurrence at least a cosine function? Isn't required that it be a periodic function, but it is required that it has more or less the shape of a cosine function. You can do sum, multiply,..composition with special functions, to create your function, recurrence... Many thanks.

1

There are 1 best solutions below

1
On BEST ANSWER

One way to create thorns is with absolute value of a periodic function, such as cosine. Such a "thorns" function can be $$\frac{1}{|\cos x|+1}$$ I did not want my thorns to be divergent. If that's not a problem, use $|\cos x|^{-1}$. You can change periodicity of the thorns by multiplying $x$ by a factor, and amplitude of the thorns by multiplying the whole expression by a constant. Now, to apply it on top of the cosine function, you can add (thorns will point always up), subtract (thorns will point down), or multiply (thorns will point away from the axis)

plot ((1/(abs(cos(x*5))+1)+cos(x/2)), for 0<x<50
plot ((-1/(abs(cos(x*5))+1)+cos(x/2)), for 0<x<50
plot ((1/(abs(cos(x*5))+1)*cos(x/2)), for 0<x<50