# \[HS.4.2a\] I have gotten the feedback "correct". But I think system answer is not correct

**URL:** <https://discuss.pennylane.ai/t/hs-4-2a-i-have-gotten-the-feedback-correct-but-i-think-system-answer-is-not-correct/9561>\
**Category:** Codebook\
**Created:** [October 14, 2026, 2:40am UTC](https://discuss.pennylane.ai/t/hs-4-2a-i-have-gotten-the-feedback-correct-but-i-think-system-answer-is-not-correct/9561 "2026-10-14T02:40:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ring](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/ring/32/4429_2.png) [@Ring](https://discuss.pennylane.ai/u/Ring)\
**Post date:** [October 14, 2026, 2:40am UTC](https://discuss.pennylane.ai/t/hs-4-2a-i-have-gotten-the-feedback-correct-but-i-think-system-answer-is-not-correct/9561/1 "2026-10-14T02:40:05Z")

</div>

Hi,

I have marked my answer and system’s “correct” answer in my code comments.

Want to confirm if I’m right.

#################### my code #################

h\_coeffs = [1/4,1/4,1/2]  
h\_ops = [qp.PauliZ(5),qp.PauliZ(6),qp.PauliX(5)@qp.PauliX(6)]  
H = qp.dot(h\_coeffs,h\_ops)# Write the Hamiltonian here

dev = qp.device(“default.qubit”, wires = range(7))  
walk\_powers\_1 = [qp.pow(qp.Qubitization(H, control = [3,4]), i) for i in range(0,3)]  
walk\_powers\_2 = [qp.pow(qp.adjoint(qp.Qubitization(H, control = [3,4])), i) for i in reversed(range(1,3))]  
print(“walk\_powers\_1：”, walk\_powers\_1)  
print(“walk\_powers\_2：”, walk\_powers\_2)  
lcu\_ops = walk\_powers\_2 + walk\_powers\_1  
print(“lcu\_ops：”, lcu\_ops)

bessel\_1 = [0.7651976865579666, 0.44005058574493355, 0.1149034849319005]

###Construct the coefficients for the Jacobi-Anger LCU

J0,J1,J2 = bessel\_1  
norm\_fact = J0+2_J1+2_J2

“”"

#This is my proposed correct answer.

lcu\_coeffs = [  
(-1)\*J2/norm\_fact,  
(-1j)\*J1/norm\_fact,  
J0/norm\_fact,  
(1j)\*J1/norm\_fact,  
(-1)\*J2/norm\_fact,  
]  
“”"  
“”"  
lcu\_coeffs = [  
(-1)\*J2/norm\_fact,  
(1j)\*J1/norm\_fact,  
J0/norm\_fact,  
(-1j)\*J1/norm\_fact,  
(-1)\*J2/norm\_fact,  
]  
“”"

“”"  
lcu\_coeffs = [  
(-1)\*J2/norm\_fact,  
(-1j)\*J1/norm\_fact,  
J0/norm\_fact,  
(-1j)\*J1/norm\_fact,  
(-1)\*J2/norm\_fact,  
]  
“”"

#This is the system-verified correct answer.  
lcu\_coeffs = [  
(-1)\*J2/norm\_fact,  
(1j)\*J1/norm\_fact,  
J0/norm\_fact,  
(1j)\*J1/norm\_fact,  
(-1)\*J2/norm\_fact,  
]

lcu = qp.dot(lcu\_coeffs, [lcu\_op@qp.qnode](mailto:lcu_op@qp.qnode))

@qp.qnode(dev)  
def prep\_sel\_prep\_walk():  
“”"  
Quantum circuit that applies PrepSelPrep to the Walk operator  
to generate the Jacobi Anger expansion to order 2.  
Returns:

- (np.ndarray): The quantum state  
“”"

```auto
####################
###YOUR CODE HERE###
####################

qp.PrepSelPrep(lcu, control=[0,1,2])

return qp.state()

```

encoded\_matrix = qp.matrix(prep\_sel\_prep\_walk, wire\_order=range(7))()[:4, :4]  
print(“The encoded matrix is: \n”, encoded\_matrix)

##################### User output #############################

```auto
walk_powers_1： [Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])**0, Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])**1, Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])**2]
walk_powers_2： [(Adjoint(Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])))**2, (Adjoint(Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])))**1]
lcu_ops： [(Adjoint(Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])))**2, (Adjoint(Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])))**1, Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])**0, Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])**1, Qubitization(0.25, 0.25, 0.5, wires=[3, 4, 5, 6])**2]
The encoded matrix is: 
 [[4.08082400e-01+2.34680400e-01j 0.00000000e+00+0.00000000e+00j
  0.00000000e+00+0.00000000e+00j 1.77716646e-17+2.34680400e-01j]
 [0.00000000e+00+0.00000000e+00j 4.69360800e-01-4.65865772e-17j
  1.33504646e-17+2.34680400e-01j 0.00000000e+00+0.00000000e+00j]
 [0.00000000e+00+0.00000000e+00j 1.53895955e-17+2.34680400e-01j
  4.69360800e-01+3.15776979e-17j 0.00000000e+00+0.00000000e+00j]
 [1.09683955e-17+2.34680400e-01j 0.00000000e+00+0.00000000e+00j
  0.00000000e+00+0.00000000e+00j 4.08082400e-01-2.34680400e-01j]]

```

 ![截图 2026-10-14 10-17-35](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/3/39b495d50291a87771bf7f07a9569a4970d5c3d8.jpeg)

 ![截图 2026-10-14 10-19-23](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/0/0e3cc3eba086d2cc6152c5b9d46b48c4fe52ebe8.jpeg)

 ![截图 2026-10-14 10-19-35](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/6/65e315e4b9154bab4c42b29bfd49f303b471b998.jpeg)

 ![截图 2026-10-14 10-18-28](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/0/09c51dca056249fa4567f1a08892d4b30382b39a.jpeg)
