Expression
The Expression
class represents a sum of MulGroup
objects stored as a ndarray
. It provides methods for simplifying the expression, substituting variables, differentiating with respect to a variable, and computing the Hermitian conjugate.
Parameters
-
expr (
ndarray[MulGroup]
, optional):
Attributes
-
expr (
ndarray[MulGroup]
): -
is_time_dependent (
bool
):- A flag indicating whether any element of the expression is time-dependent (i.e., contains the reserved
RDSymbol
t
). - Determined automatically during initialization based on the expression's contents.
- A flag indicating whether any element of the expression is time-dependent (i.e., contains the reserved
Methods
simplify(self, return_dict=False)
Simplifies the expression by combining similar MulGroup
objects.
-
Parameters:
- return_dict (
bool
, optional):- If
True
, returns a dictionary of simplified groups. - If
False
(default), returns a newExpression
object with the simplified expression.
- If
- return_dict (
-
Returns:
- An
Expression
object representing the simplified expression, or a dictionary of results ifreturn_dict
is set toTrue
.
- An
Note: The method extracts the function (
fn
), infinite (inf
), and delta (delta
) components from eachMulGroup
object. Groups with the same infinite and delta parts are combined by summing their function components. The simplifiedExpression
is reconstructed usingMulGroup
objects.
subs(self, substitutions)
Substitutes variables within the expression.
-
Parameters:
- substitutions (
dict
):- A mapping where keys are symbols to be replaced and values are the corresponding replacement expressions.
- substitutions (
-
Returns:
- A new
Expression
object with the substitutions applied.
- A new
diff(self, theta)
Differentiates the expression with respect to time using the MulGroup.diff
method.
-
Parameters:
-
Returns:
- A new
Expression
object representing the derivative of the original expression.
Note: If the expression is not time-dependent, the method returns an empty expression.
- A new
dagger(self)
Computes the Hermitian conjugate (dagger) of the expression.
-
Returns:
- A new
Expression
object representing the Hermitian conjugate of the original expression.
- A new
License
SymPT is licensed under the MIT License. See the LICENSE
file for details.
Citation
If you use SymPT in your research, please cite the following paper:
BibTeX Entry:
@misc{diotallevi2024symptcomprehensivetoolautomating,
title={SymPT: a comprehensive tool for automating effective Hamiltonian derivations},
author={Giovanni Francesco Diotallevi and Leander Reascos and Mónica Benito},
year={2024},
eprint={2412.10240},
archivePrefix={arXiv},
primaryClass={quant-ph},
url={https://arxiv.org/abs/2412.10240},
}
APA Citation:
Diotallevi, G. F., Reascos, L., & Benito, M. (2024). SymPT: a comprehensive tool for automating effective Hamiltonian derivations. arXiv preprint arXiv:2412.10240.
IEEE Citation:
G. F. Diotallevi, L. Reascos, and M. Benito, "SymPT: a comprehensive tool for automating effective Hamiltonian derivations," arXiv preprint arXiv:2412.10240, 2024.