Add new Julia tutorial (continuing work from #5254) - #5557
Conversation
…5254) ### Summary Julia is a dynamic language designed for high-performance numerical and scientific computing, making it a natural fit for quantum simulation workflows. The tutorial shows how Julia is used for both classical pre- and post-processing (e.g., building Hamiltonians, running ODE solvers, computing expectation values) and for orchestrating quantum hardware jobs, eliminating the need to switch between languages or environments. The example used in this tutorial is simulating time evolution of the transverse-field Ising model. To interface with IBM Quantum hardware from Julia, this tutorial uses two packages from the Qiskit ecosystem: `Qiskit.jl` wraps the Qiskit C API and provides circuit construction and transpilation functionality in Julia; `QiskitIBMRuntime.jl` connects to IBM Quantum hardware through the Qiskit IBM Runtime service, enabling job submission and result retrieval directly from Julia. ### Files The PR adds the following files: - the notebook `docs/tutorials/time-evolution/time-evolution.ipynb` - the files `docs/tutorials/time-evolution/Project.toml` and `docs/tutorials/time-evolution/Manifest.toml`, which are needed to set up the Julia environment and install the dependencies to run the notebook. --------- Co-authored-by: ABBY CROSS <across@us.ibm.com> Co-authored-by: Jim Garrison <garrison@ibm.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
One or more of the following people are relevant to this code:
|
henryzou50
left a comment
There was a problem hiding this comment.
Thanks for the updates @haimeng-zhang, overall the tutorial looks great! I do have some minor suggestions:
-
Background text still has the old factor-of-2: the Background cell says each Trotter step applies
$R_x(h_i\Delta\tau/2)$ , but since$R_x(\theta) = e^{-i\theta X/2}$ , the half-step needs$\theta = h_i\Delta\tau$ , which is what the corrected code now does. Both mentions should read$R_x(h_i\Delta\tau)$ . (The$R_{ZZ}(2J_{ij}\Delta\tau)$ part is correct.) -
Two saved outputs are stale: the
printlnstrings in two cells were edited after the notebook was last run, so the saved outputs still show the old text. To fix, edit the saved output text to match the current code (no re-run needed, since only the print strings changed):- In the tensor-network fidelity cell (the loop printing
"fidelity at Trotter step $(r) was $(fidelity)"), the saved output still readsfidelity at trotter step ..., capitalize "trotter" -> "Trotter" in the output lines. - In the N=60 tensor-network reference cell, the code says
println("Tensor-network reference:")but the saved output still readsConverged tensor-network reference:- change the output line toTensor-network reference:.
- In the tensor-network fidelity cell (the loop printing
-
Small copyedits:
- Comma splice in Requirements: "developed with Julia 1.11, one can install…" -> "…Julia 1.11; install it with
juliaup add 1.11" - Doubled
# #comment marker in thesave_countscell - "Github" -> "GitHub" in Next steps
- Comma splice in Requirements: "developed with Julia 1.11, one can install…" -> "…Julia 1.11; install it with
@abbycross one thing I noticed on the infra side: the two plot images don't show up in the PR preview, the "Output:" blocks for both plot cells render empty. The extracted SVGs are deployed correctly; the problem is in the notebook itself. IJulia/Plots.jl saves each plot output with two representations: a text/html entry (an <img> with a ~50 KB base64 data-URI PNG) alongside the text/plain entry that ./fix rewrites to the <Image src="...svg" /> tag. The site renderer prefers text/html when present, and the data-URI <img> gets sanitized away, so nothing renders. I tried tox -e fix as usual, but it doesn't help as it extracts the SVG and rewrites text/plain but leaves the stale text/html entry in place (Python notebooks never hit this since matplotlib emits image/png/image/svg+xml directly). I think a fix for this PR is to delete the text/html key from the two plot outputs (also shrinks the notebook by ~120 KB). Longer term, we could have the notebook normalizer strip text/html from outputs it extracts images from, since any future Julia notebook will hit the same issue.
|
Ah, we need to look more closely at how to handle the toml files, and the additional directory added here. We might need to rethink how to support that content. @kaelynj thoughts? |
No description provided.