-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElectron Number Density Profile.py
184 lines (121 loc) · 5.35 KB
/
Electron Number Density Profile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# Import necessary libraries
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats # Although imported, 'stats' is not used in this script
import seaborn as sns # Set the aesthetic style of seaborn plots
sns.set()
# # Electron Number Density Profile ($\Delta=0.60$)
# In[2]:
# Create a figure with a specified size
plt.figure(figsize=(12, 8))
# Define parameters
delta = 0.60 # Delta value
kx = np.linspace(0.1, 2 * np.pi) # Array of kx values between 0.1 and 2π
omegat = np.pi # ωt = π
omegata = np.pi / 2 # ωt = π/2
omegatb = 0 # ωt = 0
# Calculate the normalized electron number density for different ωt values
nbyno = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegat)))
nbynoa = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegata)))
nbynob = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegatb)))
# Plot the results with different colors for each curve
plt.plot(kx, nbyno, 'r', label=r"$\omega t=\pi$")
plt.plot(kx, nbynoa, 'b', label=r"$\omega t=\pi /2$")
plt.plot(kx, nbynob, 'k', label=r"$\omega t=0$")
# Add legend
plt.legend(loc='best')
# Label the axes
plt.xlabel("kx", fontsize=16)
plt.ylabel(r"$\frac{n_{e}}{n_{0}}$", fontsize=16)
# Customize tick parameters
plt.tick_params(direction='in')
plt.xticks(fontsize=16)
plt.yticks(fontsize=16)
# Add a title
plt.title(r"Electron Number Density Profile ($\Delta=0.60$)", fontsize=16)
# Save the plot as a PNG file with high resolution
plt.savefig('density0.60.png', dpi=600)
# Show the plot
plt.show()
# # Electron Number Density Profile ($\Delta=0.45$)
# In[3]:
# Create a figure with specific dimensions
plt.figure(figsize=(12, 8))
# Set the parameter delta to 0.45 (strength of modulation)
delta = 0.45
# Generate an array of kx values ranging from 0.1 to 2π
kx = np.linspace(0.1, 2 * np.pi)
# Define the angular frequencies
omegat = np.pi # ωt = π
omegata = np.pi / 2 # ωt = π/2
omegatb = 0 # ωt = 0
# Calculate the normalized electron number density for ωt = π
nbyno = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegat)))
# Calculate the normalized electron number density for ωt = π/2
nbynoa = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegata)))
# Calculate the normalized electron number density for ωt = 0
nbynob = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegatb)))
# Plot the electron number density for each angular frequency with different colors
plt.plot(kx, nbyno, 'r', label=r"$\omega t=\pi$") # Red curve for ωt = π
plt.plot(kx, nbynoa, 'b', label=r"$\omega t=\pi /2$") # Blue curve for ωt = π/2
plt.plot(kx, nbynob, 'k', label=r"$\omega t=0$") # Black curve for ωt = 0
# Add a legend to label the curves
plt.legend(loc='best')
# Label the x-axis
plt.xlabel("kx", fontsize=16)
# Label the y-axis with a LaTeX-style formula
plt.ylabel(r"$\frac{n_{e}}{n_{0}}$", fontsize=16)
# Adjust the appearance of tick marks
plt.tick_params(direction='in')
# Customize the font size of the tick labels
plt.xticks(fontsize=16)
plt.yticks(fontsize=16)
# Add a title to the plot with the specific value of Δ
plt.title(r"Electron Number Density Profile ($\Delta=0.45$)", fontsize=16)
# Save the plot as a high-resolution PNG file
plt.savefig('density0.45.png', dpi=600)
# Optionally, display the plot
plt.show()
# # Electron Number Density Profile ($\Delta=0$)
# In[4]:
# Create a figure with a specified size for better visualization
plt.figure(figsize=(12, 8))
# Set the modulation strength delta to 0 (no modulation)
delta = 0
# Generate an array of kx values from 0.01 to 2π (avoiding zero to prevent division issues)
kx = np.linspace(0.01, 2 * np.pi)
# Define the angular frequencies
omegat = np.pi # ωt = π
omegata = np.pi / 2 # ωt = π/2
omegatb = 0 # ωt = 0
# Calculate the normalized electron number density for ωt = π
nbyno = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegat)))
# Calculate the normalized electron number density for ωt = π/2
nbynoa = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegata)))
# Calculate the normalized electron number density for ωt = 0
nbynob = (1 + delta * np.cos(kx)) / (1 + delta * np.cos(kx) * (1 - np.cos(omegatb)))
# Plot the electron number density profiles for different angular frequencies
plt.plot(kx, nbyno, 'r', label=r"$\omega t=\pi$") # Red curve for ωt = π
plt.plot(kx, nbynoa, 'b', label=r"$\omega t=\pi /2$") # Blue curve for ωt = π/2
plt.plot(kx, nbynob, 'k', label=r"$\omega t=0$") # Black curve for ωt = 0
# Add a legend to label the different curves
plt.legend(loc='best')
# Label the x-axis
plt.xlabel("kx", fontsize=16)
# Label the y-axis with a LaTeX-style mathematical expression
plt.ylabel(r"$\frac{n_{e}}{n_{0}}$", fontsize=16)
# Adjust the appearance of tick marks to point inward
plt.tick_params(direction='in')
# Customize the font size of the tick labels for better readability
plt.xticks(fontsize=16)
plt.yticks(fontsize=16)
# Add a title to the plot indicating Δ = 0 (no modulation)
plt.title(r"Electron Number Density Profile ($\Delta=0$)", fontsize=16)
# Save the plot as a high-resolution PNG file
plt.savefig('density0.00.png', dpi=600)
# Optionally, display the plot (useful for interactive environments)
plt.show()
# In[ ]: