Method of generating functions for a quantum oscillator