1 Introduction

Quantum resource theory (QRT) can be constructed and understood through quantum entanglement theory. QRT has three ingredients, i.e. free states containing no resource (e.g. separable states), resource states (e.g. entangled states), and the restricted or free operations that cannot create resource states from any free states (e.g. local operations and classical communication, LOCC). The complete characterization of a particular resource theory mainly consists of three aspects: (1) the clear definition; (2) the reasonable measures; (3) the interconversions of resource states under the restricted operations.

Any function satisfying some basic conditions and monotonicity under free operations may be regarded as a bona fide measure for the resource under consideration, such as concurrence [1] and negativity [2] for quantifying quantum entanglement, quantum discord [3, 4] for quantifying quantum correlation, and the relative entropy of coherence [5] and \(l_{1}\) norm of coherence [5] for quantifying quantum coherence.

In spite of the great importance of entanglement in quantum computation and quantum information processing, entanglement does not account for all quantum correlation because separable states can have nonclassical correlation. It has been found that many tasks can be done with quantum correlation resource instead of entanglement. One kind of resource can often be converted to another kind. Recently, Yao et al. [6] investigated the hierarchical structure of quantum coherence, quantum discord, and quantum entanglement in multipartite systems. Some papers [7, 8] studied the relation of quantum coherence and quantum entanglement. Some authors [6, 9,10,11] studied the relation between coherence and discord-type quantum correlation.

Quantum metrology aims to use quantum resources to develop new methods to measure classical parameters and quantum parameters with high precision. In ideal quantum information metrology, a maximally entangled state is regarded as the best resource for quantum metrology [12]. Quantum coherence can improve sensitivity for parameter estimation [13].

In the real world, quantum system is inevitably affected by noise introduced by the interaction between the system and the surrounding environment. Noise leads to the loss of quantum resource that initially presents in the system. Thus, it is fundamentally important to explore the dynamics of various quantum resources measures in various noisy environment. Some authors studied the dynamics of quantum correlations under noisy environment [14,15,16,17,18,19,20,21]. The behaviors of quantum coherence is investigated in open system [22,23,24].

In this paper, we present a Maple package for computing some quantum resource measures, including entanglement, quantum correlation, quantum coherence, quantum metrology, and some fundamentally basic evaluating functions for quantum information and quantum resource dynamics. Some functions are written based on the Feynman program [25,26,27,28,29,30,31]. The function package is a collection of tools in our research works, which is widely useful in the research of quantum information.

The remainder of this paper is structured as follows. In Section 2, we recall some theoretical background related to the computing package. Section 3 introduces the functions of our program package. We then present several illustrative examples in Section 4. A brief conclusion is given in the last section.

2 Theoretical Background

2.1 Quantum Entanglement

A state is said to be separable if and only if it can be prepared via LOCC. It can be represented as a convex combination of pure product states [32]:

$$ \rho_{sep}=\sum\limits_{i}p_{i}|a_{i}\rangle\langle a_{i}|\otimes|b_{i}\rangle\langle b_{i}|, $$
(1)

where the pure states \(|a_{i}\rangle \) and \(|b_{i}\rangle \) are the elements of the local Hilbert spaces \(\mathcal {H}_{A}\) and \(\mathcal {H}_{B}\). If a state cannot be written in this form, it is called entangled state. Quantum entanglement was regarded as a key resource in quantum cryptography, quantum communication and quantum computation. The amount of entanglement contained in a state is very essential, and many literatures proposed various entanglement measures. An entanglement measure E satisfies the following properties:

  1. 1.

    \(E(\rho )= 0\) iff \(\rho \) is a separable state.

  2. 2.

    Monotonicity under LOCC: \(E(\rho )\geq E({\Lambda }_{\text {LOCC}}(\rho ))\).

  3. 3.

    Convexity: the mixing of states does not increase the entanglement, i.e. \(E(\lambda \rho +(1-\lambda )\sigma )\leq \lambda E(\rho )+(1-\lambda )E(\sigma )\).

Let us recall two frequently-used entanglement measures. For bipartite systems, the entanglement of formation [1] is one of the most popular and frequently used entanglement measures, which is a monotonically increasing function of the concurrence. For two-qubit mixed states, the concurrence is defined as

$$\begin{array}{@{}rcl@{}} C_{E}(\rho)&=&\max\{0,2 \max\{\sqrt{\lambda_{1}},\sqrt{\lambda_{2}},\sqrt{\lambda_{3}},\sqrt{\lambda_{4}}\}\\ &&-\sqrt{\lambda_{1}}-\sqrt{\lambda_{2}}-\sqrt{\lambda_{3}}-\sqrt{\lambda_{4}}\}, \end{array} $$
(2)

where \(\lambda _{i}\) are the eigenvalues of \(\rho \tilde {\rho }\) in decreasing order, and \(\tilde {\rho }=(\sigma _{2}\otimes \sigma _{2})\rho ^{\ast }(\sigma _{2}\otimes \sigma _{2})\) with \(\rho ^{\ast }\) being the complex conjugated density matrix.

