Skip to content

How to compute expectation values guide, issue #473#541

Open
esraayantuna wants to merge 2 commits intoqiskit-community:mainfrom
esraayantuna:docs/compute-expval-guide
Open

How to compute expectation values guide, issue #473#541
esraayantuna wants to merge 2 commits intoqiskit-community:mainfrom
esraayantuna:docs/compute-expval-guide

Conversation

@esraayantuna
Copy link
Contributor

Added a Jupyter notebook explaining how to compute expectation values with ffsim.

@esraayantuna
Copy link
Contributor Author

Hi @0sophy1! Can you review this PR, please?

@esraayantuna esraayantuna changed the title How to compute expectation values guide #473 How to compute expectation values guide for the issue #473 Jan 24, 2026
@esraayantuna esraayantuna changed the title How to compute expectation values guide for the issue #473 How to compute expectation values guide, issue #473 Jan 24, 2026
@0sophy1
Copy link

0sophy1 commented Jan 30, 2026

Hi @0sophy1! Can you review this PR, please?

Thank you so much for this awesome work Esra,

I found these 5 expectation functions

state.spin_square
reduceDensityMatrix.expectation
expectation_one_body_product
expectation_squared_diag_coulomb
SingleFactorizedHamiltonian.expectation_product_state

and wonder if these are also good to be added to this guide.

@kevinsung Your input will be very helpful and valuable!

@kevinsung
Copy link
Collaborator

kevinsung commented Jan 30, 2026

Hi @0sophy1! Can you review this PR, please?

Thank you so much for this awesome work Esra,

I found these 5 expectation functions

state.spin_square reduceDensityMatrix.expectation expectation_one_body_product expectation_squared_diag_coulomb SingleFactorizedHamiltonian.expectation_product_state

and wonder if these are also good to be added to this guide.

@kevinsung Your input will be very helpful and valuable!

No, we shouldn't mention those functions. This guide should only show how to get expectation values with Scipy LinearOperator and np.vdot. I will review this PR (hopefully soon).

@0sophy1
Copy link

0sophy1 commented Jan 30, 2026

Hi @0sophy1! Can you review this PR, please?

Thank you so much for this awesome work Esra,
I found these 5 expectation functions
state.spin_square reduceDensityMatrix.expectation expectation_one_body_product expectation_squared_diag_coulomb SingleFactorizedHamiltonian.expectation_product_state
and wonder if these are also good to be added to this guide.
@kevinsung Your input will be very helpful and valuable!

No, we shouldn't mention those functions. This guide should only show how to get expectation values with Scipy LinearOperator and np.vdot. I will review this PR (hopefully soon).

Thank you @kevinsung ! I believe this tutorial meets your expectations.

Copy link
Collaborator

@kevinsung kevinsung Feb 5, 2026

Choose a reason for hiding this comment

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

Thanks Esra!

  • The notebook file should go in docs/how-to-guides/. Also, the filename should use hyphens - instead of underscores _.
  • Add a title and format the notebook to use traditional Markdown headings
  • Use MolecularHamiltonian instead of DiagonalCoulombHamiltonian
  • Only using the diagonal is not a valid method, it only worked because you created a diagonal Hamiltonian.

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 this pull request may close these issues.

3 participants