```python
from IPython.display import display, Markdown, Latex
import linear_systems as ls 
import numpy as np
```


```python

```

Using KVL in 3 meshes we have the relations:- 
$$
\begin{align}
-10+10I_1+20+10(I_1-I_2)-10I_1  = 0 \\
-20 +10(I_2-I_1) + 30I_2+10(I_2-I_3) = 0 \\
-10 -20I_3-10(I_3-I_2)= 0
\end{align}
$$
In matrix form we have the following relation 
$$
\begin{pmatrix}
4 & -1 & 0 \\
-1 & 5 & -1 \\
0 & 1 & -3 \\
\end{pmatrix}
\begin{pmatrix}
I_1 \\
I_2\\
I_3 \\
\end{pmatrix}
=
\begin{pmatrix}
-1 \\
2\\
1 \\
\end{pmatrix}
$$
$$

\left[\begin{array}{ccc|c}
4 & -1 & 0 &-1 \\
-1 & 5 & -1 &2\\
0 & 1 & -3& 1 \\
\end{array}\right]
$$


Using Gaussian elimination we have, 


```python
A = np.array(
    [[4,-1,0],
    [-1,5,-1],
    [0,1,-3]] , dtype=float
)
b = np.array([-1,2,1])

print(ls.gauss_seidel(A,b,tol=1e-13)[1])
np.linalg.solve(A,b)
```

    2.4452662117369073e-14





    array([-0.16981132,  0.32075472, -0.22641509])




```python

```

c45769084df50f0ff835d3503f4e732ce9c2cf92
ipynb
Jupyter Notebook
linear_system/gauss_seidel.ipynb
plancky/mathematical_physics_II
c912dca1a58c218ddb06dc6cbca021b03a703540
CC0-1.0
linear_system/gauss_seidel.ipynb
plancky/mathematical_physics_II
c912dca1a58c218ddb06dc6cbca021b03a703540
CC0-1.0
linear_system/gauss_seidel.ipynb
plancky/mathematical_physics_II
c912dca1a58c218ddb06dc6cbca021b03a703540
CC0-1.0
Qwen/Qwen-72B
1. YES
2. YES