# camel hump with trigonometry

sorry if this is a fool question but i use math mainly for playing and i'm not a math guru.

i want to understand how get a camel hump with trigonometry, with some parameters. changing parameters i would like to set one hump more higher than the other. i have tried with wolfram alpha some plot but haven't find a good function.. some advice?

and how to get the min, the max and the period? (without wolfram i mean ;)

You may be better off without using trig. For a function having bumps near $a,b$ with their heights controlled by $k1,k2$, I found that $$f(x)=\frac{k1(x-a)^2+k2(x-b)^2}{x^4+1}$$ works well. For my test case I used values of $a,b$ which were negatives of each other, which you can do by using the average of where you want the bumps, and shifting the inputs. And the larger value of $k1,k2$ went with the shorter hump.

When one puts this function into a derivative formula in order to find the exact location of local maxes, one has to solve a fifth degree equation to get the $x$ coordinates where the maxes actually occur. Seems these are only "near" the points $a,b$ used in making up the function. And of course this function is not periodic, since it dies off away from zero.

If you want a trig version, it looks like you can use $$f(x)=a \sin^2{x}+b \sin^2{2x}+c \sin^2{4x}-2a/\pi$$ but only graph it from $0$ to $\pi/2$. Outside that range it gets wierd, not looking like a double hump. For this one I don't know how to fiddle around with $a,b,c$ to control the hump sizes, but at least in the few cases I tried I got humps of different sizes.

I agree with coffeemath; I would recommend not using trig functions. You aren't exactly asking for a curve that is periodic; any trig function will be periodic.

I would try two bell curves, summed together. A bell curve is essentially zero not too far from it's peak, so each bump would maintain itself after summing them together.

$$A_1e^{-k_1(x-b_1)^2}+A_2e^{-k_2(x-b_2)^2}$$

where $A_i$ is the height of bump $i$, $\sqrt{k_i}$ is a measure of how wide bump $i$ is, and $b_i$ is the $x$-value of the center of bump $i$.

If this produces bumps that are too pointy, you can raise the power of the binomial in the exponent to flatten it out. You need to put absolute value around that binomial though.

$$A_1e^{-k_1|x-b_1|^{2.5}}+A_2e^{-k_2|x-b_2|^{2.5}}$$

• Looks like here also (as in mine) one doesn't have exact control over where the bumps end up, in terms of $b_1,b_2$. I think when the two curves get added, their "bump locations" get shifted a bit. – coffeemath Nov 5 '12 at 19:22
• @coffeemath Yep, but I think in both cases that the aberration will be very small. – alex.jordan Nov 5 '12 at 19:24