Excuse my badly drawn cosine graph.
Is it possible? If so, how?
ID:154679
Jan 19 2012, 12:55 pm
|
|
(3cos(x)-cos(x)^3)/2
2/(1+1000^-cos(x))-1 sin(pi*cos(x)/2) |
One option is taking an odd root of the function. Cubing for example would tend to pull values close to 1 farther away from 1, whereas you want to push values away from 0, so a cube root could do the trick. (You might need some special logic to account for the 0 case, possibly also the negative cases, depending on how the math is implemented.)
Another option is to feed one sine wave into another. sin(x + sin(2x)/2) produces some fatter peaks. |
In response to Lummox JR
|
|
To generate the functions in my post, take a sigmoid -1<=s(x)<=1 where roughly f(0)=0, f(1)=1, f(-1)=-1, and feed cos(x) to it to get the function s(cos(x)). This works because f(cos(x)) would 'stay' at the 1 or -1 when cos(x) is close to 1 or -1 respectively, and rapidly approach 0 as cos(x) approaches 0.
Incidentally you can take apart the function sin(x+sin(2x)/2) in the same way; sin(x+sin(2x)/2)=sin(x+sin(x)cos(x)), which is f(sin(x)) for f(x)=sin(arcsin(x)+x*cos(arcsin(x)) - a nice sigmoid in -1 to 1. |
In response to Toadfish
|
|
That's an interesting technique. Using sigmoids actually you have a lot of flexibility.
In a sigmoid, s(nx) = s(x)^n / (s(x)^n + s(-x)^n), where s(-x) = 1 - s(x). If you take sin(x) and rescale it into a sigmoid 0 to 1 range, you can apply this formula to push the values further out toward the extremes. y = sin(x) s = (y+1)/2 y' = 2(s^n / (s^n + (1-s)^n))) - 1 y' = 2((y+1)^n / ((y+1)^n + (1-y)^n))) - 1 n = 2 y' = 2((y+1)^2 / ((y+1)^2 + (1-y)^2))) - 1 y' = 2((sin^2(x) + 2sin(x) + 1) / (2sin^2(x) + 2)) - 1 y' = (sin^2(x) + 2sin(x) + 1) / (sin^2(x) + 1) - 1 y' = 2sin(x) / (sin^2(x) + 1) You can use any value of n, though n=2 is simplest if you want a nice easy formula. |
What you're trying to get isn't really lengthening the wavelength either. It's more like stunting the apex of the sin wave.