For the radial gradient pattern, what you need to do is find the distance of the given point from the origin. Once you have that distance, the algorithm works very much like the linear gradient. In other words, with the linear gradient you used the x coordinate as the distance from the origin. For the radial gradient, you use the point's radial distance from the origin.
baptiste -- yeah, you're right. Taking the magnitude of a point is kind of nonsensical, it really does need to be converted to a vector first (by setting w to 0), which is the vector from the origin the point.