qojulia / QuantumCumulants.jl

Generalized mean-field equations in open quantum systems
Other
70 stars 13 forks source link

Simplify expressions #127

Closed albertomercurio closed 1 year ago

albertomercurio commented 1 year ago

Hello,

I want to find a simplify method for this simple test code

using QuantumCumulants

# Define hilbert space
hf = FockSpace(:cavity)
ha = NLevelSpace(:atom,(:g,:e))
h = hf ⊗ ha

# Define the fundamental operators
@qnumbers a::Destroy(h) σ::Transition(h,:g,:e)

σm = σ
σp = σ'
sz = σp * σm - σm * σp

sz

which returns (-1+σee+σee) instead of (-1+2*σee). Is there a way to simplify it?

ChristophHotter commented 1 year ago

Hi @albertomercurio, Yes you can use QuantumCumulants.simplify(sz). I will export this function at the next release that you can use simplify(sz).

albertomercurio commented 1 year ago

I'm using the stable version, but it says that QuantumCumulants.simplify doen't exist. Is it present only in the dev release?

ChristophHotter commented 1 year ago

Sorry my mistake. using Symbolics and then simplify(sz) should work.

If you do average(sz), it would also simplify the expression (but with expectation values in the expression).

albertomercurio commented 1 year ago

Perfect, it works perfectly! Thanks.