Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate and add docs for Gaussian objects containing symbolic variables #43

Open
apkille opened this issue Feb 4, 2025 · 1 comment · Fixed by #44
Open

Validate and add docs for Gaussian objects containing symbolic variables #43

apkille opened this issue Feb 4, 2025 · 1 comment · Fixed by #44

Comments

@apkille
Copy link
Owner

apkille commented Feb 4, 2025

See qojulia/QuantumOpticsBase.jl#184 for a discussion. Symbolic variables from Symbolics.jl actually integrate quite nicely with Gabs:

julia> using Symbolics

julia> @variables r θ τ
3-element Vector{Num}:
 r
 θ
 τ

julia> b = QuadBlockBasis(2); st = eprstate(b, r, θ); op = beamsplitter(b, τ);

julia> newst = ptrace(op * st, 1)
GaussianState for 1 mode.
  symplectic basis: QuadBlockBasis
mean: 2-element Vector{Num}:
 0
 0
covariance: 2×2 Matrix{Num}:
 (0.5cosh(2r)*sqrt(1 - τ) - 0.5cos(θ)*sinh(2r)*sqrt(τ))*sqrt(1 - τ) + (0.5sqrt(τ)*cosh(2r) - 0.5cos(θ)*sinh(2r)*sqrt(1 - τ))*sqrt(τ)                                                                                                   -sinh(2r)*sin(θ)*sqrt(τ)*sqrt(1 - τ)
                                                                                                -sinh(2r)*sin(θ)*sqrt(τ)*sqrt(1 - τ)     (0.5cosh(2r)*sqrt(1 - τ) + 0.5cos(θ)*sinh(2r)*sqrt(τ))*sqrt(1 - τ) + (0.5sqrt(τ)*cosh(2r) + 0.5cos(θ)*sinh(2r)*sqrt(1 - τ))*sqrt(τ)

julia> using Latexify

julia> latexify(newst.covar)
L"\begin{equation}
\left[
\begin{array}{cc}
\left( 0.5 \cosh\left( 2 r \right) \sqrt{1 - \tau} - 0.5 \cos\left( \theta \right) \sinh\left( 2 r \right) \sqrt{\tau} \right) \sqrt{1 - \tau} + \left( 0.5 \sqrt{\tau} \cosh\left( 2 r \right) - 0.5 \cos\left( \theta \right) \sinh\left( 2 r \right) \sqrt{1 - \tau} \right) \sqrt{\tau} &  - \sinh\left( 2 r \right) \sin\left( \theta \right) \sqrt{\tau} \sqrt{1 - \tau} \\
 - \sinh\left( 2 r \right) \sin\left( \theta \right) \sqrt{\tau} \sqrt{1 - \tau} & \left( 0.5 \cosh\left( 2 r \right) \sqrt{1 - \tau} + 0.5 \cos\left( \theta \right) \sinh\left( 2 r \right) \sqrt{\tau} \right) \sqrt{1 - \tau} + \left( 0.5 \sqrt{\tau} \cosh\left( 2 r \right) + 0.5 \cos\left( \theta \right) \sinh\left( 2 r \right) \sqrt{1 - \tau} \right) \sqrt{\tau} \\
\end{array}
\right]
\end{equation}
"
$$\begin{equation} \left[ \begin{array}{cc} \left( 0.5 \cosh\left( 2 r \right) \sqrt{1 - \tau} - 0.5 \cos\left( \theta \right) \sinh\left( 2 r \right) \sqrt{\tau} \right) \sqrt{1 - \tau} + \left( 0.5 \sqrt{\tau} \cosh\left( 2 r \right) - 0.5 \cos\left( \theta \right) \sinh\left( 2 r \right) \sqrt{1 - \tau} \right) \sqrt{\tau} & - \sinh\left( 2 r \right) \sin\left( \theta \right) \sqrt{\tau} \sqrt{1 - \tau} \\\ - \sinh\left( 2 r \right) \sin\left( \theta \right) \sqrt{\tau} \sqrt{1 - \tau} & \left( 0.5 \cosh\left( 2 r \right) \sqrt{1 - \tau} + 0.5 \cos\left( \theta \right) \sinh\left( 2 r \right) \sqrt{\tau} \right) \sqrt{1 - \tau} + \left( 0.5 \sqrt{\tau} \cosh\left( 2 r \right) + 0.5 \cos\left( \theta \right) \sinh\left( 2 r \right) \sqrt{1 - \tau} \right) \sqrt{\tau} \\\ \end{array} \right] \end{equation}$$

So it would be great to make these features accessible in the tutorials section of the documentation, and add tests for them so they don't break in the future.

Fe-r-oz added a commit to Fe-r-oz/Gabs.jl that referenced this issue Feb 4, 2025
apkille added a commit that referenced this issue Feb 7, 2025
…c variables (#44)

* resolve #43 Validate and add docs for Gaussian objects containing symbolic variables

* fix extra space

* Symbolic squeezed states

* Symbolic coherent states

* remove stupid mistake - add Symbolics to tests and docs, Latexify to docs

* add Missings to typos

* remove Latexify as dependency - just use it in docs via doc project toml

* polish

* shift documentation from manual to tutorial

* fix small typo

* Update docs/src/tutorials.md

Co-authored-by: Andrew Kille <[email protected]>

* Update docs/src/tutorials.md

Co-authored-by: Andrew Kille <[email protected]>

* Update docs/src/tutorials.md

Co-authored-by: Andrew Kille <[email protected]>

* add codereview suggestions: improve tutorial

* add codereview suggestions: use rs and thetas for squeezedstates

* add code review suggestion: alphas for coherent state

* add code review suggestion: remove redundancy in EPR tests

* symbolic tensor products :)

* fix the doctest error that was causes by using Latexify in doctest

* Symbolic thermal states and tests

* undo a change to project toml

* use float(eltype(P) so thermal states work with symbolic and ints etc

* Update docs/src/tutorials.md

Co-authored-by: Andrew Kille <[email protected]>

* Update docs/src/tutorials.md

Co-authored-by: Andrew Kille <[email protected]>

* Update docs/make.jl

Co-authored-by: Andrew Kille <[email protected]>

* Create .gitignore

Add manifest in .gitignore

* rm the first test set

* add some tests from removed testset 1 to testset2

* don't show output of newst.covar in doctest, we are already doing it afterwards

* polish testset 1

* Delete Manifest.toml

---------

Co-authored-by: Andrew Kille <[email protected]>
@Fe-r-oz
Copy link
Contributor

Fe-r-oz commented Feb 10, 2025

Following the completing of #44, the TODOs are:

I have submitted a basic attempt for TODO 1 at #46 :) Thank you so much for support and help in reviewing the PRs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants