function iterate(algorithm)
{
	var tooLowSolution = algorithm.minSolution;
	var tooLowResult = algorithm.calculation(tooLowSolution);
	var tooHighSolution = 0;
	var tooHighResult = 0;
	var currentSolution = 0;
	var currentResult = 0;
	var gradient = 0;

  	if (tooLowResult > 0) 
	    	currentSolution = tooLowSolution;
	else {
	    	tooHighSolution = algorithm.maxSolution;
    		tooHighResult = algorithm.calculation(tooHighSolution);

	    	if (tooHighResult < 0) 
      			currentSolution = tooHighSolution;
	    	else   	//Iterate
      			while (true) {
			        gradient = (tooHighSolution-tooLowSolution) /
		        	            (tooHighResult-tooLowResult);

	        		currentSolution = tooHighSolution - tooHighResult*gradient;
			        currentResult = algorithm.calculation(currentSolution);

				if (Math.abs(currentResult) < algorithm.stopIteration)
					break;

			        if (currentResult > 0) {
	        			tooHighSolution = currentSolution;
		        		tooHighResult = currentResult;
			        } else {
        		  		tooLowSolution = currentSolution;
          				tooLowResult = currentResult;
	        		}
			}
	}
  	
  	return currentSolution;
}