I assume that the subtraction of two Numpy arrays of equal shape, a and b, is given by:

np.subract(a,b) or equivalently by (a-b). The square of the difference would then be:

np.square(a-b).

When I use the above in the assignment, I get the following value error:

ValueError Traceback (most recent call last)

in

1 # Public tests

----> 2 test_sq_dist(sq_dist)

~/work/public_tests.py in test_sq_dist(target)

34 c4 = target(a4, b4)

35

—> 36 assert np.isclose(c1, 0), f"Wrong value. Expected {0}, got {c1}"

37 assert np.isclose(c2, 0.03), f"Wrong value. Expected {0.03}, got {c2}"

38 assert np.isclose(c3, 2), f"Wrong value. Expected {2}, got {c3}"

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I’ve looked at the usage of a.any() and a.all() but couldn’t see how this is relevant to getting the square of the distance.

Any help would be much appreciated