List comprehension and integration of a function

You should change the coordinate system to have radial coordinate r which will have singularity at ring radius r = 1, to be able to approach it more easily. Otherwise, you can just change the if in the comprehension to:

if z ≠ 0 || (x*x + y*y) ≠ 1.0

PS: reminding that the negation of “A and B” is “Not A or Not B.”. I.e., !(z == 0 && (x*x +y*y) == 1) === z ≠ 0 || (x*x +y*y) ≠ 1

1 Like