For X states, the concurrence is given as \(C_{E}(\rho _{X}) = \max (0,C_{1},C_{2})\) with \(C_{1} = 2(|\rho _{41}|-\sqrt {\rho _{33}\rho _{22}})\) and \(C_{2} = 2(|\rho _{32}|-\sqrt {\rho _{44}\rho _{11}})\), where \(\rho _{ij}\) denote the corresponding elements of state \(\rho \).

The positivity of the partial transpose of a density operator is a necessary condition for separability. Therefore the ‘negativity’ in the spectrum of the partial transpose can quantify entanglement. The negativity is defined [2] as

$$ N(\rho)=\frac{\|\rho^{T_{A}}\|_{1}-1}{d-1}, $$
(3)

where \(\|X\|_{1}=\text {Tr}(\sqrt {X^{\dag }X})\) is the trace norm, \(\rho ^{T_{A}}\) denotes the partial transpose of the state with respect to the subsystem A in the overall system composed of the subsystems A and B, and \(d=\min (d_{A},d_{B})\) is the dimension of the smaller subsystem.

2.2 Quantum Correlation

A state is said to be classically correlated if it can be written as [33]:

$$ \rho_{cc}=\sum\limits_{i,j}p_{ij}|i\rangle\langle i|\otimes|j\rangle\langle j|, $$
(4)

where the \(\{|i\rangle |\}\) and \(\{|j\rangle \}\) are the orthogonal states in the Hilbert spaces \(\mathcal {H}_{A}\) and \(\mathcal {H}_{B}\), respectively. Otherwise the state is called quantum correlated. Every classically correlated state is also separable, but a separable state is not necessarily classically correlated. In a similar way we can also define classical-quantum state and quantum-classical state as

$$\begin{array}{@{}rcl@{}} &&\rho_{cq}=\sum\limits_{i}p_{i}|i\rangle\langle i|\otimes\rho_{i},\\ &&\rho_{qc}=\sum\limits_{j}p_{j}\rho_{j}\otimes|j\rangle\langle j|, \end{array} $$
(5)

where the \(\rho _{i}\) and \(\rho _{j}\) are states in the Hilbert spaces \(\mathcal {H}_{A}\) and \(\mathcal {H}_{B}\), respectively.

In general, a quantum correlation measure Q should satisfy the following conditions [34]:

  1. 1.

    Q is nonnegative.

  2. 2.

    Q is invariant under local unitary operations.

  3. 3.

    Q is zero for classically correlated states.

In the following, we present some important measures of quantum correlation. Quantum discord is historically the first measure of quantum correlation, which is proposed by Ollivier et al. [3] and by Henderson et al. [4] and has received considerable attention. Considering a bipartite system AB in a Hilbert space \(\mathcal {H} = \mathcal {H}_{A}\otimes \mathcal {H}_{B}\). For a bipartite quantum state \(\rho \), quantum discord is defined as

$$ \mathcal{Q}(\rho)=\mathcal{I}(\rho)-\mathcal{C}(\rho), $$
(6)

where \(\mathcal {I}(\rho )\) and \(\mathcal {C}(\rho )\) are the quantum mutual information and the measurement-based mutual information. \(\mathcal {I}(\rho )\) is defined by

$$ \mathcal{I}(\rho)=\mathcal{S}(\rho_{A})+\mathcal{S}(\rho_{B})-\mathcal{S}(\rho), $$
(7)

where \(\mathcal {S}(\rho )=-\text {Tr}(\rho \log \rho )\) is the the von Neumann entropy. Here, \(\mathcal {C}(\rho )\) is given by

$$ \mathcal{C}(\rho)=\sup\limits_{\{\mathrm{{\Pi}_{k}\}}}\{\mathcal{S}(\rho_{B})-\sum\limits_{k}p_{k}\mathcal{S}(\rho_{k})\}, $$
(8)

where \(\rho _{k}=\frac {1}{p_{k}}(\mathrm {{\Pi }}_{k}\otimes I)\rho (\mathrm {{\Pi }}_{k}\otimes I)\) is the post-measurement state associated with the outcome k with the probability \(p_{k}=\text {Tr}[(\mathrm {{\Pi }}_{k}\otimes I)\rho (\mathrm {{\Pi }}_{k}\otimes I)]\). Projection operators \(\{\mathrm {{\Pi }}_{k}\}\) describe a von Neumann measurement for subsystem A.

Closed analytic expressions of quantum discord are provided only for some special two-qubit states, such as Bell-diagonal states [35] and X states [36].

Calculating the quantum discord based on a numerical optimization procedure is a hard work, which led Dakić et al. [37] to introduce a geometric quantum discord. The geometric quantum discord of a bipartite quantum state \(\rho \) in Hilbert space \(\mathcal {H}_{A}\otimes \mathcal {H}_{B}\) is defined [37, 38] as

$$ D_{G}(\rho)=\min\limits_{\rho_{cq}\in{\Omega}_{0}}\|\rho-\rho_{cq}\|_{2}^{2}, $$
(9)

where \(\|X\|_{2}=\sqrt {\text {Tr}(X^{\dag }X)}\) denotes the Hilbert-Schmidt norm and \({\Omega }_{0}\) is the set of zero-discord states (classical-quantum states). An arbitrary two-qubit state can be represented by

