How to recall the functions with two for loop inside?

Here is my code and if I don't creat function, I can simply use two for loop and got my result successfully. But when I tried to use function with these two loop, I don't know how to recall the function.

import numpy as np
import math
import matplotlib.pyplot as plt

lamb = np.linspace(580, 2000, 1000)
N = len(lamb)
q = np.array([1.645, 0.469, 0.234])
n_0 = np.array([2.078, 1.585, 1.565])
lamb_0 = np.array([533, 504, 501])
c = 3e2#um
d_crystal = 0.5e-3 #um
n = np.zeros((3, N))
def sellmeier(q, n_0, lamb_0, lamb):
    for i in range(0, 3):
        for j in range(N):
            n[i, j] = math.sqrt(n_0[i] ** 2 + (q[i] * lamb_0[i] ** 2 )/ (lamb[j] ** 2 - lamb_0[i] ** 2))
    return n
n_THz = np.zeros((3, N))
for i in range(3):
    for j in range(N):
        n_THz[i, j] = sellmeier(q[i], n_0[i], lamb_0[i], lamb[j])
plt.plot(lamb, n_THz[0,:], color='red', label='n$_1$')
plt.plot(lamb, n_THz[1,:], '--', color='blue', label='n$_2$')
plt.plot(lamb, n_THz[2,:], '--', color='green', label='n$_3$')
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum