At each point (x,y) on the curve the slope equals the square of the distance between the point and the y-axis; the point (-1, 2) is on the curve. Find the equation of the function.