I'd like an easy way to numerically produce periodic functions that have the same min/max patterns as sine and cosine, but with fatter/skinnier widths of the humps. The extrema would still be at the same locations, just the parts between them would be stretched/compressed. What is a simple way to accomplish this, without resorting to many terms? It will be implemented in Numpy.
Distorted sine function
periodic functionstrigonometric series
Related Solutions
Let $y=A\sin\left(2\pi\dfrac xP\right)$.
The arc length is given by the integral
$$\int_{x_0}^{x_1}\sqrt{1+y'^2(x)}dx=\int_{x_0}^{x_1}\sqrt{1+\frac{4\pi^2A^2}{P^2}\cos^2\left(2\pi\dfrac{x}P\right)}dx.$$
The latter has no closed form with usual functions and requires the so-called elliptic integrals.
These functions are called complete or incomplete, depending on whether you cover whole periods of the sinusoid or not.
If you can tolerate an approximation, you could replace the sinusoid by arcs of hyperbolic cosine, which lead to an analytic solution.
$$y=\cosh(x)\to\int \sqrt{1+\sinh^2(x)}dx=\int\cosh(x)\,dx=\sinh(x)+C.$$
I assume you want something like this:
This is the line $y = x$ up to some maximum point $c$, which it maintains until it gets to $\pi - c$, where it drops by the line $y = \pi - x$, etc. We can control $c$ to determine the best fit.
The simplest criterion to find the best fit for is the minimum height difference between the two curves. The trapezoidal curve (the usual term of art for this sort of curve is "piecewise linear") is highest above the sine curve at $x = c$, where the distance is $c - \sin c$. The sine curve is highest above the trapezoidal curve at $x = \pi/2$, where the distance is $1 - c$. The distance will be minimized when these two distances are equal, so $c - \sin c = 1 - c$. Wolfram Alpha computes this to be when $c \approx 0.887862$.
If you want to minimize the area, that calculation is a lot more complex. By symmetry, it is sufficient to look only at the portion between $0$ and $\pi/2$, where the area is given by $$A = \left(\int_0^c x\,dx + \int_c^{\sin^{-1} c} c\,dx - \int_0^{\sin^{-1} c} \sin x\, dx\right) + \left(\int_{\sin^{-1} c}^{\pi/2} \sin x\, dx - \int_{\sin^{-1} c}^{\pi/2} c\,dx\right)\\=\frac{c^2}2 + c(\sin^{-1}c - c) - (1 - \cos(\sin^{-1}c)) + \cos(\sin^{-1}c) -c(\frac{\pi}2- \sin^{-1}c)\\=-1 - \frac\pi 2 c - \frac {c^2}2 +2\sqrt{1 - c^2} + 2c\sin^{-1}c$$
To minimize the area, we take the derivative with respect to $c$ and set it to 0: $$A' = -\frac \pi 2 - c -\frac{2c}{\sqrt{1 - c^2}} + 2\sin^{-1}c + \frac {2c}{\sqrt{1-c^2}}=2\sin^{-1}c-\frac \pi 2 - c = 0 $$ Which Wolfram Alpha says is $c \approx 0.95261$.
Of course, I just used $y = \sin x$, whereas your curve will need to be of the form $$y = A\sin(Bx)$$ but the same solution should work using lines of slope $\pm AB$, and a cutoff value of $C = Ac$ for your choice of the two $c$ values calculated above.
Best Answer
You can try $sin^k(x)$ and $cos^k(x)$ where $k$ is odd for skinnier bumps:
Or $sin^{\frac{1}{k}}(x)$ and $cos^{\frac{1}{k}}(x)$ where $k$ is odd for fatter bumps:
Does this suffice for what you are looking for?