Analytical solutions to nonlinear differential equations arising in physical problems