Exact and numerical solutions to the perturbed sine-Gordon equation