I tried to compute the cost, but it says Error: only integer scalar arrays can be converted to a scalar index.

here is what the output look like

Hey @Mubarak_Ibrahim,

You haven’t implemented the cost formulation in the correct manner, and that’s why the error. Please cross-check your formulation in code with the mathematical formulation given in markdown. I hope this helps.

Cheers,

Elemento

You have used the wrong syntax for `np.sum`

. You gave it two arguments, but it only takes one.