de-CH
utf-8
math math-format
Solving ODE
dgl-01-04
multiple
1300
randRange(2,12) randRange(-12,-2) randRange(0,12)

Consider the ODE y'(t) = A\cdot y(t) +B.

Determine {\color{red}a}, {\color{blue}b} and {\color{teal}C}, such that the function y with y(t) = {\color{teal}C} \cdot e^{{\color{red}a} \cdot t} + {\color{blue}b} satisfies this ODE with y(0) = Y0.

a \color{red}a = A
b \color{blue}b = -B/A
C \color{teal}C = Y0+B/A

Substitute the function y(t) = C \cdot e^{{\color{red}a} \cdot t} + {\color{blue}b} into the ODE y'(t) = A\cdot y(t) +B.

Then, y'(t) = \left(C \cdot e^{{\color{red}a} \cdot t} + {\color{blue}b}\right)' = {\color{red}a} \cdot C \cdot e^{{\color{red}a} \cdot t}.

Thus, {\color{red}a} \cdot C \cdot e^{{\color{red}a} \cdot t} = A\cdot \left(C \cdot e^{{\color{red}a} \cdot t} + {\color{blue}b} \right) +B = A \cdot C \cdot e^{{\color{red}a} \cdot t} +\left( A {\color{blue}b}+ B \right) .

Since the equation must hold for all real numbers C, it must also be valid for C = 0.

Solve A {\color{blue}b}+ B=0 for {\color{blue}b}.

This gives {\color{blue}b} = fractionReduce(-B,A).

We now use this {\color{blue}b} in {\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 results in {\color{red}a} \cdot C \cdot 1 = A \cdot C \cdot 1+\left( A {\color{blue}b}+ B \right) = A \cdot C +0, and eventually {\color{red}a} = A.

To find {\color{teal}C}, use the condition y(0) = Y0.

y(0) = Y0 = {\color{teal}C} \cdot e^{{\color{red}A} \cdot 0} + {\color{blue}fractionReduce(-B,A)} , which leads to {\color{teal}C} = Y0 - {\color{blue}fractionReduce(-B,A)} = fractionReduce(Y0*A+B, A).