## Run with your first code


```python
from sympy import init_printing; init_printing()

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all" # display all expression in one cell instead of the last one
```

#### Wave Equation
The tensor coefficient matrix in electromagnetic wave equation 

$$\mathit{k}\times(\mathit{k}\times \tilde{\mathit{E}}) + k_0^2 \mathbf{\kappa}\cdot \tilde{\mathit{E}}=\mathit{0}$$

$$
\left(\begin{bmatrix}
-k_z^2 &  & k_x k_z \\ 
 & -k_x^2-k_z^2 & \\ 
 k_x k_z &  & -k_x^2
\end{bmatrix} + k_0^2
\begin{bmatrix}
\kappa_\perp & -j \kappa_\times & \\ 
j\kappa_\times & \kappa_\perp  & \\ 
 &  & \kappa_\parallel
\end{bmatrix}\right)\cdot 
\begin{bmatrix}
\tilde{E}_x\\ 
\tilde{E}_y\\ 
\tilde{E}_z
\end{bmatrix} = 
\begin{bmatrix}
0\\ 
0\\ 
0
\end{bmatrix}$$

$$
\mathbf{T}\cdot 
\begin{bmatrix}
\tilde{E}_x\\ 
\tilde{E}_y\\ 
\tilde{E}_z
\end{bmatrix} = 
\begin{bmatrix}
0\\ 
0\\ 
0
\end{bmatrix}
$$

You can acquire the `sympy.Array` representation of the above (tensor) matrix coefficients by the `WaveEq` class' coeff_matrix() method. For the relevant variable, you can get them by attribute *e.g.*, `wave_eq.wave.k[1]` means the wave's $k_y$ component of $\vec{k}$ vector.


```python
from sinupy import mediums, waves
from sinupy.waves import EM
plasma = mediums.ColdMagnetizedPlasma()     # to specify a kind of metarial
wave_eq = waves.EM.WaveEq(plasma)           # wave eqution
wave = wave_eq.wave
wave_eq.coeff_matrix()                      # get the k parameter of cross part 
wave_eq
```




$\displaystyle \left[\begin{matrix}- k_{y }^{2} - k_{z }^{2} + \frac{\kappa_{\perp} \omega_{}^{2}}{c^{2}} & - \frac{i \kappa_{\times} \omega_{}^{2}}{c^{2}} + k_{x } k_{y } & k_{x } k_{z }\\\frac{i \kappa_{\times} \omega_{}^{2}}{c^{2}} + k_{x } k_{y } & - k_{x }^{2} - k_{z }^{2} + \frac{\kappa_{\perp} \omega_{}^{2}}{c^{2}} & k_{y } k_{z }\\k_{x } k_{z } & k_{y } k_{z } & - k_{x }^{2} - k_{y }^{2} + \frac{\kappa_{\parallel} \omega_{}^{2}}{c^{2}}\end{matrix}\right]$






$\displaystyle \left[\begin{matrix}k_{y } \left(- E_{x } k_{y } + E_{y } k_{x }\right) - k_{z } \left(E_{x } k_{z } - E_{z } k_{x }\right) & - k_{x } \left(- E_{x } k_{y } + E_{y } k_{x }\right) + k_{z } \left(- E_{y } k_{z } + E_{z } k_{y }\right) & k_{x } \left(E_{x } k_{z } - E_{z } k_{x }\right) - k_{y } \left(- E_{y } k_{z } + E_{z } k_{y }\right)\end{matrix}\right] = \left[\begin{matrix}- \frac{\omega_{}^{2} \left(E_{x } \kappa_{\perp} - i E_{y } \kappa_{\times}\right)}{c^{2}} & - \frac{\omega_{}^{2} \left(i E_{x } \kappa_{\times} + E_{y } \kappa_{\perp}\right)}{c^{2}} & - \frac{E_{z } \kappa_{\parallel} \omega_{}^{2}}{c^{2}}\end{matrix}\right]$



The function `sinupy.waves.EM.solve_N2(WaveEq)` returns the solutions of $N^2(\omega, \theta)$, which is usually tedious for hand-deduction.


```python
EM.solve_N2(wave_eq)        # solve the eqution
```

2034cd24c61739a85eb3bba87d64b1fdff9231ec
ipynb
Jupyter Notebook
docs/source/Run with your first code.ipynb
WenyinWei/sinupy
ffeb7c7c02ec985489ef217fe49e1e9e16705556
MIT
2021-05-13T09:22:50.000Z
2021-06-16T04:11:51.000Z
docs/build/html/_sources/Run with your first code.ipynb.txt
WenyinWei/sinupy
ffeb7c7c02ec985489ef217fe49e1e9e16705556
MIT
docs/build/html/_sources/Run with your first code.ipynb.txt
WenyinWei/sinupy
ffeb7c7c02ec985489ef217fe49e1e9e16705556
MIT
2021-05-27T14:13:11.000Z
2021-06-16T04:12:01.000Z
Qwen/Qwen-72B
1. YES
2. YES