Smoothing a map $f:X\to \mathbb{R}$ while fixing it over a closed $C\subset X$ $\newcommand{\R}{\mathbb{R}}$I have a  map $f\in C^0(X,\mathbb{R})$, where $X$ is a compact and Hausdorff topological space, which is a manifold outside of a compact subset $K\subset X$.
I would like to modify $f$, to obtain $\tilde f\in C^0(X,\mathbb{R})$ such that

*

*$\tilde f\rvert_K = f\rvert_K$ and

*$\tilde f\rvert_{X\setminus K} \in C_b^k(X\setminus K,\mathbb{R})$ where $C_b^k$ denotes bounded functions continuously differentiable $k$-times (also the derivatives are bounded so to make this a Banach space).


Is this possible or are the hypothesis on $X$ too weak?

EDIT: as shown by Jochen Wengenroth the answer is negative, however as shown in Joseph Van Name's answer the answer is positive if we drop the requirement that the derivatives are bounded (i.e. instead of requiring $\tilde f\rvert_{X\setminus K} \in C_b^k(X\setminus K,\mathbb{R})$ we ask for $\tilde f\rvert_{X\setminus K} \in C^k(X\setminus K,\mathbb{R})$). I accepted Joseph's answer without noticing this subtlety (beforee Jochen posting his answer) but, a posteriori, I regard both answers as relevant and on point as they  give a complete picture.
 A: I claim that it is always possible (as long as one does not require the derivatives of $\tilde{f}_{X\setminus K}$ to be bounded). This is actually an easy consequence of the approximation theorem of manifolds.
To state the approximation theorem of manifolds, suppose that
$0\leq s<\infty$, and $M,N$ are manifolds. Let $C^{s}(M,N)$ be the collection of $C^{s}$ mappings from $M$ to $N$. Then we shall let $C^{s}_{S}(M,N)$ denote the topological space with underlying set $C^{s}(M,N)$ and where the basic open sets are the sets of the following form.
Suppose that $\iota_{n}:U_{n}\rightarrow M$ is a chart for each $n\geq 0$. Suppose that $(\iota_{n}[U_{n}])_{n\geq 0}$ is locally finite. Suppose furthermore that $C_{n}$ is a compact subset of $\iota_{n}[U_{n}]$ and $\epsilon_{n}>0$ for all natural numbers $n$. Let $f\in C^{s}(M,N)$. Suppose now that $j_{n}:V_{n}\rightarrow N$ is a chart for each $n\geq 0$ and that $f[C_{n}]\subseteq j_{n}[V_{n}]$.  Let $O$ be the collection of all functions $g\in C^{s}(M,N)$ such that
$g[C_{n}]\subseteq j_{n}[V_{n}]$ and where if $\alpha$ is a multi-index with $|\alpha|\leq s$, then
$$|D^{\alpha}(j_{n}^{-1}f\iota_{n})(x)-D^{\alpha}(j_{n}^{-1}f\iota_{n})(x)|<\epsilon_{i}$$ for each $x\in \iota_{n}^{-1}[C_{n}]$. Then $O$ is a basic open set, and all basic open sets are of this form.
Theorem (approximation theorem): Let $M,N$ be $C^{q}$ manifolds where $1\leq q\leq\infty$. Suppose that $0\leq p<q$. Then the set $C^{q}(M,N)$ is dense in the space $C_{S}^{p}(M,N)$.
A good textbook reference for the above result is the text Differential Topology by Morris Hirsch.
Suppose now that $X$ is a compact space, $K$ is a compact subset of $X$, and $X\setminus K$ is a $C^{\infty}$-manifold.
Then there exists a continuous function $h:X\rightarrow[0,1]$ where
$K=h^{-1}[\{0\}]$.
Let $O$ be the collection of all continuous functions $g:X\setminus K\rightarrow\mathbb{R}$ with $|(g-f)(x)|<h(x)$ for all $x\in X$. Then $O$ is open in $C_{S}^{0}(X\setminus K,\mathbb{R})$, so by the approximation theorem, there exists a $C^{\infty}$-mapping
$g:X\setminus K\rightarrow\mathbb{R}$ with $g\in O$, and in this case, $|(g-f)(x)|<h(x)$ for each $x\in X$.
Observe that if $k\in\partial K$, then $\lim_{x\in X\setminus K,x\rightarrow k}(g-f)(x)=0$, so $\lim_{x\in X\setminus K,x\rightarrow k}f(x)=\lim_{x\in X\setminus K,x\rightarrow k}g(x)$. Therefore, if we set $\overline{g}=g\cup f|_{K}$, then $\overline{g}$ is a continuous function that extends $g$.
Pierre PC observed that we do not need the full strength of the approximation theorem and that the weaker result that is easier to state and prove will suffice:
Proposition: Whenever $M$ is a $C^{k}-$manifold for $1\leq k\leq\infty$, $f:M\rightarrow\mathbb{R}$ is continuous, and $h:M\rightarrow(0,\infty)$ is a continuous function, there exists some $C^{k}$-function $g:M\rightarrow\mathbb{R}$ with $|f-g|<h$.
To prove the above proposition, first observe that if $U\subseteq\mathbb{R}^{n}$, $U$ is open, and $f:U\rightarrow\mathbb{R}$ is continuous, then for all $\delta>0$, there is a $C^{\infty}$-function $g_{\delta}:\mathbb{R}^{n}\rightarrow[0,\infty]$ where $g_{\delta}(x)=0$ whenever $\|x\|>\delta$ and where $\int_{\mathbb{R}^{n}}g_{\delta}(\mathbf{x})d\mathbf{x}=1$. In this case, each $f*g_{\delta}$ is $C^{\infty}$ on $\{\mathbf{x}\mid B_{\delta}(\mathbf{x})\subseteq U\}$ and $f*g_{\delta}\rightarrow f$ uniformly on compact sets. One can extend this approximation result to obtain a proof of our proposition using a $C^{k}$-partition of unity.
A: You are in fact asking about an extension problem. If you only want to have differentiability on $X\setminus K$ this can be done as in Joseph van Name's answer or, as suggested by Pierre PC, with a partition of unity. However, you cannot have bounded derivatives of the extension on $X\setminus K$ (which your notation $C_b^k(X\setminus K,\mathbb R)$ suggests). Here is a rather classical example:
Set $\varphi:[0,1]\to \mathbb R$, $x\mapsto \exp(-1/x)$ and $\varphi(0)=0$ and let $K\subseteq \mathbb R^2$ be the cusp $K=\big([0,1]\times \{0\}\big) \cup \{(x,\varphi(x)):x\in [0,1]\}$. The function $f_0:K\to\mathbb R$ defined by $f_0(x,0)=0$ and $f(x,\varphi(x))=\sqrt{\varphi(x)}$ is continuous (because of the continuity of $\varphi$ and $\varphi(0)=0$) and has thus a continuous extension $f:\mathbb R^2\to \mathbb R$ by Tietze's extension theorem (if you consider instead $\varphi(x)=x^2$ you can write down an extension explicitely which, however, is neither necessary nor enlightening for the argument). On the other hand, there is no continuous extension $\tilde f$ with bounded partial derivatives because this would contradict the mean value theorem for $\tilde f$ on the vertical segments $\{(x,y): 0\le y\le \varphi(x)\}$.
