Test issue 3997

http://code.google.com/p/sympy/issues/detail?id=3997