SymbolicIntegral

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

Class documentation

class WaveBlocksND.SymbolicIntegral(doraise=False, *unused, **kunused)[source]
__init__(doraise=False, *unused, **kunused)[source]

Use a symbolic exact formula for computing the inner product between two semi-classical wavepackets. The formula is constructed explicitly for the inhomogeneous case.

Parameters:doraise – Raise an InnerProductException exception in case the symbolic formula will fail due to an inherent mathematical singularity. Default is False.
exact_result_ground(Pibra, Piket, eps)[source]

Compute the overlap integral \langle \phi_0 | \phi_0 \rangle of the groundstate \phi_0 by using the symbolic formula:

\langle \phi_0 | \phi_0 \rangle =
\sqrt{\frac{-2 i}{Q_2 \overline{P_1} - P_2 \overline{Q_1}}} \cdot
  \exp \Biggl(
    \frac{i}{2 \varepsilon^2}
    \frac{Q_2 \overline{Q_1} \left(p_2-p_1\right)^2 + P_2 \overline{P_1} \left(q_2-q_1\right)^2}
          {\left(Q_2 \overline{P_1} - P_2 \overline{Q_1}\right)}
  \\
  -\frac{i}{\varepsilon^2}
  \frac{\left(q_2-q_1\right) \left( Q_2 \overline{P_1} p_2 - P_2 \overline{Q_1} p_1\right)}
       {\left(Q_2 \overline{P_1} - P_2 \overline{Q_1}\right)}
  \Biggr)

Note that this is an internal method and usually there is no reason to call it from outside.

Parameters:
  • Pibra – The parameter set \Pi = \{q_1,p_1,Q_1,P_1\} of the bra \langle \phi_0 |.
  • Piket – The parameter set \Pi^\prime = \{q_2,p_2,Q_2,P_2\} of the ket | \phi_0 \rangle.
  • eps – The semi-classical scaling parameter \varepsilon.
Returns:

The value of the integral \langle \phi_0 | \phi_0 \rangle.

exact_result_higher(Pibra, Piket, eps, k, l)[source]

Compute the overlap integral \langle \phi_k | \phi_l \rangle of two states \phi_k and \phi_l by using the symbolic formula:

\langle \phi_k | \phi_l \rangle =
\frac{1}{\sqrt{k!l!}} 2^{-\frac{k+l}{2}} \langle \phi_0 | \phi_0 \rangle \cdot
\left(i \overline{ P_1} Q_2 - i \overline{Q_1} P_2\right)^{-\frac{k+l}{2}} \cdot \\
\sum_{j=0}^{\min\left(k,l\right)}
  \Biggl(
    \binom{k}{j} \binom{l}{j} j! 4^j
    \left(i Q_2  P_1 - i Q_1  P_2\right)^{\frac{k-j}{2}}
    \left(i \overline{Q_2 P_1} - i\overline{Q_1 P_2}\right)^{\frac{l-j}{2}}
    \\
    \cdot H_{k-j}\left(-\frac{1}{\varepsilon}
                  \frac{Q_2\left(p_1-p_2\right)-P_2\left(q_1-q_2\right)}
                       {\sqrt{Q_2 P_1 - Q_1 P_2}\sqrt{\overline{P_1}Q_2-\overline{Q_1} P_2}}\right)
    \\
    \cdot H_{l-j}\left(\frac{1}{\varepsilon}
                 \frac{\overline{ P_1}\left(q_1-q_2\right)-\overline{Q_1}\left(p_1-p_2\right)}
                      {\sqrt{\overline{Q_2 P_1}-\overline{Q_1 P_2}}\sqrt{\overline{ P_1}Q_2-\overline{Q_1} P_2}}\right)
  \Biggr)

Note that this is an internal method and usually there is no reason to call it from outside.

Parameters:
  • Pibra – The parameter set \Pi = \{q_1,p_1,Q_1,P_1\} of the bra \langle \phi_k |.
  • Piket – The parameter set \Pi^\prime = \{q_2,p_2,Q_2,P_2\} of the ket | \phi_l \rangle.
  • eps – The semi-classical scaling parameter \varepsilon.
  • k – Index k of the wavepacket basis function \phi_k.
  • l – Index l of the wavepacket basis function \phi_l.
Returns:

The value of the integral \langle \phi_k | \phi_l \rangle.

get_description()[source]

Return a description of this integral object. A description is a dict containing all key-value pairs necessary to reconstruct the current instance. A description never contains any data.

get_qr()

Return the QuadratureRule subclass instance used for quadrature.

Returns:The current instance of the quadrature rule.
initialize_operator(operator=None, matrix=False, eval_at_once=False)[source]

Provide the operator part of the inner product to evaluate. This function initializes the operator used for quadratures and for building matrices.

Note

The symbolic solution can not handle operators at all.

Parameters:
  • operator – The operator of the inner product. If None a suitable identity is used.
  • matrix – Set this to True (Default is False) in case we want to compute the matrix elements. For nasty technical reasons we can not yet unify the operator call syntax.
  • eval_at_once (Boolean, default is False.) – Flag to tell whether the operator supports the entry=(r,c) call syntax. Since we do not support operators at all, it has no effect.
initialize_packet(pacbra, packet=None)[source]

Provide the wavepacket parts of the inner product to evaluate. Since the formula is for the inhomogeneous case explicitly, different wavepackets can be used for the ‘bra’ as well as the ‘ket’ part.

Parameters:
  • pacbra – The packet that is used for the ‘bra’ part.
  • packet – The packet that is used for the ‘ket’ part.
Raises:

ValueError if the dimension of \Psi is not 1.

perform_build_matrix(row, col)[source]

Computes the matrix elements \langle\Phi_i |\Phi^\prime_j\rangle by an exact symbolic formula.

Parameters:
  • row – The index i of the component \Phi_i of \Psi.
  • row – The index j of the component \Phi^\prime_j of \Psi^\prime.
Returns:

A complex valued matrix of shape |\mathfrak{K}_i| \times |\mathfrak{K}^\prime_j|.

perform_quadrature(row, col)[source]

Evaluates the integral \langle \Phi_i | \Phi^\prime_j \rangle by an exact symbolic formula.

Parameters:
  • row – The index i of the component \Phi_i of \Psi.
  • row – The index j of the component \Phi^\prime_j of \Psi^\prime.
Returns:

A single complex floating point number.

prepare(rows, cols)[source]

Precompute some values needed for evaluating the integral \langle \Phi_i | \Phi^\prime_j \rangle or the corresponding matrix over the basis functions of \Phi_i and \Phi^\prime_j. Note that this function does nothing in the current implementation.

Parameters:
  • rows – A list of all i with 0 \leq i \leq N selecting the \Phi_i for which we precompute values.
  • cols – A list of all j with 0 \leq j \leq N selecting the \Phi^\prime_j for which we precompute values.
set_qr(QR)

Set the QuadratureRule subclass instance used for quadrature.

Parameters:QR – The new QuadratureRule instance.