$$ \rho=\frac{1}{4}(I\otimes I+\sum\limits_{i = 1}^{3}x_{i}\sigma_{i}\otimes I+{\sum\limits_{i}^{3}}I\otimes y_{i}\sigma_{i}+\sum\limits_{i,j = 1}^{3}t_{ij}\sigma_{i}\otimes \sigma_{j}), $$
(10)

with \(x_{i}=\text {Tr}(\rho \sigma _{i}\otimes I),\ y_{i}=\text {Tr}(\rho I\otimes \sigma _{i}),\ t_{ij}=\text {Tr}(\rho \sigma _{i}\otimes \sigma _{j})\) being real parameters, and \(\sigma _{i}\) being Pauli matrices. According to the above equation, geometric quantum discord can be calculated by [37, 38]

$$ D_{G}(\rho)=\frac{1}{4}(\|\mathbf{x}\|^{2}+\|T\|^{2}_{2}-\lambda_{max}), $$
(11)

where \(\mathbf {x}=(x_{1},x_{2},x_{3})^{t}\) is a column vector, \(\|\mathbf {x}\|^{2}={\sum }_{i}{x_{i}^{2}}\), \(T=(t_{ij})\) is a matrix, and \(\lambda _{max}\) is the largest eigenvalue of the matrix \(\mathbf {x}\mathbf {x}^{t}+TT^{t}\).

Actually, there is an alternative concise calculating method of geometric quantum discord, reading [17]

$$ D_{G}(\rho)=\frac{1}{4}(\sum\limits_{i}{\lambda_{i}^{2}}-\max\limits_{i}{\lambda_{i}^{2}}), $$
(12)

with \(\lambda _{i}\) being the singular values of the matrix \(T^{\prime }=(\mathbf {x},T)\), a \(3\times 4\) matrix.

2.3 Quantum Coherence

Quantum coherence resulting from quantum state superpositon is the central feature of quantum mechanics that differentiates quantum world from the classical one, which plays a key role in quantum physics and quantum information processing. Baumgratz et al. [5] introduced a rigorous framework for quantifying coherence and identifying computable measures of coherence. By fixing a particular reference basis \(\{|i\rangle \}\) in the d-dimensional Hilbert space, all density operators of the form

$$ \rho_{I}=\sum\limits_{i = 1}^{d}p_{i}|i\rangle\langle i| $$
(13)

are called incoherent states, and we label this set of quantum states by \(\mathcal {I}\). A quantum operation \(\rho \rightarrow {\sum }_{n} K_{n}\rho K_{n}^{\dagger }\) is called an incoherent operation if the condition \(K_{n} \mathcal {I} K_{n}^{\dagger } \subset \mathcal {I}\) is satisfied for all n. A good measure of quantum coherence C should satisfy the following conditions according to the resource theory [5]:

  1. 1.

    \(C(\rho )= 0\) iff \(\rho \in \mathcal {I}\).

  2. 2.

    Monotonicity under non-selective incoherent completely positive and trace preserving (ICPTP) maps: \(C(\rho )\geq C({\Phi }_{\text {ICPTP}}(\rho ))\), where \({\Phi }_{\text {ICPTP}}(\rho ) ={\sum }_{n} K_{n}\rho K_{n}^{\dagger }\) and \(\{K_{n}\}\) is a set of Kraus operators with \({\sum }_{n} K_{n}^{\dagger } K_{n}=I\) and \(K_{n} \mathcal {I} K_{n}^{\dagger } \subset \mathcal {I}\).

  3. 3.

    Monotonicity under selective measurements on average: \(C(\rho )\geq {\sum }_{n} p_{n} C(\rho _{n})\), where \(\rho _{n}= K_{n}\rho K_{n}^{\dagger }/p_{n}\), \(p_{n}=\text {Tr}(K_{n}\rho K_{n}^{\dagger })\) for all \(\{K_{n}\}\) with \({\sum }_{n} K_{n}^{\dagger } K_{n}=I\) and \(K_{n} \mathcal {I} K_{n}^{\dagger } \subset \mathcal {I}\)

  4. 4.

    Convexity: \({\sum }_{n} p_{n} C(\rho _{n})\geq C({\sum }_{n} p_{n} \rho _{n})\) for any set of states \(\{\rho _{n}\}\) with probability \(p_{n}\geq 0\) and \({\sum }_{n} p_{n}= 1\).

There are several coherence measures that satisfy the above conditions, such as the \(l_{1}\) norm of coherence and relative entropy of coherence [5]. Coherence properties of a quantum state are usually attributed to the off-diagonal elements of its density matrix with respect to a selected reference basis. \(l_{1}\) norm of coherence is a very intuitive quantification of coherence related to the off-diagonal elements of the considered quantum state, given by

$$ C_{l_{1}}(\rho)=\sum\limits_{{i\ne j}}|\rho_{i,j}|. $$
(14)

The relative entropy of coherence is defined according to quantum relative entropy:

$$ C_{R}(\rho)=\min\limits_{\sigma\in\mathcal{I}} S(\rho\|\sigma)=\min\limits_{\sigma\in\mathcal{I}}\{\text{Tr}(\rho\log\rho)-\text{Tr}(\rho\log\sigma)\}. $$
(15)

There is a closed evaluating expression for \(C_{R}\), given by

