$ \newcommand{\R}{\mathbb{R}} \newcommand{\complex}{\mathbb{C}} \newcommand{\abs}[1]{\left|#1\right|} \newcommand{\norm}[1]{\left\|#1\right\|} \newcommand{\maxmod}[1]{\norm{#1}_\infty} $

The radial projection, $\rho$, on a normed space $X$ is the (nonlinear) mapping given by $$ \rho(x) = \begin{cases} x/\left\|x\right\| & \text{for $\left\|x\right\| \geq 1$} \\ x & \text{otherwise.} \end{cases} $$ The Lipschitz constant for this mapping, the minimal $k$ such that $$ \left\| \rho(x) - \rho(y) \right| \leq k \left\| x-y \right\| \qquad (x,\,y\in X), $$ is a quantity of interest in the geometry of normed and Banach spaces. Franchetti has shown that the Lipschitz constant when $X$ is the finite-dimensional space $\ell^2_p(\R)$ or the function space $L^p[0,1]$ is given by the maximum of a particular one-dimensional $p$-dependent function. Well-known isometries $$ \ell^2_p(\R) \subseteq \ell^3_p(\R) \subseteq \cdots \subseteq \ell_p(\R) \subseteq L^p[0,1] $$ then imply that the same is true for the finite-dimensional spaces $\ell^n_p(\R)$ ($n=2,3,\ldots$) and for the sequence space $\ell_p(\R)$. The latter has an application in the efficient calculation of the $(p,q)$-operator norms of matrices, i.e., the norm of a matrix considered as an operator $\ell_p\rightarrow\ell_q$. See, for example, the opnorm package.

Below we provide some code to efficiently evaluate this Lipschitz constant.

Plot of Lipschitz constant for the radial projection on lp
Plot of $k(\ell_p)$ for $1 \leq p \leq 5$