Probably you are taking the log or square root or pow of a negative or non positive number or dividing by zero. It is possible to use the debugger to find the first place where this occurs.