Algebraic approach to the forced anharmonic oscillator