Mathematical analysis and computer simulation of dendritic growth in lithium batteries