# Removing numerically vanishing complex part within NDSolve

I am using functions that are only well-defined for real values (e.g. HeavisideTheta) within NDSolve.

Internally NDSolve works, of course, with complex numbers and sometimes returns a numerically vansihing complex value (e.g. 0. i) that breaks these functions.

Is it possible to get rid of the complex part (like applying Chop at each step)?

-
It would be good to provide a simple example demonstrating the problem, for people to test possible answers with. –  Simon Woods Nov 18 '13 at 21:48

unbreakableHeavisideTheta[x_] := HeavisideTheta[Chop[x]]
`