Consider the ODE
y'(t) = A\cdot y(t) +B
.
Determine {\color{red}a}
and {\color{blue}b},
such that the function y
with
y(t) = C \cdot e^{{\color{red}a} \cdot t} + {\color{blue}b}
satisfies this ODE with y(0) = Y0
.
\color{red}a
=
(A*Y0+B)/C
\color{blue}b
=
Y0-C
With y(0) = Y0
, it follows that
y(0) = C \cdot 1 + {\color{blue}b} = Y0
and {\color{blue}b} = Y0 - C
.
To find {\color{red}a}
, we differentiate
y(t) = C \cdot e^{{\color{red}a} \cdot t} + {\color{blue}b}
and substitute y'(t)
and y(t)
into the ODE.
Then substitute the above {\color{blue}b}
into {\color{red}a} \cdot C \cdot e^{{\color{red}a} \cdot t}
= A \cdot C \cdot e^{{\color{red}a} \cdot t} +
\left( A {\color{blue}b}+ B\right)
and set t = 0
.
This gives {\color{red}a} \cdot C
= A \cdot C+\left( A {\color{blue}b}+ B\right)
= A*C + A*Y0 - A*C +B
, and eventually
{\color{red}a} = \dfrac{A*C + A*Y0 - A*C+B}{C} =
fractionReduce(A*Y0+B,C)
.