Q: Build SSVQE's cost function using the following observable: $$O=2II−2XX+3YY−3ZZ\,.$$ This cost function should take in parameters as input. Use the included variational form, with reference states $\{|00⟩,|01⟩,|10⟩,|11⟩\}$ and weights: $$𝑤_{00}=50\,,\\ 𝑤_{01}=40\,,\\𝑤_{10}=30\,,\\𝑤_{11}=20\,.$$

  • Hint-1: Look at the ansatz to determine how many parameters the cost function should take in.)

  • Hint-2: Your cost function should use the qiskit.primitives.Estimator for evaluating all necessary expectation values

code: enter image description here

enter image description here

the grader shows the answer is incorrect, can anyone please where i went wrong

  • 2
    $\begingroup$ Please do not post codes as images. $\endgroup$ Oct 6, 2023 at 6:12
  • 4
    $\begingroup$ I’m voting to close this question because you have ignored the request from Martin Vesely to use a code block. $\endgroup$ Nov 6, 2023 at 17:09


Browse other questions tagged or ask your own question.