# Plot of a function involving an integral and value changing parameters [closed]

I'm trying to plot the cross section with respect to the photon energy $$h\nu$$ but for $$\gamma = 1.0, 1.2, 2.0$$ in the same axes

$$\sigma = \left[\left(\frac{\xi_{eff}}{\xi_{0}}\right)^2 \frac{n_r}{\varepsilon}\right]\frac{4\pi}{3}\alpha_{fs}h\nu|\frac{1}{2}\frac{R}{2^\beta \Gamma(\beta + 1)}\int_{0}^\infty \left(\gamma\rho\right)^{2\beta}e^{-\frac{1}{2}\gamma^2\rho^2}\gamma^2\rho^2d\rho|^{2} \frac{\hbar\Gamma_f}{\left(\lambda_{01} - \lambda_{00} - h\nu\right)^2 + \left(\hbar\Gamma_f\right)^2}$$

where

$$\lambda_{00} = 2\gamma^2\left(\beta + 1\right) - \frac{\gamma^4}{4}$$

e $$\lambda_{01} = 2\gamma^2\left(\beta + 3\right) - \frac{\gamma^4}{4}$$

are the energies of the final and ground states, and $$\beta =\sqrt{ \left(m - \Phi\right)^2) - \frac{\gamma^4}{4} }$$

Here' s my attempt to solve this problem in Python:

from scipy.integrate import quad
import numpy as np
from scipy.special import gamma
from scipy.constants import  pi, 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
m = 0 # magnetic number
flux = 0  # Phi in eqn 8 magnetic flux
R = 5  #radius of the qunatum 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
h_ni = np.linspace(0, 100/h) #in eV

#Function that calculates the integrand
def func(rho, gama):
beta = np.sqrt((m - flux)**2 + gama**4/4)
return ((gama * rho)**2*beta * np.exp(-1/2*(gama * rho)**2)
* (gama * rho)**2/2   )

def cross_section(h_ni, gama):
#function that calculates the photoionisation cross sectio
beta = np.sqrt((m - flux)**2 + gama**4/4)
Ei = gama**2*(1+beta)-gama**4/2
Ef = gama**2*(3+beta)-gama**4/2

return ((nr/epsilon) * 4*pi/3 * alpha * h_ni *
R ** 2 / (2**beta * gamma(beta + 1)) *
hbar*gamma_C/(((Ef-Ei-h_ni))**2 + ( hbar*gamma_C)**2))

#Plot

plt.figure();plt.clf()

for gama in [1.0, 1.5, 2.0]:
plt.plot(h_ni, cross_section(h_ni, gama))


But I got the following error

   TypeError: func() missing 1 required positional argument: 'gama'


How can I solve this? Any help is welcome.

• I would suggest that you non-dimensionalize your equation since right now you have too much parameters and it is a bit cumbersome to work with. – nicoguaro Apr 6 at 1:20
• Revision 7 of the question got an answer (which seemed to help). Continuing editing and debugging the code on Computational Science SE (as well as on StackOverflow) should not happen. Moreover, revision 7 that got the answer is certainly off-topic, as it is about the syntaxis of the particular functionality in Python. – Anton Menshov Apr 6 at 23:15
• So, I did a rollback and closed this question. If while solving this problem you get the question that is more aligned with the computational science aspect, feel free to ask a new question. – Anton Menshov Apr 6 at 23:17
• Actually, I solved the syntaxis problem, but found several other problems in the computational aspects. I'll ask another question – Daniel Lima Apr 7 at 20:49

Your function func(rho, gamma) takes two arguments while you pass only one (I think none). That is what your error tells you.
Recheck where you use func(rho, gamma) and make sure you pass two arguments.