I have function that is defined as
$$ Y = \frac{1}{15} x \longrightarrow {\rm if}\qquad 0 \leq x \leq 30 $$ $$ Y = \frac{1}{70} x + \frac{11}{7} \longrightarrow {\rm if}\qquad x > 30 $$
The problem I have is that at $x = 2$, the change between both equations is too sudden. So I'm looking for perhaps a "transition" equation which would smooth the change.
Thanks
(sorry about the formulas, I can't get to understand $\LaTeX$)
EDIT: I don't need the actual equation (although it wouldn't hurt me to have it). What I want to learn is actually how can I build such an equation. (my problem is always using to lines)
OK, Ross offered you a function that is smooth but not infinitely smooth. I will offer you an infinitely smooth solution - which is moreover more explicit. Let me give you an infinitely smooth interpolation. Define (or recall) $$ \tanh (a) = \frac{e^a - e^{-a}}{e^a+e^{-a}} $$ This function goes to $\pm 1$ for $a\to\pm\infty$ but is infinitely smooth.
A smooth version of your function may be written as $$y = \frac{x}{15} + \frac{1+\tanh [K(x-30)]}{2} \left( \frac{x}{70}-\frac{x}{15} + \frac{11}{7} \right) $$ Here, $K\in R^+$ may be chosen arbitrarily. The larger $K$ you choose, the more closely my function will resemble your unsmooth function. The smaller $K$ you will choose, the "smoother" will be my function. But in the technical sense, the function above is infinitely smooth and infinitely differentiable.
Why does it work? For $x<30$ or $x\ll 30$, the factor $(1+\tanh)/2$ goes to zero, so $y$ reduces to the first term, $x/15$, as needed. On the other hand, for $x>30$ or more precisely $x\gg 30$, the factor $(1+\tanh)/2$ goes to $1$, so the parenthesis with the three terms is multiplied by one; $x/15$ gets canceled and you're left with $x/70-11/7$.
Instead of $\tanh a$, you could also use $(2 \arctan (a) / \pi)^3 $ or any other smooth function interpolating between $-1$ and $+1$. I chose the third power here to be sure that it converges to $\pm 1$ quickly enough and the linear factors don't spoil it. For this reason, $\tanh$ is safer.
You might use the method even for more than two pieces. First, merge two of them by the method, and treat is as a function that you may smoothly merge with another function, and so on.