$$ C_{R}(\rho)=S(\rho_{diag})-S(\rho), $$
(16)

where \(\rho _{diag}={\sum }_{i}\langle i|\rho |i\rangle |i\rangle \langle i|\) and S denotes the von Neumann entropy.

3 Package Overview

The computing package is developed based on the computer algebra system, i.e. Maple 17. Maple is a powerful math computation software, which makes education and research more easily and efficiently. Maple offers convenient symbolic calculating functionality, abundant built-in functions and strong drawing functions. Our program is written as a text-based file format: MPL (Maple Language File). MPL files can be executed using the read statement. Copy the base.mpl to a special path, such as D:∖. Open a Maple documents (MW format) file and write:

$$\begin{array}{@{}rcl@{}} &&read('D:\backslash\backslash base.mpl^{\prime}):\\ &&with(base): \end{array} $$

Our program is written mainly based on the LinearAlgebra package and the Feynman package. Firstly, Our program package includes some common operators (matrices) and operator lists.

  1. 1.

    \(\mathbf {\sigma _{1},\sigma _{2},\sigma _{3}}\) are the standard Pauli operators.

  2. 2.

    \(\mathbf {a0=(1,0)^{T}}\) and \(\mathbf {a1=(0,1)^{T}}\) are the commonly used computational base in two-dimensional Hilbert space. Here, we do not use the subscript form because a is often used as a variable in calculation and this is done to avoid confusion.

  3. 3.

    \(\mathbf {I_{2}, I_{3}, I_{4}}\) are the \(2\times 2, 3\times 3, 4\times 4\) identity operators.

  4. 4.

    \(\mathbf {bases=[I_{2},\sigma _{1},\sigma _{2},\sigma _{3}]}\) and \(\mathbf {Paulis=[\sigma _{1},\sigma _{2},\sigma _{3}]}\) are the common operators lists.

Secondly, we make a brief description of each function.

  1. 1.

    KK(l): returns the tensor product of a matrix list. This is a generalization to KroneckerProduct function of LinearAlgebra package.

  2. 2.

    Kρ(ϕ): returns the density matrix of a pure state \(\phi \), which is a succinct and useful function.

  3. 3.

    CJ(m): returns the conjugate of a matrix m.

  4. 4.

    DV(v,p): computes derivative vector of vector function. Parameter v is a vector composed of functions. Parameter p is the derivative variable. This function is useful in computing quantum Fisher information and other evaluation.

  5. 5.

    HL(l,x): returns the value of \(x\log _{l}x\). This function is useful in computing entropy and quantum correlation.

  6. 6.

    HE(x): computes classical entropy \(-HL(2,1-x)-HL(2,x)\), the function is used in computing quantum correlation.

  7. 7.

    entropy(ρ): computes the von Neumann entropy \(-\text {Tr}(\rho \log \rho )\), which calls the function HL(l,x) and is used in computing quantum discord and relative entropy of coherence, and other evaluation. The function is different from the entropy function defined in Feynman package, since the entropy function of the Feynman package employs base-2 logarithm, and yet our entropy function employs base-d logarithm.

  8. 8.

    BaseNumber(ρ,n1,base1,n2,base2): returns the coefficients of the representational form with \(SU(n)\) generators of density matrix of a single system or a bipartite system. When \(n1 = 0\) or \(n2 = 0\), returns the coefficients of one system with vector form; When \(n1\neq 0\) and \(n2\neq 0\), returns the coefficients of a bipartite system with matrix form. Parameter base1 and base2 are \(SU(n)\) generators list. The function is very convenient and useful in obtaining density matrix representation versus \(SU(n)\) algebra, such as the Bloch representation of two-qubit state, and computing quantum correlation, such as geometric quantum discord.

  9. 9.

    DC1(ρ,E): returns a density matrix of one system under decoherence. Parameter \(\rho \) is the system initial state, and E is the Kraus operator list. In realistic world, decoherence is a non-unitary evolution that results from the interaction between the system and the environment. Quantum operation provides a way to describe the evolution of quantum states in a noisy environment. A quantum operation, \({\Phi }\), is a trace-preserving and completely positive linear map (\({\sum }_{i}E_{i}^{\dag }E_{i}=I\)), that can be expressed in Kraus operator sum [39] as \({\Phi }(\rho )={\sum }_{i}E_{i}\rho E_{i}^{\dag }\). Compared with the quantum operation functions in the Feynman package [28], our function can perform calculation for multidimensional system more flexibly.

  10. 10.

    DC2(ρ,E,F): returns a density matrix of a bipartite system under decoherence. Parameter \(\rho \) is the system initial state, and E and F are Kraus operator lists corresponding to two subsystem. That is to say, it returns the density matrix \({\Phi }(\rho )={\sum }_{i,j}(E_{i}\otimes F_{j})\rho (E_{i}\otimes F_{j})^{\dag }\). Our function can better support the calculation of multidimensional and two-party system than the quantum operation function in Feynman package [28] which is mainly suitable for two-dimensional qubit systems.

  11. 11.

    DC3(ρ,E,F,G): returns a density matrix of a tripartite system under decoherence. Parameter \(\rho \) is the system initial state, and E, F and G are Kraus operator lists corresponding to three subsystems. That is to say, it returns the density matrix \({\Phi }(\rho )={\sum }_{i,j,k}(E_{i}\otimes F_{j}\otimes G_{k})\rho (E_{i}\otimes F_{j}\otimes G_{k})^{\dag }\).

  12. 12.

    VI(E,F): verifies whether \({\sum }_{i,j}(E_{i}\otimes F_{j})^{\dag }(E_{i}\otimes F_{j})=I\).

  13. 13.

    negativity(ρ,d1,d2): computes negativity according to (3). Parameter d1 and d2 are the subsystem dimension of a bipartite system. Our function is more efficient than the corresponding function in the Feynman package [27]. We rewrite the negativity function because the corresponding function in the Feynman package often can not get the expected results when the system is in high dimension, and our function can better support the computation of three or higher dimensional systems.

  14. 14.

    CRX(ρ): computes the concurrence of two-qubit X states. Our function is more efficient than the corresponding function in the Feynman package [27] when the X state is complicated. We find that when the density matrix of X state includes relatively more parameters, the computing concurrence command in the Feynman package often does not obtain the expected results, so we rewrite the function for computing concurrence of X states with simple special algorithm (see the presentation in Section 2.1).

  15. 15.

    QDB(ρ): computes the quantum discord of Bell-diagonal state. The function is written based on the algorithm of Ref. [35].

  16. 16.

    QDX(ρ): computes the quantum discord of two-qubit X states. The function is written based on the algorithm of Ref. [36].

  17. 17.

    QDX2(ρ): computes the quantum discord of two-qubit X states. The function is written based on the algorithm of Ref. [40].

  18. 18.

    GQD(ρ,base1,base2): computes the geometric quantum discord of a \(2\times n\) bipartite system. \(\rho \) is the density operator of a \(2\times n\) bipartite system, base1 is the bases list defined as above, and base2 is a list composed of identity operator and \(SU(n)\) generators. The function algorithm is a generalization of (12).

  19. 19.

    QFI(ρ,p): performs calculation of quantum Fisher information (QFI) according to Eq. (9) of Ref. [41]. \(\rho \) is the input state and p is the estimated parameter. QFI is significant in quantum metrology and quantum information theory. QFI plays an important role in quantum statistical inference through its inextricable relationship with Cram\(\acute {e}\)r-Rao inequality [42, 43] which limits the precision of the estimator from optimal data processing. Moreover, QFI also has various applications in other quantum information tasks such as characterization of non-Markovianity [44], investigation of uncertainty relations [45, 46], and entanglement detection [47], and so on.

  20. 20.

    QFI2(v,p): performs the calculation of QFI of one-qubit states according to Eq. (11) of Ref. [48]. v is the Block vector of the input qubit states and p is the estimated parameter.

  21. 21.

    L1NC(ρ): computes \(l_{1}\) norm of coherence, according to (14).

  22. 22.

    REC(ρ): computes relative entropy of coherence, according to (16).

  23. 23.

    L1N(ρ): computes \(l_{1}\) norm, i.e., returns the value of \({\sum }_{i,j}|\rho _{ij}|\).

  24. 24.

    DM(ρ,p): calculates partial differential of a matrix function. p is the derivative variable. The function is used in computing QFI and for other calculation, for example, solving the master equation of an evolution system.

  25. 25.

    QFI3(ρ,p): performs the calculation of QFI according to Eq. (6) of Ref. [49]. \(\rho \) is the two-dimensional density matrix; p is the estimated parameter.

  26. 26.

    GQD1(ρ): computes the trace-norm (Schatten 1-norm) geometric quantum discord of X states according to Eq. (15) of Ref. [50]. \(\rho \) is the density matrix of the X state. The trace norm geometric quantum discord satisfies reasonable criteria expected for correlation measures [51, 52], unlike the above mentioned geometric quantum discord based on Hilbert-Schmidt norm which lacks of contractivity under trace-preserving maps.

  27. 27.

    GQD2(ρ): computes the trace-norm (Schatten 1-norm) geometric quantum discord of Bell-diagonal states [53]. Compared with function GQD1, the function is simpler for computing the trace-norm geometric quantum discord of Bell-diagonal states.

  28. 28.

    QIP1(ρ): computes quantum interferometric power for \(2\otimes n\) quantum systems [54]. Quantum interferometric power is a measure of quantum correlation, which is defined by QFI.

  29. 29.

    QIP2(ρ): computes quantum interferometric power for \(n\otimes 2\) quantum systems [55].

  30. 30.

    LQU(ρ): computes local quantum uncertainty for \(2\otimes n\) quantum systems [56]. Local quantum uncertainty allows us to define and investigate a class of measures of bipartite discord-type quantum correlations.

  31. 31.

    MIN(ρ): computes measurement-induced nonlocality for \(2\otimes 2\) quantum systems [57]. Measurement-induced nonlocality is dual to the geometric quantum discord [37, 38].

4 Some Examples

In this section we demonstrate several applications of our package, which is similar to those studied results in some recent literatures. Our emphasis is on illustrating how to use the package rather than producing new results. The present package can be applied to computing quantum resources measures and dynamics of open system in many cases, and is able to reproduce results in many related literatures and produce new results, for example, our recent papers [58,59,60,61,62,63].

4.1 Example 1: Quantum Correlation Under Noisy Channels

In a realistic situation, the quantum systems have a nontrivial dynamics because their interaction with the environment may disturb the important properties of quantum information. Here, we investigate the dynamics of quantum correlation measures in two typical noise channels for two-qubit Bell-diagonal states. We first set the variable range

$${ assume} (0\leq p\leq 1,-1\leq c_{{1}} \leq 1,-1\leq c_{{2}}\leq 1,-1\leq c_{{3}}\leq 1 ) $$

Then a Bell-diagonal state is written as

$$\rho := simplify(\frac{1}{4}(I_{4}+\sum\limits_{i = 1}^{3}(c_{i}\ 'KK([\sigma_{i}, \sigma_{i}])')) $$
$$\begin{array}{@{}rcl@{}} \begin{array}{ccccccccccccccc}\left[ \begin {array}{cccc} \frac{1}{4}+\frac{1}{4}\,c_{{3}}&0&0&\frac{1}{4}\,c_{{1}}-\frac{1}{4}\,c_{{2}}\\ \noalign{}0&\frac{1}{4}-\frac{1}{4}\,c_{{3}}&\frac{1}{4}\,c_{{1}}+\frac{1}{4}\,c_{{2}} &0\\ \noalign{}0&\frac{1}{4}\,c_{{1}}+\frac{1}{4}\,c_{{2}}&\frac{1}{4}-\frac{1}{4}\,c_{{3}}&0 \\ \noalign{}\frac{1}{4}\,c_{{1}}-\frac{1}{4}\,c_{{2}}&0&0&\frac{1}{4}+\frac{1}{4}\,c_{{3}} \end{array} \right]\end{array} \end{array} $$

Then the system travels through the phase damping channel:

$$\begin{array}{cccccccccccc} &E:=\left[\left[ \begin {array}{cc} 1&0\\ \noalign{}0&\sqrt {1-p} \end{array} \right],\left[ \begin {array}{cc} 0&0\\ \noalign{}0&\sqrt {p} \end{array} \right] \right]:&\\ &\rho f:= DC2(\rho, E, E): \end{array}$$

Doing some simplification, we have the final evolution density matrix:

$$\begin{array}{ccccccc} \rho f:=\frac{1}{4}\left[\begin{array}{cccc} 1+c_{3}&0&0&(1-p)(c_{1}-c_{2})\\ 0&1-c_{3}&(1-p)(c_{1}+c_{2}) &0\\ 0&(1-p)(c_{1}+c_{2}) &1-c_{3}&0\\ (1-p)(c_{1}-c_{2})&0&0&1+c_{3} \end{array} \right]:& \end{array}$$

which is equal to Eq. (5) of Ref. [15] that is a Bell-diagonal state. With the function QDB, we obtain quantum discord of the Bell-diagonal state:

$$Q\rho:={ QDB} (\rho f ): $$

With the function Feynman_measures, we have the mutual information

$$I\rho:=Feynman\_measures(^{\prime\prime}mutual\ information^{\prime\prime},{ qregister} ({ id},2,\rho f ) ,[1],[2] ): $$

By the function GQD, we have the the geometric quantum discord

$$G\rho:={ GQD} (\rho f,{ bases},{ bases} ):$$
$$\begin{array}{@{}rcl@{}} &&\frac{1}{4}\,{p}^{2}{c_{{1}}}^{2}+\frac{1}{4}\,{p}^{2}{c_{{2}}}^{2}-\frac{1}{2}\,p{c_{{1}}}^{2 }-\frac{1}{2}\,p{c_{{2}}}^{2}+\frac{1}{4}\,{c_{{1}}}^{2}+\frac{1}{4}\,{c_{{2}}}^{2}+\frac{1}{4}\,{c_{{ 3}}}^{2}\\ &&-\frac{1}{4}\,\max ({c_{{3}}}^{2},{c_{{1}}}^{2} (-1+p )^{2},{c_{{2}}}^{2} (-1+p )^{2} ) \end{array} $$

We plot the dynamics of quantum discord (solid line), mutual information (dot line), classical correlations (dash line), and geometric quantum discord (dashdot line) as functions of t for \(c_{1}= 1,c_{2}=-\frac {3}{5},c_{3}=\frac {3}{5}\).

$$\begin{array}{@{}rcl@{}} plot&&([subs(p = 1-\text{e}^{-2t}),c_{1}= 1,c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},Q\rho),subs(p = 1-\text{e}^{-2t},\\ &&c_{1}= 1,c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},I\rho),subs(p = 1-\text{e}^{-2t},c_{1}= 1,\\ &&c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},Q\rho-I\rho),subs(p = 1-\text{e}^{-2t},c_{1}= 1,\\ &&c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},G\rho)],t = 0..8,linestyle=[solid,dot,dash,dashdot]) \end{array} $$
figure a

