A method to compute the non-linear behaviour of piles under horizontal loading