Indices of convexity and concavity. Application to Halley method