The figure above is similar to Fig. 1 of Ref. [15]. Here ,we take \(\gamma = 1\). From the figure above, we can see geometric quantum discord has a sudden transition, which results from the maximization process in computing geometric quantum discord.

We continue to study dynamic of the system in amplitude damping channel.

$$\begin{array}{ccccccc} &E:=\left[\left[ \begin {array}{cc} 1&0\\ \noalign{}0&\sqrt {1-p} \end{array} \right],\left[ \begin {array}{cc} 0&\sqrt{p}\\ \noalign{}0&0 \end{array} \right] \right]:&\\ &\rho f:= DC2(\rho, E, E): \end{array}$$

By simple simplification, we have the final evolution state in amplitude damping channel:

$$\begin{array}{ccccccccccc} &\rho f:=\frac{1}{4}\left[\begin {array}{cccc} p^{2}(1+c_{3})&0&0&0\\ 0&p(1-p)(1+c_{3})&0 &0\\ 0&0 &p(1-p)(1+c_{3})&0\\ 0&0&0&(1-p)^{2}(1+c_{3}) \end{array} \right]:& \end{array}$$

The state is an X state. With functions QDX, GQD and CRX, we have quantum discord, geometric quantum discord and concurrence, respectively:

$$\begin{array}{@{}rcl@{}} &&Q\rho:={QDB} (\rho f ):\\ &&G\rho:={GQD} (\rho f,{ bases},{ bases} ):\\ &&Cr:={ CRX} (\rho f ): \end{array} $$

