MatrixPotentialMS

About the MatrixPotentialMS class

The WaveBlocks Project

@author: R. Bourquin @copyright: Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 R. Bourquin @license: Modified BSD License

Inheritance diagram

Inheritance diagram of MatrixPotentialMS

Class documentation

class WaveBlocksND.MatrixPotentialMS(expression, variables, **kwargs)[source]

This class represents a matrix potential V(x). The potential is given as an analytic N \times N matrix expression. All methods use pure numerical techniques because symbolical calculations are unfeasible for 3 or more energy levels.

calculate_eigenvalues()[source]

Calculate all the eigenvalues \lambda_i(x) of the potential V(x). We can not do this by symbolic calculations, hence the function has an empty implementation. We compute the eigenvalues by numerical techniques in the corresponding evaluate_eigenvalues_at function.

calculate_eigenvectors()[source]

Calculate all the eigenvectors \nu_i(x) of the potential V(x). We can not do this by symbolic calculations, hence the function has an empty implementation. We compute the eigenvectors by numerical techniques in the corresponding evaluate_eigenvectors_at function.

calculate_exponential(factor=1)[source]

Calculate the matrix exponential \exp(\alpha V). In the case of this class the matrix is of size N \times N thus the exponential can not be calculated analytically for a general matrix. We use numerical approximations to determine the matrix exponential. We just store the prefactor \alpha for use during numerical evaluation.

Parameters:factor – The prefactor \alpha in the exponential.
calculate_hessian()[source]

Calculate the Hessian matrix \nabla^2 \lambda_i of the potential’s eigenvalues \Lambda(x) with x \in \mathbb{R}^D. For potentials which depend only one variable, this equals the second derivative and D=1. Note that this function is idempotent.

calculate_jacobian()[source]

Calculate the Jacobian matrix \nabla \lambda_i of the potential’s eigenvalues \Lambda(x) with x \in \mathbb{R}^D. For potentials which depend only one variable, this equals the first derivative and D=1. Note that this function is idempotent.

calculate_local_quadratic(diagonal_component=None)[source]

Calculate the local quadratic approximation matrix U(x) of the potential’s eigenvalues in \Lambda(x). This function can be used for the homogeneous case and takes into account the leading component \chi \in [0,\ldots,N-1]. If the parameter i is not given, calculate the local quadratic approximation matrix U(x) of all the potential’s eigenvalues in \Lambda. This case can be used for the inhomogeneous case.

Parameters:diagonal_component – Dummy parameter which has no effect here.
calculate_local_remainder(diagonal_component=None)[source]

Calculate the non-quadratic remainder matrix W(x) = V(x) - U(x) of the quadratic approximation matrix U(x) of the potential’s eigenvalue matrix \Lambda(x). In the homogeneous case the matrix U is given by U(x) = \text{diag}([u_i,\ldots,u_i]) where in the inhomogeneous case it is given by U(x) = \text{diag}([u_0,\ldots,u_{N-1}]).

Parameters:diagonal_component (Integer or None (default)) – Specifies the index i of the eigenvalue \lambda_i that gets expanded into a Taylor series u_i. If set to None the inhomogeneous case is computed.
evaluate_at(grid, entry=None, as_matrix=True)[source]

Evaluate the potential V(x) elementwise on a grid \Gamma.

Parameters:
  • grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid containing the nodes \gamma_i we want to evaluate the potential at.
  • entry (A python tuple of two integers.) – The indices (i,j) of the component V_{i,j}(x) we want to evaluate or None to evaluate all entries.
  • as_matrix – Dummy parameter which has no effect here.
Returns:

A list containing N^2 numpy ndarrays of shape (1, |\Gamma|).

evaluate_eigenvalues_at(grid, entry=None, as_matrix=False, sorted=True)[source]

Evaluate the eigenvalues \lambda_i(x) elementwise on a grid \Gamma.

Parameters:
  • grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid containing the nodes \gamma_i we want to evaluate the eigenvalues at.
  • entry (A python tuple of two integers.) – The indices (i,j) of the component \Lambda_{i,j}(x) we want to evaluate or None to evaluate all entries. If j = i then we evaluate the eigenvalue \lambda_i(x).
  • as_matrix – Whether to include the off-diagonal zero entries of \Lambda_{i,j}(x) in the return value.
