Computing normal forms of nonseparable Hamiltonians by symbolic manipulation