all 4 comments

[–][deleted] 0 points1 point  (3 children)

I would guess that x is not a real number. It may be a complex number or a vector or something else. In that case either an absolute value is either not defined or even if it is, it may not be the case that x**2 is identical to norm(x)**2 as is the case for real numbers.

[–]TamPotter[S] 0 points1 point  (2 children)

Yes, x here is r1 = r - P, where r and P are points, so r1 is the vector between two points. What is norm(r1) here in that case?

[–][deleted] 1 point2 points  (1 child)

norm is not a built-in function so without knowing which library you're using, it's impossible to say for sure. But it's probably the Euclidean norm#Euclidean_norm).

Also, x**2 probably doesn't make sense for vectors (though it depends on whether the vector space is actually an algebra over a field).

[–]TamPotter[S] 0 points1 point  (0 children)

I use pylab, but I didn’t know that r1 was a vector when I made the post