-1

Let $f$ and $g$ be two real smooth functions defined over $\mathbb{R}$. Suppose that at a point $x_0$ we have that $f(x_0)=g(x_0)=y_0$ and also $f'(x_0)=g'(x_0)=m$, i.e. they meet "smoothly".

My question is: is there a way to make up a third function $h$ such that $h(x_0)=y_0$, $f'(x_0)=m$, $h$ resembles (in some suitable sense) $f$ for $x\in(-\infty,x_0]$ and resembles (in the same suitable sense) $g$ for $x\in[x_0,\infty)$?

As an example, consider $f(x)=1-e^x$ and $g(x)=\ln(1-x)$, with $x_0=0$.

EDIT: In this case I'd like to end up with a function that looks like $f$ on the left of the origin and that looks like $g$ on the right: this function "forgets" about $g$ going towards $-\infty$, keeping only information about $f$, and the other way around going towards $+\infty$.

EDIT 2: I am not looking for a piecewise defined function, rather a "one piece" function

marco trevi
  • 3,342
  • 1
    Why not just define $h:\mathbb{R}\to\mathbb{R}$ such that $h(x) = f(x)$ when $x< x_0$, and $h(x)=g(x)$ if $x\geq x_0$? Is that the sort of thing you want? – florence May 20 '17 at 15:29
  • This sounds exactly what OP is looking for, formally called a piecewise function. – B. Mehta May 20 '17 at 15:31
  • Yes, the output is the same but I'd like to have a kind of "closed form" for $h$, not a function defined by two cases... – marco trevi May 20 '17 at 15:31
  • I'll edit the question for clarity. – marco trevi May 20 '17 at 15:31
  • $f(x)\cdot\frac{1}{2}(1-\text{sign}(x-x_0))+g(x)\cdot \frac{1}{2}(\text{sign}(x-x_0)+1)+f(x_0)\cdot (1-|\text{sign}(x-x_0)|)$ – kccu May 20 '17 at 15:36
  • eh eh I see what you did there! :) but sign is a piecewise function – marco trevi May 20 '17 at 15:37
  • This thread may help (with weaker hypotheses...). – Raymond Manzoni May 20 '17 at 15:41
  • $\left(-\frac{1}{\pi}\arctan(x-x_0)+\frac{1}{2}\right)f(x)+\left(\frac{1}{\pi}\arctan(x-x_0)+\frac{1}{2}\right)g(x)$. The term $\left(-\frac{1}{\pi}\arctan(x-x_0)+\frac{1}{2}\right)$ gradually decreases from $1$ to the left of $x_0$ to $0$ to the right of $x_0$, and the term $\left(\frac{1}{\pi}\arctan(x-x_0)+\frac{1}{2}\right)$ likewise increases from $0$ to $1$. Check out this graph: https://www.desmos.com/calculator/ixszwmy2zv – kccu May 20 '17 at 15:41
  • "I am not looking for a piecewise defined function, rather a "one piece" function" - this is not a very useful criterion. $$\log(1-x)+\frac{\sqrt{x^2}+x}{2 x}(1-e^x-\log (1-x))$$ is an unwieldy (and equivalent way) of writing the piecewise version $$\begin{cases}\log(1-x) & x\ge 0\1-e^x & x<0\end{cases}$$ – J. M. ain't a mathematician May 20 '17 at 15:41
  • 1
    The notion of "piecewise defined" is quite arbitrary; there is no formal way to define it at the level of a function rather than a function definition. – Ian May 20 '17 at 15:42
  • Whoops, that got flipped; the piecewise function should have been $$\begin{cases}1-e^x&x\ge 0\\log(1-x)&x<0\end{cases}$$ – J. M. ain't a mathematician May 20 '17 at 15:55

1 Answers1

0

You can cheat if you allow absolute value $|x|$. Using it we define the function $$h_a(x) := \frac{1}{2} \left(\frac{|x-a|}{x-a} + 1 \right)$$

This function equals $0$ for $x < a$ and $1$ for $x > a$. It is however not defined at $x = a$.

Then you could say that given your two functions $f,g$ and the point where you want to merge them $a$, the "equivalent function" could be $$ h_a(x) f(x) + (1-h_a(x)) g(x) $$ This however won't solve the discontinuity at $x=a$ even though it is a removable discontinuity.

Zubzub
  • 4,143
  • 1
  • 17
  • 25