```python
from sympy import *
from sympy import init_printing; init_printing(use_latex = 'mathjax')
```


```python
var('l m hbar W pi') #Variables a utilizar

```




$$\left ( l, \quad m, \quad \hbar, \quad W, \quad \pi\right )$$




```python
M=zeros(2,2)
M[0,0]=sympify('hbar**2/(2*m*l**2)*pi**2+(1/2+1/pi)*hbar**2/(m*l**2)-W')
M[0,1]=sympify('(-1/pi)*hbar**2/(m*l**2)')
M[1,0]=sympify('(-1/pi)*hbar**2/(m*l**2)')
M[1,1]=sympify('hbar**2/(2*m*l**2)*(3*pi)**2+(1/2-1/(3*pi))*hbar**2/(m*l**2)-W')
```


```python
M
```




$$\left[\begin{matrix}- W + \frac{\hbar^{2} \left(\frac{1}{\pi} + \frac{1}{2}\right)}{l^{2} m} + \frac{\pi^{2} \hbar^{2}}{2 l^{2} m} & - \frac{\hbar^{2}}{\pi l^{2} m}\\- \frac{\hbar^{2}}{\pi l^{2} m} & - W + \frac{\hbar^{2}}{l^{2} m} \left(- \frac{1}{3 \pi} + \frac{1}{2}\right) + \frac{9 \pi^{2} \hbar^{2}}{2 l^{2} m}\end{matrix}\right]$$




```python
Wn=solve(M.det(),W)
```


```python
(Matrix(Wn).evalf())
```




$$\left[\begin{matrix}\frac{44.8097107237294 \hbar^{2}}{l^{2} m}\\\frac{5.75051787250659 \hbar^{2}}{l^{2} m}\end{matrix}\right]$$




```python
w=[]
w.append(N(Wn[1]))
w.append(N(Wn[0]))
c=[]
c.append(sympify('c1'))
c.append(sympify('c2'))
```


```python
w
```




$$\left [ \frac{5.75051787250659 \hbar^{2}}{l^{2} m}, \quad \frac{44.8097107237294 \hbar^{2}}{l^{2} m}\right ]$$




```python
E=[]
E.append(5.750345*hbar**2/(m*l**2))
E.append(44.808373*hbar**2/(m*l**2))
E
```




$$\left [ \frac{5.750345 \hbar^{2}}{l^{2} m}, \quad \frac{44.808373 \hbar^{2}}{l^{2} m}\right ]$$




```python
err=[]
for i in range(0,len(w)):
    err.append((w[i]-E[i])/E[i]*100)
err
```




$$\left [ 0.00300629799759328, \quad 0.00298543249805642\right ]$$



736fcc64fab3ba9b56137cf0e43e9d068af19035
ipynb
Jupyter Notebook
Huckel_M0/SantiagoSaracho/Capitulo 8-Ejercicio26.ipynb
lazarusA/Density-functional-theory
c74fd44a66f857de570dc50471b24391e3fa901f
MIT
Huckel_M0/SantiagoSaracho/Capitulo 8-Ejercicio26.ipynb
lazarusA/Density-functional-theory
c74fd44a66f857de570dc50471b24391e3fa901f
MIT
Huckel_M0/SantiagoSaracho/Capitulo 8-Ejercicio26.ipynb
lazarusA/Density-functional-theory
c74fd44a66f857de570dc50471b24391e3fa901f
MIT
Qwen/Qwen-72B
1. YES
2. YES