Added a warning about leastsq using with NaNs.

Added a warning that `func`'s retuned array_like must not contain NaNs or
computation might fail. Closes #3491
Merge pull request #3929 from venthur/fix-3491

DOC: optimize: Added a warning about leastsq using with NaNs