14

I was surprised to find the clamp function absent from Mathworld and Wikipedia. Is this mainly a concept particular to computer programming? Is it known by another name in mathematics? I'll be editing the Wikipedia shortly to include a reference to this function but I want to make sure I'm not omitting some synonymous terms I'm currently unaware of.

$$ \operatorname{clamp}(x) = \max( a , \min( x , b ) ) \in [a,b] $$

Mike Pierce
  • 18,938
jxramos
  • 281
  • 1
    Mathematics doesn't make significant use of such a function (and when it does, it will inevitably be defined in situ). – Chappers Jun 23 '15 at 18:47
  • http://gallery.rcpp.org/articles/sugar-function-clamp/ is this what you refer? It's a math function specific to an R language library. There are references to it's usage in the link(points to some Stackoverflow questions). Mathworld wouldn't reference it since it's R specific. – scrappedcola Jun 23 '15 at 18:47
  • you have https://en.wikipedia.org/wiki/Clamping_(graphics) – janmarqz Jun 23 '15 at 19:15
  • 1
    @janmarqz Didn't even bother to take a look at the graphics entry having read its brief synopsis. They're indeed using clamping for the implementation of that operation. Good catch. – jxramos Jun 23 '15 at 19:40
  • @Chappers good terminology there, in situ definition, I didn't realize that concept was formalized. I like it. – jxramos Jun 24 '15 at 02:17

2 Answers2

6

There's no such thing as a "formally recognized" mathematical function. Some are more well known and widely used, but there is no standard defining what is a recognized function. Yes, $\mathop{\rm clamp}(x)$ is a mathematical function.

qaphla
  • 3,890
  • I was just beginning to question that terminology I used, what's the appropriate term for things we assign names to such as sinc, sine, cosine, unit step, tangent, etc. Elementary functions? – jxramos Jun 23 '15 at 18:48
  • 1
    From Wikipedia "In mathematics, an elementary function is a function of one variable built from a finite number of exponentials, logarithms, constants, and nth roots through composition and combinations using the four elementary operations (+ – × ÷)." – JacksonFitzsimmons Jun 23 '15 at 18:50
  • 3
    Looks like $clamp(x)$ is a projection onto an interval, which is used a lot in optimization (tho I have never heard it called "clamp"). Regardless, it is best to define it when you introduce it. I have used this function a lot but I called it $[x]{a}^{b}$. If you minimize a convex function $f(x)$ of one variable $x$ over all $x \in \mathbb{R}$, and the minimum is $x^* \in \mathbb{R}$, then the min value of $f(x)$ over the restricted interval $[a,b]$ is $[x^*]_a^b=clamp{ab}(x^*)$. Here I am taking the liberty to put subscripts on your function to specify the interval. – Michael Jun 23 '15 at 19:19
  • 1
    For example, given constants $C> 0$ and $D$, the minimum of $Cx^2+Dx$ over $x \in \mathbb{R}$ is at $x^* = -D/(2C)$, and the min over $x \in [a,b]$ is $[-D/(2C)]_a^b$. – Michael Jun 23 '15 at 19:26
3

I remember using it in measure theory to show that a function $f : [a,b] \to \mathbb R$ was almost everywhere differentiable. The idea was that the clamp function was used to extend the identity $[a,b] \to [a,b]$ to the whole of $\mathbb R$, and then we could compose the clamp with $f$ to extend $f$ to the reals. This was just the first step of the proof, the clamp function had nothing to do with the rest. But I don't remember giving a name to that function ; I guess it just doesn't have enough importance in theoretical applications. It sounds more like a programmer's function.

Hope that helps,