Duffing's equation and its applications to the Hirota equation