A mathematical model of anorexia and bulimia