# Could not figured it out what are the coefficient will be in H.4.2

**URL:** <https://discuss.pennylane.ai/t/could-not-figured-it-out-what-are-the-coefficient-will-be-in-h-4-2/4215>\
**Category:** Codebook\
**Created:** [March 3, 2024, 4:33pm UTC](https://discuss.pennylane.ai/t/could-not-figured-it-out-what-are-the-coefficient-will-be-in-h-4-2/4215 "2024-03-03T16:33:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SUDHIR\_KUMAR\_SAHOO](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/sudhir_kumar_sahoo/32/2254_2.png) [@SUDHIR\_KUMAR\_SAHOO](https://discuss.pennylane.ai/u/SUDHIR_KUMAR_SAHOO)\
**Post date:** [March 3, 2024, 4:33pm UTC](https://discuss.pennylane.ai/t/could-not-figured-it-out-what-are-the-coefficient-will-be-in-h-4-2/4215/1 "2024-03-03T16:33:30Z")

</div>

In this code i have tried coeffs is an array of [-alpha, -alpha, -alpha, -alpha, - alpha] But I am getting error. Please help me out

```auto
n_bits = 5
dev = qml.device("default.qubit", wires=n_bits)
    
##################
# YOUR CODE HERE #
##################
coeffs = [1,1,1,1,1] # MODIFY THIS
obs = [qml.PauliZ(0),qml.PauliZ(1),qml.PauliZ(2),qml.PauliZ(3),qml.PauliZ(4)] # MODIFY THIS
H = qml.Hamiltonian(coeffs, obs)

@qml.qnode(dev)
def energy(init):
    """Circuit for measuring expectation value of Hamiltonian in a given state.
    
    Args:
        init (numpy.array(int)): An initial computational basis state, specified by five bits.

    Returns: 
        float: Expectation value of the Hamiltonian H.
    """
    qml.BasisState(init, wires=range(n_bits))
    return qml.expval(H)

```

Code is running very well in Local Compiler but what the coefficient this problem is seeking for I could not understand.

---

<div class="post-metadata">

**Author:** ![erqs](https://avatars.discourse-cdn.com/v4/letter/e/aeb1de/32.png) [@erqs](https://discuss.pennylane.ai/u/erqs)\
**Post date:** [March 4, 2024, 8:56am UTC](https://discuss.pennylane.ai/t/could-not-figured-it-out-what-are-the-coefficient-will-be-in-h-4-2/4215/2 "2024-03-04T08:56:55Z")

</div>

Hi @SUDHIR_KUMAR_SAHOO,

I think going back to what you are trying to code might be heplful. Look in more detail at the _ **coefficients** _, _ **terms** _ and _ **number of terms** _ of the formula:  
 ![image](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/9/9a0658ff3cd0483462d8343f6c5e43dbc24d0d62.png)

That should give you a hint on the number of coefficients and their value.

Cheers,  
Erick

---

<div class="post-metadata">

**Author:** ![SUDHIR\_KUMAR\_SAHOO](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/sudhir_kumar_sahoo/32/2254_2.png) [@SUDHIR\_KUMAR\_SAHOO](https://discuss.pennylane.ai/u/SUDHIR_KUMAR_SAHOO)\
**Post date:** [March 4, 2024, 4:00pm UTC](https://discuss.pennylane.ai/t/could-not-figured-it-out-what-are-the-coefficient-will-be-in-h-4-2/4215/4 "2024-03-04T16:00:56Z")

</div>

Thank you so much for help. Got your point.
