Does there exist an analytic everywhere, piecewise-defined function $f$ such that:
$f(x) = g(x)$ for $x < k$
$f(x) = h(x)$ for $x>k$
$f(x) = r$ for $x=k$
With $g \ne h $ ($g$ not the same function as $h$)
If it exists, what is such an example?
Does there exist an analytic everywhere, piecewise-defined function $f$ such that:
$f(x) = g(x)$ for $x < k$
$f(x) = h(x)$ for $x>k$
$f(x) = r$ for $x=k$
With $g \ne h $ ($g$ not the same function as $h$)
If it exists, what is such an example?
If $g$ and $h$ are not necessarily analytic, then just take an arbitrary analytic function $f$ with $f(k) = r$. Define $g$ and $h$ to be
$ g(x) := f(x) \chi(k-x) \qquad h(x) := f(x) \chi(x-k) $
where $\chi$ is a cut-off function, that is: $\chi(x) = 1$ for $x \geq 0$, $\chi(x) = 0$ for $x \leq -1$ and $0 < \chi(x) < 1$ for $-1 < x < 0$. Then you have all your desired properties. You can choose $\chi$ to be continuous, or even smooth.
If $g$ and $h$ are analytic, then the answer is no. Real analytic functions have the unique continuation property. That is, if a real analytic function is zero on an open set, it must be zero everywhere. Then since $f$ is everywhere analytic, and $g$ is everywhere analytic, their difference $f-g$ is also analytic, and vanishes for $x < k$. This implies that $f=g$ everywhere. Similarly $f =h$ everywhere and $g$ and $h$ must coincide.
Such a function will be trivially impossible unless you relax the requirement that an analytic function be equal to its taylor series in a neighborhood of any point. Once that restriction is relaxed, the following is an example of a piecewise function with all derivatives continuous:
$f(0) = 0$
$f(x) = g(x) = e^{(\tfrac{-1}{x^2})}$ for $x < 0$
$f(x) = 2*g(x)$ for $x > 0$
All derivatives are continuous, passing through (0, 0). You can create other examples using the strange function $e^{(\tfrac{-1}{x^2})}$