Skip to content

Add Julia tutorial for simulating time evolution of the Ising model#5254

Open
haimeng-zhang wants to merge 16 commits into
Qiskit:mainfrom
haimeng-zhang:julia-tutorial
Open

Add Julia tutorial for simulating time evolution of the Ising model#5254
haimeng-zhang wants to merge 16 commits into
Qiskit:mainfrom
haimeng-zhang:julia-tutorial

Conversation

@haimeng-zhang

@haimeng-zhang haimeng-zhang commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

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.

@qiskit-bot

Copy link
Copy Markdown
Contributor

Thanks for contributing to Qiskit documentation!

Before your PR can be merged, it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. Thanks! 🙌

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@henryzou50 henryzou50 self-requested a review June 17, 2026 14:23
@garrison

Copy link
Copy Markdown
Member

Before I forget ... the runtime client has a pending rename, which will be complete once JuliaRegistries/General#158556 merges.

@@ -0,0 +1,10 @@
[deps]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to remove both the toml files? These files won't render on the site and readers won't be able to see their contents. I would say if it's not critical to have the exact package versions installed you could just list these as packages the user should install. If it is, I would add the contents of Project.toml into the notebook through an accordion object.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option that would make this easier to pass through our CI checks would be to convert this file to markdown. This would bypass our notebook/lint checker which, for this particular case, I think is fine to do.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am doing the conversion locally and will upload as soon as I've compared the two versions to make sure they are identical. I will also move the file outside of the /time-evolution/ directory (right now the URL would be /docs/tutorials/time-evolution/time-evolution)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haimeng messaged me yesterday about the linter. Bumping squeaky from 0.7.0 to 0.7.1 in these two places should fix it:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I updated squeaky (one was already done) but I'm still getting errors. Should we convert to markdown after all, @kaelynj?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should still. My understanding is that ruff doesn't support Julia and we would have to set up a new linting pipeline in CI for this notebook.

Eventually we should find a solution for if we start adding more content in different languages, but for now I think it's fine to convert this to markdown. (Or have ruff ignore the file).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we convert to markdown after all [...] ?

Is the idea to convert it to markdown just to satisfy the linter? Might it make more sense to add this notebook to the linters' ignore list? Keeping it in notebook form has a few advantages that I can think of, namely that users could download it and execute, and also that we could then ourselves download it and manually execute it at a later date, to ensure that the instructions still work with the latest version of Qiskit.jl. Sure, manual testing is not as reliable as automated testing, but keeping it as a notebook still provides a path to testing it easily.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abbycross you still have the bad metadata from before the squeaky upgrade, you need to revert 9eba3cf then re-run ./fix

@kaelynj kaelynj Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we convert to markdown after all [...] ?

Is the idea to convert it to markdown just to satisfy the linter? Might it make more sense to add this notebook to the linters' ignore list? Keeping it in notebook form has a few advantages that I can think of, namely that users could download it and execute, and also that we could then ourselves download it and manually execute it at a later date, to ensure that the instructions still work with the latest version of Qiskit.jl. Sure, manual testing is not as reliable as automated testing, but keeping it as a notebook still provides a path to testing it easily.

Yeah it's mostly to satisfy the linter. I'd be fine with just adding it to the ignore list and keeping it as a notebook.

@haimeng-zhang you should be able to do this by adding this line to the docs/ruff.toml file

extend-exclude = ['tutorials/time-evolution/time-evolution.ipynb

"metadata": {},
"outputs": [],
"source": [
"using Qiskit\n",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some discussion with other Qiskit developers, I think it will be better to use the idiomatic Julia API to construct a circuit, described at https://github.com/Qiskit/Qiskit.jl#idiomatic-julia-interface-qiskitoperations

Suggested change
"using Qiskit\n",
"using Qiskit\n",
"using Qiskit.Operations\n",

"\n",
" # Neel state initialization\n",
" for i in 1:2:n\n",
" qc.x(i)\n",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an example of what a corresponding change would look like. Throughout, all mutating operations starting with qc. should be replaced with the corresponding method ending with a !.

Suggested change
" qc.x(i)\n",
" x!(qc, i)\n",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

6 participants