# Define the charge locations and the path
q1 = +q
q2 = -q
p1 = [0, 0, 0]
p2 = [1, 1, 1]
y = lambda x: x**2
path = [p1] + [tuple(p1 + (x, y(x))) for x in np.linspace(0, 1, 100)] + [p2]

# Calculate the electric field
E = (q1 - q2) / (4 * np.pi * eps0 * np.sqrt(x**2 + y**2)) * np.array([1, y(x), 0])

# Calculate the work done by the electric field
W = np.sum(E * np.diff(path))
print(W)