Сейчас я пытаюсь построить интегральное уравнение в Python. Было предложено задать функции для трех различных значений параметра gama. Параметр бета и сама волновая функция зависят от гаммы. Вот код:
from scipy.integrate import quad
import numpy as np
from scipy.special import gamma
from scipy.constants import alpha
import matplotlib.pyplot as plt
#Constants
epsilon = 13.1 #dielectric constant of the material
gamma_C = 0.5 # donor impurity linewidth
nr = 3.2 #refractive index of semiconductor
flux = 0.0 # Phi in eqn 8 magnetic flux
R = 5.0 #radius of the quantum ring in nm
r = np.linspace(0, 6 * R)
rho = r / R
m_0 = 0.0067*0.511 # electron effective mass
h = 4.13e-15 # Planck constant in eV
hbar = 6.58e-16 # reduced Planck constant in eV
#Photon energy
hnu = np.linspace(0, 100) #in eV
#Function that calculates the integrand
def func(rho, theta):
betai = gama**2/2
betaf = np.sqrt(1+gama**4/2)
return (R *(gama * rho)**(betai + betaf) *
np.exp(-1/2*(gama * rho)**2) *
(gama*rho)**2/2 )
def cross_section(hnu, gama):
#function that calculates the photoionisation cross section
betai = gama**2/2
betaf = np.sqrt(1+gama**4/2)
Ei = gama**2*(1+betai)-gama**4/2
Ef = gama**2*(3+betaf)-gama**4/2
delta = hbar * gamma_C/(Ef - Ei - hnu)**2 + ( hbar * gamma_C)**2
return (nr/epsilon * 4*np.pi/3 * alpha * hnu *
(abs( np.sqrt(1/2**betai*gamma(betai + 1))*
np.sqrt(1/2**betaf*gamma(betaf + 2)) *
quad(func, 0, np.infty) [0] * delta))
#Plot
plt.figure();plt.clf()
for gama in [1.0, 1.5, 2.0]:
plt.plot(hnu, (cross_section(hnu, gama))
plt.legend(['$\gamma = 1.0$', '$\gamma = 1.5$', '$\gamma = 2.0$'] )
plt.ylabel('Photoionization cross\n section $\sigma (10^{-14}cm^{2}$)')
plt.xlabel('Photon energy $h\\nu (meV)$ ')
Но я получаю неожиданную синтаксическую ошибку в строке кода:
runfile('/home/daniel/Arquivos_Python/crosssection.py', wdir='/home/daniel/Arquivos_Python')
File "/home/daniel/Arquivos_Python/crosssection.py", line 49
plt.figure();plt.clf()
^
SyntaxError: invalid syntax