We plot the dynamics of quantum discord (solid line), geometric quantum discord (dash line), and concurrence (dot line) as functions of p for \(c_{1}= 1,c_{2}=-\frac {3}{5},c_{3}=\frac {3}{5}\).

$$\begin{array}{@{}rcl@{}} plot&&([subs(c_{1}= 1,c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},Q\rho),subs(c_{1}= 1,c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},G\rho),\\ &&subs(c_{1}= 1,c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},Cr)],p = 0..1,linestyle=[solid,dash,dot]) \end{array} $$
figure b

This result is the same as the result described in Fig. 4 of Ref. [18] when correlated parameter \(u = 0\).

4.2 Example 2: Quantum Coherence Under Amplitude Damping Channel

Noise can cause the destruction of quantum superpositions that result in quantum coherence. According to the above result, with function L1NC and REC, we have the l1 norm of coherence and relative entropy of coherence, respectively:

$$\begin{array}{@{}rcl@{}} &&L1:={ L1NC} (\rho f ):\\ &&Rc:={ REC} (\rho f ): \end{array} $$

We plot the dynamics of \(l_{1}\) norm of coherence (solid line), and relative entropy of coherence(dash line) as functions of p for \(c_{1}= 1,c_{2}=-\frac {3}{5},c_{3}=\frac {3}{5}\).

