A mathematical analysis of leaf longevity of trees under seasonally varying temperatures, based on a cost-benefit model