SWPEigenstates

Here are defined the classes allowing one to create and use the eigenstates of the 1-dimendional (1D) Square Well Potential (SWP) case.

The two classes are:

Both classes derive from the SWPEigenstate abstract class, that forces to redefine the scalar product so that it is computed analytically when possible.

class siegpy.swpeigenstates.SWPEigenstate(k, parity, potential, grid, analytic)[source]

Bases: siegpy.analyticeigenstates.AnalyticEigenstate

This is the base class for any eigenstate of the 1D Square-Well Potential (1DSWP). It defines some generic methods, while leaving some others to be defined by its subclasses, that are:

  • the SWPSiegert class, defining the Siegert states of the Hamiltonian defined by the 1D SWP,
  • the SWPContinuum class, defining the continuum states of the same problem.

In addition to those of an AnalyticEigenstate, one of the main characteristics of a SWPEigenstate is its parity (the eigenstate must be an even or odd function).

Parameters:
  • k (complex) – Wavenumber of the state.
  • parity (str) – Parity of the state ('e' for even, 'o' for odd).
  • potential (SWPotential) – 1D Square-Well Potential giving rise to this eigenstate.
  • grid (list or set or numpy array) – Discretization grid.
  • analytic (bool) – If True, the scalar products must be computed analytically.
Raises:

TypeError – If the potential is not a SWPotential instance.

parity
Returns:Parity of the eigenstate ('e' if it is even or 'o' if it is odd).
Return type:str
is_even
Returns:True if the eigenstate is even.
Return type:bool
is_odd
Returns:True if the eigenstate is odd.
Return type:bool
_compute_values(grid)[source]

Evaluate the wavefunction of the eigenstate discretized over the whole grid.

Parameters:grid (list or set or numpy array) – Discretization grid.
Returns:Wavefunction discretized over the grid.
Return type:numpy array
_even_wf_1(grid_1)[source]

Note

This is an asbtract method.

Evaluate the even eigenstate wavefunction over the grid points in region I.

Parameters:grid_1 (numpy array) – Grid in region I.
Returns:Even eigenstate wavefunction discretized over the grid in region I.
Return type:numpy array
_even_wf_2(grid_2)[source]

Note

This is an asbtract method.

Evaluate the even eigenstate wavefunction over the grid points in region II.

Parameters:grid_2 (numpy array) – Grid in region II.
Returns:Even eigenstate wavefunction discretized over the grid in region II.
Return type:numpy array
_odd_wf_1(grid_1)[source]

Note

This is an asbtract method.

Evaluate the odd eigenstate wavefunction over the grid points in region I.

Parameters:grid_1 (numpy array) – Grid in region I.
Returns:Odd eigenstate wavefunction discretized over the grid in region I.
Return type:numpy array
_odd_wf_2(grid_2)[source]

Note

This is an asbtract method.

Evaluate the odd eigenstate wavefunction over the grid points in region II.

Parameters:grid_2 (numpy array) – Grid in region II.
Returns:Odd eigenstate wavefunction discretized over the grid in region II.
Return type:numpy array
scal_prod(other, xlim=None)[source]

Evaluate the scalar product of an eigenstate with another function. It can be computed analytically or not.

Note

If it has to be computed analytically, a TypeError may be raised if the analytic scalar product with the test function other is analytically unknown (at present, only scalar products with Gaussian and rectangular functions are possible).

Parameters:
  • other (Function) – Another Function.
  • xlim (tuple(float or int, float or int)) – Range of the x axis for the integration (optional).
Returns:

Result of the scalar product.

Return type:

complex

Raises:

TypeError – If the value of the analytical scalar product with the other function is unknown.

_scal_prod_with_Gaussian(gaussian)[source]
Parameters:gaussian (Gaussian) – Gaussian function.
Returns:Value of the analytic scalar product of an eigenstate with a Gaussian test function.
Return type:complex or float
_scal_prod_with_Rectangular(rect)[source]
Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product of an eigenstate with a Rectangular test function.
Return type:complex or float
_sp_R_1(rect)[source]

Note

This is an asbtract method.

Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product between an eigenstate and a rectangular function spreading over region I.
Return type:float or complex
_sp_R_2(rect)[source]
Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product between an eigenstate and a rectangular function spreading over region II.
Return type:float or complex
_sp_R_2_other_cases(rect)[source]

Note

This is an asbtract method.

Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product of an eigenstate with a rectangular test function in region II when the result is not obviously 0.
Return type:complex or float
_sp_R_3(rect)[source]
Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product of an eigenstate with a rectangular test function in region III.
Return type:complex or float
class siegpy.swpeigenstates.SWPSiegert(ks, parity, potential, grid=None, analytic=True)[source]

Bases: siegpy.swpeigenstates.SWPEigenstate, siegpy.analyticeigenstates.AnalyticSiegert

This class defines a Siegert state in the case of the 1D SWP.

Parameters:
  • ks (complex) – Wavenumber of the Siegert state.
  • parity (str) – Parity of the Siegert state ('e' for even, 'o' for odd).
  • potential (SWPotential) – 1D Square-Well Potential giving rise to this eigenstate.
  • grid (list or set or numpy array) – Discretization grid (optional).
  • analytic (bool) – If True, the scalar products must be computed analytically (default to True).
Raises:

ParityError – If the parity is inconsistent with the Siegert state wavenumber.

_even_wf_1(grid_1)[source]

Evaluate the even Siegert state wavefunction over the grid points in region I.