$$\begin{array}{@{}rcl@{}} plot&&([subs(c_{1}= 1,c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},L1),subs(c_{1}= 1,c_{2}=-\frac{3}{5},c_{3}=\frac{3}{5},Rc)],\\ &&p = 0..1,linestyle=[solid,dash]) \end{array} $$
figure c

From the figure above, we can see \(l_{1}\) norm of coherence presents a linear decrease with decoherence parameter p. However relative entropy of coherence nonlinearly decreases with decoherence parameter p.

4.3 Example 3: QFI in Noninertial Frames

Here, we analyse the behaviors of QFI under the Unruh-Hawking effect. In the context of relativistic quantum information theory, QFI as an important measure of the quantum information content, has rich and subtle physical structures. Suppose that two-qubit pure states are given by

$$\varphi:=\cos (\theta ) { KK} ([{ a0},{ a0}] ) +\sin (\theta ) {\mathrm{e}^{i\phi}}{ KK} ([{ a1},{ a1}] ): $$

The unknown arguments \(\theta \) and \(\phi \) are to be estimated. With the function QFI, we can easily obtain the QFI with respect to \(\theta \) and \(\phi \) as

$$F\theta:={ QFI} (K\rho (\varphi ) ,\theta ) $$
$$4 $$
$$F\phi:={ QFI} (K\rho(\varphi) ,\phi ) $$
$$4\, \sin (\theta )^{2} \cos (\theta )^{2} $$

which is the same as Eq. (12) of Ref. [41]. Through the Unruh channel for the Dirac case, according to Eq. (29) of Ref. [41], we can get the reduced density matrix of the system

$$\begin{array}{@{}rcl@{}} &&\varphi:=\cos (\theta ) { KK} ([{ a0},\cos (r ) { KK} ([{ a0},{ a0}] ) +\sin (r ) { KK} ([{ a1},{ a1}] ) ] ) \\ && +\sin (\theta ) {\mathrm{e}^{i\phi}}{ KK} ([{ a1},{ a1},{ a0}] )):\\ &&\rho:={ simplify} ({ Feynman\_evaluate} (^{\prime\prime}partial\ trace^{\prime\prime},K\rho (\varphi ) ,[2,2,2],[3] ) ):\\ &&Feynman\_print(\rho) \end{array} $$
$$\begin{array}{@{}rcl@{}} &&(1- \cos (\theta )^{2} ){\mathtt{ |11><11|}}+ (- \cos (\theta )^{2} \cos (r )^{2}+ \cos (\theta )^{2} ) {\mathtt{|01><01|}}\\ &&+ \cos (\theta )^{2} \cos (r )^{2}{\mathtt{|00><00|}}+\cos (\theta ) \cos (r )\sin (\theta ) {\mathrm{e}^{-i\phi}}{\mathtt{|00><11|}}\\ &&+\sin (\theta ) {\mathrm{e}^{i\phi}}\cos (\theta ) \cos (r ) {\mathtt{|11><00|}} \end{array} $$

