```python
import loader
from sympy import *
init_printing()
from root.solver import *
```

Find the complementary and particular solution of the system of ode
$$
    \vec{\mathbf{x'}} = \begin{bmatrix}
        -2 & 1 \\
        1 & -2 \\
    \end{bmatrix} \vec{\mathbf{x}} + \begin{bmatrix}
        2 e^{-t} \\
        3 t
    \end{bmatrix}
$$
using variation of parameters


```python
xc, p = system([
    [-2, 1],
    [1, -2]
])
p.display()
_, p = nonhomo_system_variation_of_parameters(xc, [2 * exp(-t), 3*t])
p.display()
```


$\displaystyle \text{Characteristic equation: }$



$\displaystyle \left(\lambda + 2\right)^{2} - 1 = 0$



$\displaystyle \text{Eigenvalues and eigenvectors}$



$\displaystyle \lambda_1 = -3$



$\displaystyle \left[\begin{matrix}1 & 1 & 0\\1 & 1 & 0\end{matrix}\right]\text{ ~ }\left[\begin{matrix}1 & 1 & 0\\0 & 0 & 0\end{matrix}\right]\Rightarrow v = \left[\begin{matrix}-1\\1\end{matrix}\right]$



$\displaystyle \lambda_2 = -1$



$\displaystyle \left[\begin{matrix}-1 & 1 & 0\\1 & -1 & 0\end{matrix}\right]\text{ ~ }\left[\begin{matrix}1 & -1 & 0\\0 & 0 & 0\end{matrix}\right]\Rightarrow v = \left[\begin{matrix}1\\1\end{matrix}\right]$



$\displaystyle \text{General solution: }$



$\displaystyle \vec{\mathbf{x}} = C_{1}e^{- 3 t}\left[\begin{matrix}-1\\1\end{matrix}\right]+C_{2}e^{- t}\left[\begin{matrix}1\\1\end{matrix}\right]$



$\displaystyle \text{Fundamental matrix }\Psi$



$\displaystyle \left[\begin{matrix}- e^{- 3 t} & e^{- t}\\e^{- 3 t} & e^{- t}\end{matrix}\right]$



$\displaystyle \text{Calculate the inverse of the fundamental matrix }\Psi^{-1}$



$\displaystyle \Psi^{-1} = \left[\begin{matrix}- \frac{e^{3 t}}{2} & \frac{e^{3 t}}{2}\\\frac{e^{t}}{2} & \frac{e^{t}}{2}\end{matrix}\right]$



$\displaystyle \text{Compute }\Psi^{-1} g(t)$



$\displaystyle \Psi^{-1} g(t) = \left[\begin{matrix}\frac{3 t e^{3 t}}{2} - e^{2 t}\\\frac{3 t e^{t}}{2} + 1\end{matrix}\right]$



$\displaystyle \text{Compute the integral}$



$\displaystyle \int \Psi^{-1} g(t) =\left[\begin{matrix}\frac{t e^{3 t}}{2} - \frac{e^{3 t}}{6} - \frac{e^{2 t}}{2}\\\frac{3 t e^{t}}{2} + t - \frac{3 e^{t}}{2}\end{matrix}\right]$



$\displaystyle \text{Finally, }\vec{\mathbf{x_p}} = \Psi \int \Psi^{-1} g(t)$



$\displaystyle \vec{\mathbf{x_p}} =\left[\begin{matrix}t + t e^{- t} - \frac{4}{3} + \frac{e^{- t}}{2}\\2 t + t e^{- t} - \frac{5}{3} - \frac{e^{- t}}{2}\end{matrix}\right]$


Find a particular solution of the system
$$
    \vec{\mathbf{x'}} = \begin{bmatrix}
        10 & -5 \\
        20 & -10 \\
    \end{bmatrix} \vec{\mathbf{x}} + \begin{bmatrix}
        t^{-3} \\
        -t^{-2}
    \end{bmatrix}
$$
using variation of parameters


```python
xc, p = system([
    [10, -5],
    [20, -10]
])
p.display()
_, p = nonhomo_system_variation_of_parameters(xc, [t**(-3),-t**(-2)])
p.display()
```


$\displaystyle \text{Characteristic equation: }$



$\displaystyle \lambda^{2} = 0$



$\displaystyle \text{Eigenvalues and eigenvectors}$



$\displaystyle \lambda_1 = 0$



$\displaystyle \left[\begin{matrix}10 & -5 & 0\\20 & -10 & 0\end{matrix}\right]\text{ ~ }\left[\begin{matrix}1 & - \frac{1}{2} & 0\\0 & 0 & 0\end{matrix}\right]\Rightarrow v = \left[\begin{matrix}\frac{1}{2}\\1\end{matrix}\right]$



$\displaystyle \text{Find the generalized eigenvector}\left( M - \lambda I \right) w = v $



$\displaystyle \left[\begin{matrix}10 & -5 & \frac{1}{2}\\20 & -10 & 1\end{matrix}\right]\text{ ~ }\left[\begin{matrix}1 & - \frac{1}{2} & \frac{1}{20}\\0 & 0 & 0\end{matrix}\right]\Rightarrow w = \left[\begin{matrix}\frac{1}{20}\\0\end{matrix}\right]$



$\displaystyle \text{General solution: }$



$\displaystyle \vec{\mathbf{x}} = C_{1}1\left[\begin{matrix}\frac{1}{2}\\1\end{matrix}\right]+C_{2}1\left(\left[\begin{matrix}\frac{1}{2}\\1\end{matrix}\right]t + \left[\begin{matrix}\frac{1}{20}\\0\end{matrix}\right]\right)$



$\displaystyle \text{Fundamental matrix }\Psi$



$\displaystyle \left[\begin{matrix}\frac{1}{2} & \frac{t}{2} + \frac{1}{20}\\1 & t\end{matrix}\right]$



$\displaystyle \text{Calculate the inverse of the fundamental matrix }\Psi^{-1}$



$\displaystyle \Psi^{-1} = \left[\begin{matrix}- 20 t & 10 t + 1\\20 & -10\end{matrix}\right]$



$\displaystyle \text{Compute }\Psi^{-1} g(t)$



$\displaystyle \Psi^{-1} g(t) = \left[\begin{matrix}- \frac{10}{t} - \frac{21}{t^{2}}\\\frac{10}{t^{2}} + \frac{20}{t^{3}}\end{matrix}\right]$



$\displaystyle \text{Compute the integral}$



$\displaystyle \int \Psi^{-1} g(t) =\left[\begin{matrix}- 10 \ln{\left(t \right)} + \frac{21}{t}\\- \frac{10}{t} - \frac{10}{t^{2}}\end{matrix}\right]$



$\displaystyle \text{Finally, }\vec{\mathbf{x_p}} = \Psi \int \Psi^{-1} g(t)$



$\displaystyle \vec{\mathbf{x_p}} =\left[\begin{matrix}- 5 \ln{\left(t \right)} - 5 + \frac{5}{t} - \frac{1}{2 t^{2}}\\- 10 \ln{\left(t \right)} - 10 + \frac{11}{t}\end{matrix}\right]$



```python

```

6f086d52057897734a8f43080e83af8ac9024e1b
ipynb
Jupyter Notebook
notebooks/system-of-ode-variation-of-parameters.ipynb
kaiyingshan/ode-solver
30c6798efe9c35a088b2c6043493470701641042
MIT
2019-02-17T23:15:20.000Z
2019-02-17T23:15:27.000Z
notebooks/system-of-ode-variation-of-parameters.ipynb
kaiyingshan/ode-solver
30c6798efe9c35a088b2c6043493470701641042
MIT
notebooks/system-of-ode-variation-of-parameters.ipynb
kaiyingshan/ode-solver
30c6798efe9c35a088b2c6043493470701641042
MIT
Qwen/Qwen-72B
1. YES
2. YES