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.

I came up with this function: $$2\left(\frac{1}{1+e^{\textstyle\frac{-6\sin^{-1}(\cos(x))}{\pi/2}}}-\frac12\right)$$ to mimic a 'cosine'-esque function with flat peaks and valleys. Here it is as plotted by Wolfram Alpha:

Wolfram Alpha plot of above function

What I was wondering is, is there a more elegant way to achieve this effect? (The values the function outputs need not be the same as those of this function - it only needs to look cosine-esque and have flat peaks and valleys).

share|improve this question
    
    
When you say large peaks and valleys, do you mean flat peaks and valleys, or something else? –  soandos Jan 20 '12 at 3:47
    
Flat, yes. That's a better way of putting it. I'll edit my question to say this and to include the wolfram link. –  ro44 Jan 20 '12 at 3:48
    
The elegant way would be to use $f(\cos x)$ for any roughly S-shaped $f\colon [0,1] \to [0,1]$, like $(3t - t^3)/2$ or $\sin(\pi t/2)$. –  Rahul Jan 20 '12 at 3:50
    
Thanks, you can submit this as an answer Rahul. –  ro44 Jan 20 '12 at 3:53
show 1 more comment

3 Answers

up vote 4 down vote accepted

Well, if you accept $x^{1/25}$ as being defined for all real $x$ and giving a negative value when $x$ is negative, just take $$ f(x) = \left( \cos x \right)^{1/25} $$

share|improve this answer
add comment

How about $f(x) = \sin(\tfrac{\pi}{2}\cos(x))$?

enter image description here

share|improve this answer
    
Oh, sorry, I've just seen that this was in Rahul Narain's comment... –  Dirk Jan 20 '12 at 7:49
add comment

How about

$$\sqrt{\frac{1+b^2}{1+b^2 \cos^2 v}}\cos\,v$$

where $b$ is an adjustable parameter?

fake square waves

share|improve this answer
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.