Joining two graphs Suppose I have $f_1(x)=x$
And i restrict its domain as $\color{blue}{(-\infty,0]}$ using $g_1(x)=\dfrac{x}{\frac{1}{2\left(x-0\right)}\left(x-0-\left|x-0\right|\right)}$
Resulting in :

Now, suppose i have $f_2(x)=\sin{(x)}$
And i restrict its domain to $\color{blue}{(0,\infty)}$ using $g_2(x)=\dfrac{\sin x}{\frac{1}{2\left(0-x\right)}\left(0-x-\left|0-x\right|\right)}$
Resulting in :



Now I want a new equation which can join $g_1(x)$ and $g_2(x)$ in one single equation. How should i achieve it?

I mean $\large g_{\text{joined 1+2}}(x)$ would look like :

Also i want a single equation which is NOT of the form of $\color{red}{
    f(x)= 
\begin{cases}
    x& \text{if } x\leq 0\\
    \sin{(x)}& \text{if }  x> 0
\end{cases}}$

My attempt :
I tried using $(y-g_1(x))(y-g_2(x))=0$ but they don't seem to work...
They seem to be working with $y=x,x \in (-\infty,0]$ and $y=2x, x \in (-\infty,0]$ as :



So how to proceed?
Please help. Thanks!

 A: How about this?
$$y=\frac{x-|x|}{2}+\sin\left(\frac{x+|x|}{2}\right)$$
A: When I was your age, I discovered a way to do this, although it's a bit artificial. Suppose that you want a function, that has an unrestricted domain, which takes on the values of a function $f(x)$ when $x<a$ and $g(x)$ when $x>a$. Then $h(x)$, the function we are looking for, can be given by 
$$h(x)=f\left(\frac{|x-a|-(x-a)}{2}\right)+g\left(\frac{|x-a|+(x-a)}{2}\right)-f(0)\left(\frac{|x-a|+(x-a)}{2}\right)-g(0)\left(\frac{|x-a|-(x-a)}{2}\right)$$
Suppose we wish to define a function which takes on the values of $f(x)$ for $x\in(a,b)$ and $g(x)$ for $x \in (c,d)$. Then we define $h(x)$, the function we are looking for, to be
$$h(x)=f\left(\left[\frac{|x-a|}{x-a}-\frac{|x-b|}{x-b}\right]\frac{x}{2}\right)+g\left(\left[\frac{|x-c|}{x-c}-\frac{|x-d|}{x-d}\right]\frac{x}{2}\right)-f(0)\left(\frac{|x+b|+(x+b)+|x-a|-(x-a)}{2}\right)-g(0)\left(\frac{|x-d|+(x-d)+|x-c|-(x-c)}{2}\right)$$
I used to think of these constructions to be made by 'switches'. There is a better way to do this if my memory serves me right but this is all I can remember right now. I'll be sure to edit if I remember how I did it before. Nice question! 
A: I found shorter ways of generalizing this. I am as old as you are so I am glad to know someone has a similar kind of interest as I do. I notice that when $f(0)\neq{0}$ and $g(0)\neq{0}$ my method could be quicker.
Basically you can take two functions and "fuse" them by the floor function with exponents (as long as the function does not have a restricted domain ex.$\sqrt{x}$). I found that using this I can bring $f(x)\in(-\infty,a)$ and $g(x)\in[a,\infty)$ to a single equation. 
 $${{f(x)}^{\frac{-\text{sgn}{\lceil(x-a-1)+.5}\rceil+1}{2}}} {g(x)}^{\frac{{\text{sgn}\lceil(x-a-1)+.5}\rceil+1}{2}}$$
To switch which domain of the function $x=a$ is included in, replace the "ceil" function with the "floor" on your computer. Also you may need to use "sign" instead of "sgn" for the signum function.
Unfortunately this fusion works best when were fusing functions that have no undefined intervals. With $f(x)\in(a,b)$ and $g(x)\in(c,d)$, where $a<c$ and $b<c$ if there is a gap between $b$ and $c$ one must use manipulations to get...
$$\left({{\left(\left(f(x)\right)^{-1}+1\right)}^{\frac{\text{sgn}{\lceil(x-a-1)+.5}\rceil-\text{sgn}\lceil(x-b-1)+.5\rceil}{2}}}{{\left(\left(g(x)\right)^{-1}+1\right)}^{\frac{\text{sgn}{\lceil(x-c-1)}+.5\rceil-\text{sgn}\lceil(x-d-1)+.5\rceil}{2}}}-1\right)^{-1}$$  
However this equation has an undefined region making it less artificial.
Now you can easily use this approach for more than one function. Here are the "switches" of my method as the exponents of functions.
$c_n(x)$ includes $f(x)$ and $g(x)$.
$\left(\left(\prod_{n=0}^{k}{\left({\left({c_n}(x)\right)}^{-1}+1\right)}^{{d_n}(x)}\right)-1\right)^{-1}\quad$ Union of all defined intervals ("undefining" unwanted intervals). 
$d_0(x)=\frac{-\text{sgn}\lceil(x-a-1)+.5\rceil+1}{2}$ $(-\infty,a)$
$d_1(x)=\frac{\text{sgn}\lceil(x-a-1)+.5\rceil+1}{2}$ $(a,\infty)$
$d_2(x)=\frac{\text{sgn}\lceil(x-a-1)+.5\rceil-\text{sgn}\lceil(x-b-1)+.5\rceil}{2}$ $(a,b)$
