Exemplo n.º 1
0
def _pot_inf_square_well():
    """Calculates the potential of the ininite square well problem.
    """
    pot = np.zeros((1999, ), dtype=float)
    _write_result('../tests/test_potential',
                  'pot_inf_square_well.dat', pot)
    return pot
Exemplo n.º 2
0
def _pot_harm_osc():
    """Calculates the potential of the harmonic oscillator.
    """
    xplot = np.linspace(-5, 5, num=1999, endpoint=True)
    pot = 0.5 * xplot**2

    _write_result('../tests/test_potential',
                  'pot_harm_osc.dat', pot)
    return pot
Exemplo n.º 3
0
def _pot_fin_square_well():
    """Calculates the potential of the finite square well problem.
    """
    pot1 = np.zeros((750, ), dtype=float)
    pot2 = -10 * np.ones((499, ), dtype=float)
    pot3 = np.zeros((750, ), dtype=float)
    pot = np.concatenate((pot1, pot2, pot3), axis=0)
    _write_result('../tests/test_potential',
                  'pot_fin_square_well.dat', pot)
    return pot
Exemplo n.º 4
0
def _energy_inf_square_well():
    """Calculates the energies of the infinite square well for the first 20
    eigenvalues.

    Args:
        EVmax (int): Set the upper bound for the eigenvalues to calculate

    Returns:
        energy (1darray): Array containing the calculated eigenvalues.
    """
    energy = np.zeros((20, ), dtype=float)
    for nn in range(0, 20):
        energy[nn] = np.pi**2 * (nn + 1)**2 / (2 * 2 * (-2 - 2)**2)
    _write_result('../tests/test_energy',
                  'E_inf_square_well.dat', energy)
    return energy
Exemplo n.º 5
0
def _energy_harm_osc():
    """Calculates the energies of the harmonic oscillator for a given number of
    eigenvalues.

    Args:
        EVmin (int): Set the lower bound for the eigenvalues to calculate
        EVmax (int): Set the upper bound for the eigenvalues to calculate

    Returns:
        energy (1darray): Array containing the calculated eigenvalues.
    """
    energy = np.zeros((20, ), dtype=float)
    for nn in range(20):
        energy[nn] = 0.5 * nn + 0.25
    _write_result('../tests/test_energy', 'E_harm_osc.dat',
                  energy)
    return energy