# Example {-}
A slightly modified version of example 3.11 demonstrating various strategies on how to compute the transition matrix $\phi$ and the process noise matrix $Q$.


```python
from sympy import symbols, Matrix, sqrt, eye, inverse_laplace_transform, integrate

s, q = symbols('s q')
t = symbols('t', positive=True)

# Dynamic matrices
F1 = Matrix([[0, 1],
             [0, 0]])

F2 = Matrix([[0, 1],
             [-4, -2*sqrt(2)]])

# White noise coefficient vector
G = Matrix([[0],
            [sqrt(q)]])

# Compute transition matrix (from F1)
phi1 = eye(2) + F1*t
display(phi1)

phi1 = inverse_laplace_transform((s*eye(2) - F1).inv(), s, t)
display(phi1)
```


$\displaystyle \left[\begin{matrix}1 & t\\0 & 1\end{matrix}\right]$



$\displaystyle \left[\begin{matrix}1 & t\\0 & 1\end{matrix}\right]$



```python
# Compute transition matrix (from F2)
phi2 = eye(2) + F2*t + (F2*t)**2/2 + (F2*t)**3/6 # + more terms -> i.e. only approximate
display(phi2)

phi2 = inverse_laplace_transform((s*eye(2) - F2).inv(), s, t)
display(phi2)
```


$\displaystyle \left[\begin{matrix}\frac{4 \sqrt{2} t^{3}}{3} - 2 t^{2} + 1 & \frac{2 t^{3}}{3} - \sqrt{2} t^{2} + t\\- \frac{8 t^{3}}{3} + 4 \sqrt{2} t^{2} - 4 t & 2 t^{2} - 2 \sqrt{2} t + 1\end{matrix}\right]$



$\displaystyle \left[\begin{matrix}\left(\sin{\left(\sqrt{2} t \right)} + \cos{\left(\sqrt{2} t \right)}\right) e^{- \sqrt{2} t} & \frac{\sqrt{2} e^{- \sqrt{2} t} \sin{\left(\sqrt{2} t \right)}}{2}\\- 2 \sqrt{2} e^{- \sqrt{2} t} \sin{\left(\sqrt{2} t \right)} & \left(- \sin{\left(\sqrt{2} t \right)} + \cos{\left(\sqrt{2} t \right)}\right) e^{- \sqrt{2} t}\end{matrix}\right]$



```python
# Process noise (from F1)
Q1 = integrate(phi1@G@G.T@phi1.T, t)
display(Q1)
```


$\displaystyle \left[\begin{matrix}\frac{q t^{3}}{3} & \frac{q t^{2}}{2}\\\frac{q t^{2}}{2} & q t\end{matrix}\right]$



```python
from numpy import array, sqrt, eye
from lib.vanloan import numeval

# System parameters
t = 1  # [second]
q = 1  # [m^2/s^3]

# Dynamic matrix
F1 = array([[0, 1],
            [0, 0]])

F2 = array([[0, 1],
            [-4, -2*sqrt(2)]])

# White noise coefficient vector
G = array([[0],
           [sqrt(q)]])

# Numerical evaluation (from F1)
[phi1, Q1] = numeval(F1, G, t)
print(phi1)
print(Q1)
```

    [[1. 1.]
     [0. 1.]]
    [[0.33333333 0.5       ]
     [0.5        1.        ]]



```python
# Numerical evaluation (from F2)
[phi2, Q2] = numeval(F2, G, t)
print(phi2)
print(Q2)
```

    [[ 0.27805495  0.16980634]
     [-0.67922537 -0.20222991]]
    [[0.03568011 0.0144171 ]
     [0.0144171  0.14915822]]


e5dcd6c0503dd5906108152733226cb564da5cd9
ipynb
Jupyter Notebook
Example 3.11.ipynb
mfkiwl/GMPE340
3602b8ba859a2c7db2cab96862472597dc1ac793
MIT
2021-09-07T09:36:36.000Z
2021-09-07T09:36:36.000Z
Example 3.11.ipynb
mfkiwl/GMPE340
3602b8ba859a2c7db2cab96862472597dc1ac793
MIT
Example 3.11.ipynb
mfkiwl/GMPE340
3602b8ba859a2c7db2cab96862472597dc1ac793
MIT
2021-09-20T18:48:20.000Z
2021-09-20T18:48:20.000Z
Qwen/Qwen-72B
1. YES
2. YES