By simple simplification, the equation above is equal to Eq. (30) of Ref. [41]. With the function QFI, we can easily obtain the QFI with respect to \(\phi \) as

$$F\phi:={ QFI} (\rho ,\phi ) $$
$$-4\,{\frac { \cos (\theta )^{2}\cos (r )^{2} (-1+ \cos (\theta )^{2} ) }{ \cos (\theta )^{2} \cos (r )^{2}- \cos (\theta )^{2}+ 1}} $$

This equation is equal to Eq. (36) of Ref. [41]. The contour plot of \(F\phi \) as a function of the acceleration parameter r and \(\theta \) is given by

$$\begin{array}{@{}rcl@{}} &&with(plots):\\ &&contourplot(F\phi ,\theta= 0..\frac{\pi}{2},r = 0..\frac{\pi}{4},filledregions= true,\\ &&contours=[ 0.1, 0.3, 0.5, 0.7, 0.9] ) \end{array} $$
figure d

The figure above is the same as the Fig. 2 of Ref. [41].

4.4 Example 4: QFI in Non-Markovian Noisy Environment

Due to the memory effect, in non-Markovian environment, reversible decay appears and information flow can return to the system from environment. Now consider that the state \(\varphi \) is effected by Non-Markovian environment [64]. The state becomes

$$\begin{array}{@{}rcl@{}} \psi&:=&\sin { \theta } {\mathrm{e}^{i\phi}} { \sqrt{p}{ KK} { [{ a1},{ a0}] } + \sqrt{1-p}{ KK} { [{ a0},{ a1}] } }\\ &&+cos { \theta } { KK} { [{ a0},{ a0}] } \end{array} $$
$$\left[ \begin{array}{c} \cos { { \theta} }\\ \noalign{}\sin { {\theta} } {\mathrm{e}^{\mathrm{i}{ \phi}}}\sqrt {1-p}\\ \noalign{}\sin { { \theta} }{\mathrm{e}^{\mathrm{i}{ \phi}}}\sqrt {p}\\ \noalign{}0\end{array} \right] $$

By taking the partial trace over the environment, the reduced density matrix of the system state is given by

$$\begin{array}{@{}rcl@{}} &&\rho:=\left[ \begin {array}{cc} \cos { { \theta} }^{2}p-p + 1&\cos { { \theta} } \sin { { \theta} } {\mathrm{e}^{-\mathrm{i}{ \phi}}}\sqrt {p}\\ \noalign{}\sin { { \theta} } {\mathrm{e}^{\mathrm{i}{ \phi}}}\sqrt {p}\cos { { \theta} } & \sin { { \theta} }^{2}p\end{array} \right]: \end{array} $$

The density operator above includes three parameters. We find that it is hard to compute QFI with the function QFI. But due to being the case of single qubit, with function QFI2, we can obtain the QFI easily. Firstly, by function BaseNumber, the Block vector of the matrix is

$$v:={ BaseNumber} (\rho ,2,{ Paulis},0,{ Paulis} ) $$
$$\left[ \begin{array}{c} 2\,\cos { { \theta} } \sin { { \theta} } \sqrt {p}\cos { { \phi} }\\ \noalign{}2\,\sqrt {p}\sin { { \theta} } \cos { { \theta} } \sin { { \phi} }\\ \noalign{}2\, \cos { { \theta} }^{2}p-2\,p + 1\end{array} \right] $$

Secondly with the function QFI2, we can quickly obtain the QFI with respect to \(\theta \) and \(\phi \) as

$$F\theta:={ QFI2} (v ,\theta ) $$
$$4p $$
$$F\phi:={ QFI2} (v ,\phi ) $$
$$4p\, \cos { \theta }^{2} \sin { \theta }^{2} $$

From the formula above, It is easily seen that \(F_{\phi }\) is symmetric with respect to \(\theta =\frac {\pi }{4}\).

figure e

The figure above depicts the behaviors of \(F\theta \) (Fig. (a)) as a function of dimensionless quantity \(\gamma _{0}t\) and \(F\phi \) (Fig. (b)) as a function of dimensionless quantity \(\gamma _{0}t\) and amplitude parameter \(\theta \) in non-Markovian regime (\(\lambda =\frac {1}{20}\gamma _{0}\)) [64]. We can observe that QFI periodically vanishes according to the zero points of the function \(p_{t}\) [64], with a damping of revival. The revival phenomenon results from the memory effect of non-Markovian reservoir. By changing the parameter \(\lambda \), it is easily found that the stronger non-Markovian memory effect yields the larger revival height. With the increasing of parameter \(\gamma _{0}t\), the revival height drops off asymptotically.

5 Conclusion

In the present work, we have described our function package and given some examples for demonstrating how to use the function package. From these examples, it can be seen that our package greatly simplifies the process of calculation, and allows us to better understand physical processes and focus on physical applications at hand. We will further improve and extend our package in the future so that the package has a much wider variety of applications in research and education. For example, we will implement more common functions for computing quantum resource measures.