# Plotting the solution of the central equation using python

• patric44
In summary: I don't have your book so I can't answer your question. I suspect that the chapter you are studying introduces Bloch's theorem but stops short of deriving a dispersion relation for a particular model...maybe in a subsequent chapter it will.
patric44
hi guys

i was trying to came up with a basic code that could show me the band gaps in a solid after adding the periodic potential term to my solution :
$$E = \frac{ħ^2q^2}{2m} \pm Vg$$
where Vg is my periodic potential , q is the k values in the first billion zone
from my understanding if i set the potential = 0 , i will get the normal parabolic dispersion for the free electron model , but once i introduce the potential it will create a separation at certain values of k which will indicate the forbidden gaps .
i tried to create that in python :
the plot of energy values with a periodic potential function:
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.style
import matplotlib.colors
m = 1
ħ  = 1
G = 50
K = 200
E1 = []
E2 = []
E3 = []
x1 = []
x2 = []
x3 = []
def energy1(q):
erg1 = ((ħ**2 * (q-G)**2 )/(8*m))+ np.cos(q)
return erg1
def energy2(q):
erg2 = ((ħ**2 * q**2 )/(8*m))+ np.cos(q)
return erg2
def energy3(q):
erg3 = ((ħ**2 * (q+G)**2 )/(8*m))+ np.cos(q)
return erg3

for z in range(-K,K):
x1.append(z)
E1.append(energy1(z))
for z in range(-K,K):
x2.append(z)
E2.append(energy2(z))
for z in range(-K,K):
x3.append(z)
E3.append(energy3(z))
plt.plot(x1,E1,'r')
plt.plot(x1,E2,'g')
plt.plot(x1,E3,'b')
plt.axvline(x=G)
plt.axvline(x=-G)
plt.grid()
plt.show()

and it gives that :

i was just trying to see the effect of basic periodic function like the sin , but there is no gaps! ,
i must be missing something or doing something wrong ?
any help will be appreciated , thanks

Your model doesn't properly provide for how the periodicity of the lattice effects the electron wave function. Try studying the Kronig-Penny model, for example here, Electron in periodic lattice.

Fred Wright said:
Your model doesn't properly provide for how the periodicity of the lattice effects the electron wave function. Try studying the Kronig-Penny model, for example here, Electron in periodic lattice.
i don't understand what you mean ? do you mean that the potential function that i picked will not give arise
to a band gap at the zone bounders , ( is it must be a square wave like the Kronig-Penny model ?!)
my solution was taken from this book :

how would i modify this code to show the band gap at the zone boundaries ?

patric44 said:
how would i modify this code to show the band gap at the zone boundaries ?
In the link I provided the following dispersion relation is derived,$$\cos (ka)=\cosh (\alpha a)+P\frac{\sinh (\alpha a)}{\alpha a}\\ \alpha^2 =\frac{2m| E |}{\hbar^2}\\ P=\frac{mV_0 ba}{\hbar^2}$$where ##a## is the lattice constant, ##b## is the width of the well, and ##V_0## is the depth of the well. Your algorithm must pick an E value for the r.h.s. of the equation, then take the arccosine and divide by ##a## to determine the corresponding k. It's a two step process, choose ##E## then compute ##k##.

Fred Wright said:
In the link I provided the following dispersion relation is derived,$$\cos (ka)=\cosh (\alpha a)+P\frac{\sinh (\alpha a)}{\alpha a}\\ \alpha^2 =\frac{2m| E |}{\hbar^2}\\ P=\frac{mV_0 ba}{\hbar^2}$$where ##a## is the lattice constant, ##b## is the width of the well, and ##V_0## is the depth of the well. Your algorithm must pick an E value for the r.h.s. of the equation, then take the arccosine and divide by ##a## to determine the corresponding k. It's a two step process, choose ##E## then compute ##k##.
thanks for helping , but i have a question :
why the paper from the book that i provided doesn't mention this , i mean the book just says
$$E=\frac{ħ^2q^2}{ 2m} \pm Vg$$
why the book didn't mention the kronig model , does the book has another approach or it was just being
very hand wavy about it ?!

patric44 said:
thanks for helping , but i have a question :
why the paper from the book that i provided doesn't mention this , i mean the book just says
$$E=\frac{ħ^2q^2}{ 2m} \pm Vg$$
why the book didn't mention the kronig model , does the book has another approach or it was just being
very hand wavy about it ?!
I don't have your book so I can't answer your question. I suspect that the chapter you are studying introduces Bloch's theorem but stops short of deriving a dispersion relation for a particular model...maybe in a subsequent chapter it will.

## 1. What is the central equation?

The central equation refers to the main mathematical equation or formula that is being used to model a particular system or phenomenon. In the context of python, it could refer to a linear, quadratic, or other type of equation that is being solved using programming.

## 2. How can python be used to plot the solution of the central equation?

Python has various libraries and modules such as NumPy, SciPy, and Matplotlib that have functions and methods specifically designed for solving mathematical equations and plotting their solutions. These libraries can be imported into a python script and used to efficiently plot the solution of the central equation.

## 3. What are the advantages of using python for plotting equations?

Python is a powerful and versatile programming language that allows for quick and easy implementation of mathematical algorithms. It also has a wide range of built-in and third-party libraries that make it efficient for solving and plotting equations. Additionally, python's syntax is intuitive and easy to learn, making it accessible to both beginner and advanced users.

## 4. Can python plot solutions for complex equations?

Yes, python has the ability to handle complex equations with real and imaginary components. Libraries such as SymPy and SciPy have functions for solving complex equations and plotting their solutions in a graphical format.

## 5. Are there any limitations to using python for plotting equations?

While python is a powerful tool for plotting equations, it may not be the most efficient option for extremely complex mathematical problems. In these cases, specialized software or languages may be more suitable. Additionally, the accuracy of the solutions plotted using python may be affected by the precision of the data types used in the code.

• Programming and Computer Science
Replies
2
Views
932
• Programming and Computer Science
Replies
4
Views
4K
• Programming and Computer Science
Replies
21
Views
4K
• Programming and Computer Science
Replies
2
Views
802
• Programming and Computer Science
Replies
6
Views
1K
• Programming and Computer Science
Replies
7
Views
3K
• Programming and Computer Science
Replies
50
Views
4K
• Engineering and Comp Sci Homework Help
Replies
6
Views
921
• Programming and Computer Science
Replies
16
Views
2K
• Mechanics
Replies
5
Views
404