<s>[INST] analytical solution for linear 1st order PDE using laplace and seperation of variables I am looking for the solution of the following pde:
$\frac{\partial y(x,t)}{\partial t} = a* \frac{\partial y(z,t)}{\partial x} + b* y(x,t) + c$
and need help with the boundary and initial conditions:
$y(x=0,t)=0  $ bzw $y(x=0,t)=const.  $    and  $y(x,t=0)=f(x)$
a, b are negative constants and c is a positive constant.
I used Laplace Transform to derive a solution as follows:
$L^{-1}(\frac{\partial y(x,t)}{\partial t}) = L^{-1}(a \frac{\partial y(z,t)}{\partial x} + b y(x,t) + c) $
$s*Y(x,s) - y(x,0)=a* \frac{\partial Y(z,s)}{\partial x} +b* Y(x,s) + \frac{c}{s} $
$ \frac{\partial Y(z,s)}{\partial x} + \frac{b-s}{a} * Y(x,s)= -\frac{1}{a} * (y(x,0)+\frac{c}{s})$
which results in
$\int d(exp(\frac{b-s}{a}*x)*Y(x,s)) =\int -\frac{1}{a} * (y(x,0)+\frac{c}{s}) dx$
with $F(x) = \int f(x) dx= \int y(x,0)dx$ and $y(x=0,s)=0$ this results in
$Y(x,s)=- \frac{1}{a}*exp(\frac{s-b}{a}*x)*(F(x)-F(0)+\frac{c}{s}*x)$
Transforming this result back into time domain gives
$y(x,t) = -\frac{1}{a}*exp(\frac{-b}{a}*x)*((F(x)-F(0))* \delta (t+\frac{x}{a}) +c*x* H(t+\frac{x}{a})) $
with $\delta$ beeing the dirac delta function and $H$ beeing the heaviside step function.
This analytical equation cannot reproduce my numeric solution, in my opinion because the initial conditions are only multiplied with a dirac impulse, so is the transformation correct?
I also looked at the solution seperating the variables as shown in Analytical Solution of a PDE 
$y(x,t)=C*exp(kt) * exp (\frac{k-b}{a}*x) - \frac{c}{b} $, however when I use the boundary condition, this results in a time independend solution, since the only way for the solution to be $0$ at $x=0$ is  $y(x,t)=\frac{c}{b}*(exp(\frac{k-b}{a}*x)-1)$
Am I overseeing something?
Thanks for your help
 [/INST] The solution is
$$ y(x,t) = \left( e^{-\frac{b}{a}x}y_l + e^{-\frac{b}{a}x}\frac{c}{b}\left( 1 - e^{b(t+\frac{x}{a})} \right)\right)\sigma\left(t + \frac{x}{a}\right) - \frac{c}{b}\left(1-e^{bt}\right) - \mathcal{L}^{-1}\{ F(x,s) \}, $$
where 
$$F(x,s) = \frac{1}{as}e^{\frac{s-b}{a}x} \int\limits_0^x e^{\frac{b-s}{a}\xi}f(\xi) \text{d}\xi, $$
with $y_l := y(0,t)$ and $f(x) := y(x,0)$ the boundary and initial condition, respectively.
To verify this for $f(x)\equiv 0$ note that $y(x,t)$ satisfies the boundary condition
$$y(0,t) = \left( y_l + \frac{c}{b}\left( 1 - e^{bt} \right) \right) \sigma(t) - \frac{c}{b}\left( 1 - e^{bt} \right) \sigma(t) = y_l \sigma(t),$$
and the initial condition
$$ y(x,0) = \left( e^{-\frac{b}{a}x}y_l + e^{-\frac{b}{a}x}\frac{c}{b}\left( 1-e^{\frac{b}{a}x} \right) \right)\sigma\left(\frac{x}{a}\right) - \frac{c}{b}\left( 1 - e^{b\cdot 0}\right) = 0 \equiv f(x).$$
Since $\frac{x}{a} < 0$, we have $\sigma\left(\frac{x}{a}\right) = 0$.
To show that $y(x,t)$ satisfies the pde, we derive over $t$ and $x$
$$ 
\begin{align}
y_t(x,t) = & \left( e^{-\frac{b}{a}x}y_l + e^{-\frac{b}{a}x}\frac{c}{b}\left( 1 - e^{b\left( t + \frac{x}{a} \right)} \right) \right) \delta\left( t + \frac{x}{a} \right) \\
& - e^{-\frac{b}{a}x} \frac{c}{b} e^{b+\left( t + \frac{x}{a} \right)}b \sigma\left( t + \frac{x}{a} + ce^{bt} \right), \\
y_x(x,t) = & \left( -\frac{b}{a}e^{-\frac{b}{a}x}y_l + \frac{c}{b}\left( -\frac{b}{a}e^{-\frac{b}{a}x} \left( 1 - e^{b\left( t + \frac{x}{a} \right)} \right)  + e^{-\frac{b}{a}x} \left( -e^{b\left( t + \frac{x}{a} \right)} \right) \right) \right) \sigma\left( t + \frac{x}{a} \right) \\
& + \left( e^{-\frac{b}{a}x} y_l + e^{-\frac{b}{a}x}\frac{c}{b} \left( 1 - e^{b\left( t + \frac{x}{a} \right)}  \right) \right) \delta\left( t + \frac{x}{a} \right) \frac{1}{a},
\end{align} $$
such that $y_t - ay_x - by - c = 0$ for $t < \left|\frac{x}{a}\right|$, $t > \left|\frac{x}{a}\right|$ and $t = \left|\frac{x}{a}\right|$.
How to get there:
The Laplace transform of the pde yields
$$ sY(x,s) - Y(x,0) = aY_x(x,s) + bY(x,s) + \frac{c}{s}, $$
or, equivalently,
$$ Y_x(x,s) = Y(x,s) \frac{s-b}{a} - \frac{1}{a} \left( Y(x,0) + \frac{c}{s} \right) $$
The general solution to this linear, inhomogeneous 1$^\text{st}$-order ode in $x$ is
$$ Y(x,s) = e^{\frac{s-b}{a}x}Y(0,s) - \frac{1}{a}\int\limits_0^x e^{\frac{s-b}{a}(x-\xi)}\left( Y(\xi,0) + \frac{c}{s} \right) \text{d}\xi. $$
With $Y(0,s) = \mathcal{L}\{ y(0,t) \} = \frac{y_l}{s}$ and $Y(x,0) = \mathcal{L}\{ y(x,0) \} = \frac{f(x)}{s}$, we arrive at the solution $Y(x,s)$ in the frequency domain:
$$ Y(x,s) = e^{s\frac{x}{a}} \left( \frac{1}{s}e^{-\frac{b}{a}x}y_l - \frac{c}{s(s-b)}e^{-\frac{b}{a}x} \right) + \frac{c}{s(s-b)} - F(x,s), $$
which can then be back-transformed by using the following correspondences:
$$ \frac{a}{s(s+a)} = \mathcal{L}\{(1-e^{-at})\} $$
$$ e^{-as}F(s) = \mathcal{L}\{ f(t-a) \}$$
$$ \frac{1}{s} = \mathcal{L}\{ \sigma(t) \} $$
$$ 1 = \mathcal{L}\{ \delta(t) \}. $$
</s>