5

As the title states, I've been trying to create a function that is identical to $\sin(x)$, except that it has a steeper slope in the middle of the decreasing portion of the curve, but mellows out such that this function and $\sin(x)$ have the same turning point for both peak and bottom.

I've tried to describe it in the following image, if we pretend the top function is $\sin(x)$, I'd like to create something akin to the bottom image. Currently I am trying some variation of $\sin(x-0.5\sin(x))$, which gives me the steeper slope, but this shortens the actual duration and the peaks and lows don't line up.

Any hints on functional forms I could try would be appreciated!

Pardon my extremely poor paint skills:

enter image description here

Tengu
  • 4,072
user495731
  • 51
  • 2
  • Well you could just raise sin(x) to a fractional power like 1/10. This runs into trouble when sin(x) is negative though but you could just piecewise two of them together to handle the negative and positive. – Brandon Enright Oct 25 '17 at 20:55
  • Maybe something like $(3/2) \sin(x) - (1/2) \sin(x)^3$? – Robert Israel Oct 25 '17 at 21:00
  • Are you looking for steeper only in the decreasing part, or is it symmetrical ? – G Cab Oct 25 '17 at 21:57
  • @Robert Israel, your solution is $1/8 (9 \sin(x)+ \sin(3 x))$. These coefficients are somehow optimal. I wonder what was your intuition? – fred goodman Oct 26 '17 at 15:38

2 Answers2

1

What do you mean when you say "create"? You can take $H\circ \sin(x)$, where H has the properties: $H(x)$ close to $-1$ for $x \le -1/3$, $H(x)$ close to $1$ for $x \ge 1/3$, $H$ is weakly increasing, $H$ is smooth, and $H(-x) = -H(x)$ You can "create" such an $H$ by taking a piecewise linear function and then convolving with a smoothing function (e.g. normalized Gaussian).

I programmed this in Mathematica. Here's the plot of $H$, followed by the plot of $H\circ \sin$.

plot of H

modfied sin

Code:

h[x_] := Piecewise[{{-1, x <= -1/3}, {1, x >= 1/3}}, 3 x ]
A = 1/4;    (*parameter for Gaussian;  smaller gives narrower peak *)
G[x_] :=  Exp[-(x/A)^2/2]/(A Sqrt[2 Pi]); 
H[y_] = Convolve[h[x], G[x], x, y]; 
L[x_] :=  H[Sin [x]]
Plot[h[x], {x, -2, 2}]
Plot[H[x], {x, -2, 2}]
Plot[L[x],  {x, -10, 10}]
fred goodman
  • 4,253
1

Here's a fairly straightforward solution:

$ f_k(x) = \arctan(k \cdot \sin x) / \arctan k $

Steep sine

We are using a non-uniform scaling function

$ f_k(x) = \arctan(k \cdot x) / \arctan k $

where $k$ determines the degree of deformation:

  • with small $k$ (e.g. $0.001$) it's almost identity transform.
  • with larger $k$ (e.g. $4$ or more) there's more upward/downward deformation

Because the domain is the result of $\sin x$, we don't worry what happens outside $[-1..1]$, so we don't need to make it piecewise.

Steep deformation

Other non-uniform scaling functions in the Sigmoid function family are applicable.

An application in image processing is for producing high contrast transformation.

olegyk
  • 11
  • This is EXACTLY what I needed. Thank you! For some context: I'm using this to blend between two post process volumes inside of a day/night cycle for my game. – dimiguel Sep 23 '21 at 01:23