added docstrings, matrix form for semiclassical equations