qojulia / QuantumCumulants.jl

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

Latex displays wrong expression #217

Open oameye opened 1 week ago

oameye commented 1 week ago
using QuantumCumulants
using ModelingToolkit

# Hilbertspace
hc = FockSpace(:cavity)

# Operators
@qnumbers a::Destroy(hc)

# Parameters
@variables Δ::Real U::Real G::Real κ::Real

# Hamiltonian
H = -Δ * a' * a + U * a' * a + U * a' * a' * a * a / 2 - G * (a' * a' + a * a) / 2

# Jump operators & rates
J = [a]
rates = [κ];

# Derive equations
ops = [a']
eqs = meanfield(ops, H; order=1)

# Complete equations
eqs_completed = complete(eqs)

displays in my notebook image However, in the repl: image

It forgets to print the bracket in the latex output

david-pl commented 1 week ago

My guess, without checking in detail: since the latest release, complex number expressions are not always <: Symbolic{CNumber} anymore, but <: Symbolic{Complex{Real}}, so our latexify recipe doesn't apply anymore. If that's the case, the problem is that we shouldn't fix it here but in Symbolics since defining a latexify recipe for Symbolic{Complex{Real}} here would be type piracy.