Bah, you're right, since \rho is a function of r, I can't use it as a constant. My bad.
Ha ha, I'm actually in IT myself, though I am not a hardcore programmer; I do some here and there. Physics is a very interesting subject to me, but a career in it, on the other hand, doesn't appeal to me...