0
$\begingroup$

Is there a way to write a function so that for any $c$ such that $a < c < b$, $f(c)$ is always the same?

For example, if you had an increasing function up until $0$ at which point the $f(x)$ is $0$ all the way until $10$ when the function starts decreasing again.

I am not looking for horizontal lines or piecewise functions.

  • 0
    How about a definition by cases, e.g. $$f(x)=\begin{cases} x &\text{if }x<0\\ 0&\text{if } x\geq 0\end{cases}$$2012-09-15
  • 2
    What is your goal? Why do you *think* you don't want to define your function piece-wise?2012-09-15
  • 0
    So, you want a function that has one piece doing one thing, another piece that is constant, and another piece that does another thing, but even though the pieces are very different, you don't want to define the pieces separately?2012-09-15
  • 0
    Why are piecewise functions out of the question? Perhaps smooth bump functions are what you are looking for.2012-09-15

2 Answers 2

2

Although I have no idea why you avoid piecewise defined functions, here is a smooth "flattening" function defined by a differential equation: $$ f'(x)=\sqrt{1-f(x)^2},\qquad f(0)=0 $$ The solution of the above equation is unique, it agrees with $\sin x$ on $[-\pi/2,\pi/2]$, and agrees with $\mathrm{sign}\, x$ for $|x|>1$. It's just the "sine concatenated with sign" :) but the concatenation comes from the ODE, it's not imposed artificially.

If differential equations are not good either, here is another version: $$ g(x)=\min_{0\le t\le |x|} \cos t $$ This function agrees with $\cos $ on $[-\pi,\pi]$ and is $-1$ elsewhere. Again, no cases specified in the definition.

0

Assuming you are talking about non-piecewise linear functions, you might want to look at absolute values:

$$f(x) = a \left | x - p \right | + q$$

Where $a$ is the slope, $p$ is the horizontal translation, and $q$ is the vertical translation.

You can also use combinations of absolute values to include more 'sharp'/discontinuous points.


Be aware that absolute values are either defined by piecewise functions:

$$\left | x \right | = \begin{cases} -x &\text{if }x<0\\ x&\text{if } x\geq 0\end{cases}$$

Or:

$$\left | x \right | = \sqrt{x^2}$$

As far as I know, there are no exact functions which match your definition, but you can approximate them. However, I would presume that these 'approximation functions' are quite insanely complex.