Parameters:grid_1 (numpy array) – Grid in region I.
Returns:Even Siegert state wavefunction discretized over the grid in region I.
Return type:numpy array
_even_wf_2(grid_2)[source]

Evaluate the even Siegert state wavefunction over the grid points in region II.

Parameters:grid_2 (numpy array) – Grid in region II.
Returns:Even Siegert state wavefunction discretized over the grid in region II.
Return type:numpy array
_odd_wf_1(grid_1)[source]

Evaluate the odd Siegert state wavefunction over the grid points in region I.

Parameters:grid_1 (numpy array) – Grid in region I.
Returns:Odd Siegert state wavefunction discretized over the grid in region I.
Return type:numpy array
_odd_wf_2(grid_2)[source]

Evaluate the odd Siegert state wavefunction over the grid points in region II.

Parameters:grid_2 (numpy array) – Grid in region II.
Returns:Odd Siegert state wavefunction discretized over the grid in region II.
Return type:numpy array
_sp_even_gauss(gaussian, expkp, expkm, expqp, expqm, zkpp, zkmp, zkpm, zkmm, zqpp, zqmp, zqpm, zqmm)[source]
Parameters:gaussian (Gaussian) – Gaussian function.
Returns:Analytical value of the c-product between an even Siegert state and a Gaussian test function.
Return type:float or complex
_sp_odd_gauss(gaussian, expkp, expkm, expqp, expqm, zkpp, zkmp, zkpm, zkmm, zqpp, zqmp, zqpm, zqmm)[source]
Parameters:gaussian (Gaussian) – Gaussian function.
Returns:Analytical value of the c-product between an odd Siegert state and a Gaussian test function.
Return type:float or complex
_sp_R_1(rect)[source]
Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product of a Siegert state with a rectangular function spreading over region I.
Return type:complex or float
_sp_R_2_other_cases(rect)[source]
Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product of a Siegert state with a rectangular function spreading over region II.
Return type:complex or float
MLE_strength_function(test, kgrid)[source]

Evaluate the contribution of a Siegert state to the Mittag-Leffler expansion of the strength function, for a given test function discretized on a grid of wavenumbers kgrid.

Parameters:
  • test (Wavefunction) – Test function.
  • kgrid (numpy array) – Discretization grid of the wavenumber.
Returns:

Contribution of the Siegert state to the strength function.

Return type:

numpy array

class siegpy.swpeigenstates.SWPContinuum(k, parity, potential, grid=None, analytic=True)[source]

Bases: siegpy.swpeigenstates.SWPEigenstate, siegpy.analyticeigenstates.AnalyticContinuum

Class defining a continuum state of the 1D Square-Well potential.

Parameters:
  • k (complex) – Wavenumber of the continuum state.
  • parity (str) – Parity of the continuum state ('e' for even, 'o' for odd).
  • potential (SWPotential) – 1D Square-Well Potential giving rise to this eigenstate.
  • grid (list or set or numpy array) – Discretization grid (optional).
  • analytic (bool) – If True, the scalar products must be computed analytically (default to True).
Raises:

ParityError – If the parity is not 'e' (even) or 'o' (odd).

_even_wf_1(grid_1)[source]

Evaluate the even eigenstate wavefunction over the grid points in region I.

Parameters:grid_1 (numpy array) – Grid in region I.
Returns:Even eigenstate wavefunction discretized over the grid in region I.
Return type:numpy array
_even_wf_2(grid_2)[source]

Evaluate the even Siegert state wavefunction over the grid points in region II.

Parameters:grid_2 (numpy array) – Grid in region II.
Returns:Even Siegert state wavefunction discretized over the grid in region II.
Return type:numpy array
_odd_wf_1(grid_1)[source]

Evaluate the odd eigenstate wavefunction over the grid points in region I.

Parameters:grid_1 (numpy array) – Grid in region I.
Returns:Odd eigenstate wavefunction discretized over the grid in region I.
Return type:numpy array
_odd_wf_2(grid_2)[source]

Evaluate the odd Siegert state wavefunction over the grid points in region II.

Parameters:grid_2 (numpy array) – Grid in region II.
Returns:Odd Siegert state wavefunction discretized over the grid in region II.
Return type:numpy array
_sp_even_gauss(gaussian, expkp, expkm, expqp, expqm, zkpp, zkmp, zkpm, zkmm, zqpp, zqmp, zqpm, zqmm)[source]
Parameters:gaussian (Gaussian) – Gaussian function.
Returns:Analytical value of the c-product between an even continuum state and a Gaussian test function.
Return type:float or complex
_sp_odd_gauss(gaussian, expkp, expkm, expqp, expqm, zkpp, zkmp, zkpm, zkmm, zqpp, zqmp, zqpm, zqmm)[source]
Parameters:gaussian (Gaussian) – Gaussian function.
Returns:Analytical value of the c-product between an odd continuum state and a Gaussian test function.
Return type:float or complex
_sp_R_1(rect)[source]
Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product of a continuum state with a Rectangular function spreading over region I.
Return type:complex or float
_sp_R_2_other_cases(rect)[source]
Parameters:rect (Rectangular) – Rectangular function.
Returns:Value of the analytic scalar product of an even continuum state with a Rectangular function spreading over region II.
Return type:complex or float
exception siegpy.swpeigenstates.ParityError[source]

Bases: Exception

Error thrown if the parity of an eigenstate is incorrect.