MatrixPotential2S

About the MatrixPotential2S 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 MatrixPotential2S

Class documentation

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

This class represents a matrix potential V(x). The potential is given as an analytic 2 \times 2 matrix expression. Some symbolic calculations with the potential are supported.

calculate_eigenvalues()[source]

Calculate the two eigenvalues \lambda_i(x) of the potential V(x). We can do this by symbolic calculations. The multiplicities are taken into account. Note: This function is idempotent and the eigenvalues are memoized for later reuse.

calculate_eigenvectors()[source]

Calculate the two eigenvectors \nu_i(x) of the potential V(x). We can do this by symbolic calculations. Note: This function is idempotent and the eigenvectors are memoized for later reuse.

calculate_exponential(factor=1)[source]

Calculate the matrix exponential \exp(\alpha V). In the case of this class the matrix is of size 2 \times 2 thus the exponential can be calculated analytically for a general matrix. Note: This function is idempotent.

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 (Integer or None (default)) – Specifies the index i of the eigenvalue \lambda_i that gets expanded into a Taylor series u_i.
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 4 numpy ndarrays of shape (1, |\Gamma|).

evaluate_eigenvalues_at(grid, entry=None, as_matrix=False)[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 \Gamma 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 ndarray, all of shape (1, |\Gamma|).

evaluate_eigenvectors_at(grid, entry=None)[source]

Evaluate the two 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.
  • entry (A single python integer.) – The index i of the eigenvector \nu_i(x) we want to evaluate or None to evaluate all eigenvectors.
Returns:

A list containing the numpy ndarrays, all of shape (N, |\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 the same shape as the grid.
evaluate_hessian_at(grid, component=None)[source]

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

Parameters:
  • grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid nodes \Gamma the Hessian gets evaluated at.
  • component – Dummy parameter that has no effect here.
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 (|\Gamma|,D,D) 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.

Parameters:
  • grid (A Grid instance. (Numpy arrays are not directly supported yet.)) – The grid nodes \Gamma the Jacobian gets evaluated at.
  • component – Dummy parameter that has no effect here.
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 eigenvalues \lambda_i(\Gamma), the Jacobian J(\Gamma) and the 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).