Returns:

A list containing the numpy ndarrays, all of shape (1, |\Gamma|).

evaluate_eigenvectors_at(grid, sorted=True)[source]

Evaluate the eigenvectors \nu_i(x) elementwise on a grid \Gamma.

Parameters:grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid containing the nodes \gamma_i we want to evaluate the eigenvectors at.
Returns:A list containing the N numpy ndarrays, all of shape (D, |\Gamma|).
evaluate_exponential_at(grid)[source]

Evaluate the exponential of the potential matrix V(x) on a grid \Gamma.

Parameters:grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid containing the nodes \gamma_i we want to evaluate the exponential at.
Returns:The numerical approximation of the matrix exponential at the given grid nodes. A list contains the exponentials for all entries (i,j), each having a shape of (1, |\Gamma|).
evaluate_hessian_at(grid, component=None)[source]

Evaluate the list of Hessian matrices \nabla^2 \lambda_i(x) at some grid nodes \Gamma for one or all eigenvalues.

Parameters:
  • grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid nodes \Gamma the Hessian gets evaluated at.
  • component – The index i of the eigenvalue \lambda_i.
Returns:

The value of the potential’s Hessian at the given nodes. The result is an ndarray of shape (D,D) is we evaluate at a single grid node or of shape (D,D,|\Gamma|) if we evaluate at multiple nodes simultaneously.

evaluate_jacobian_at(grid, component=None)[source]

Evaluate the list of Jacobian matrices \nabla \lambda_i(x) at some grid nodes \Gamma for one or all eigenvalues.

Parameters:
  • grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid nodes \Gamma the Jacobian gets evaluated at.
  • component – The index i of the eigenvalue \lambda_i.
Returns:

The value of the potential’s Jacobian at the given nodes. The result is a list of ndarray each of shape (D,1) is we evaluate at a single grid node or of shape (D,|\Gamma|) if we evaluate at multiple nodes simultaneously.

evaluate_local_quadratic_at(grid, diagonal_component=None)[source]

Numerically evaluate the local quadratic approximation matrix U(x) of the potential’s eigenvalues in \Lambda(x) at the given grid nodes \Gamma.

Parameters:
  • grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid \Gamma containing the nodes \gamma we want to evaluate the quadratic approximation at.
  • diagonal_component – Specifies the index i of the eigenvalue \lambda_i that gets expanded into a Taylor series u_i.
Returns:

A list of tuples or a single tuple. Each tuple (\lambda, J, H) contains the the evaluated eigenvalue \lambda_i(\Gamma), its Jacobian J(\Gamma) and its Hessian H(\Gamma) in this order.

evaluate_local_remainder_at(grid, position, diagonal_component=None, entry=None)[source]

Numerically evaluate the non-quadratic remainder W(x) of the quadratic approximation U(x) of the potential’s eigenvalue \Lambda(x) at the given nodes \Gamma.

Warning: do not set the diagonal_component and the entry parameter both to None.
Parameters:
  • grid – The grid nodes \Gamma the remainder W gets evaluated at.
  • position – The point q \in \mathbb{R}^D where the Taylor series is computed.
  • diagonal_component (Integer or None (default)) – Specifies the index i of the eigenvalue \lambda_i that gets expanded into a Taylor series u_i and whose remainder matrix W(x) = V(x) - \text{diag}([u_i,\ldots,u_i]) we evaluate. If set to None the inhomogeneous case given by W(x) = V(x) - \text{diag}([u_0,\ldots,u_{N-1}]) is computed.
  • entry (A python tuple of two integers.) – The entry \left(i,j\right) of the remainder matrix W that is evaluated.
Returns:

A list with N^2 ndarray elements or a single ndarray. Each containing the values of W_{i,j}(\Gamma). Each array is of shape (1,|\Gamma|).

get_dimension()

Return the dimension D of the potential V(x). The dimension is equal to the number of free variables x_i where x := (x_1, x_2, ..., x_D).

get_number_components()

Return the number N of components the potential V(x) supports. This is equivalent to the number of energy levels \lambda_i(x).