Finding solutions in an interval for a basic equation involving sine or cosine