public static function solve(callable $function, array $args, $target, $tol, $position = 0)
{
Validation::tolerance($tol);
// Initialize
$args1 = $args;
$guess = $args[$position];
do {
$args1[$position] = $guess + $tol;
// load the initial guess into the arguments
$args[$position] = $guess;
// load the initial guess into the arguments
$y = call_user_func_array($function, $args);
$y_at_xplusdelx = call_user_func_array($function, $args1);
$slope = ($y_at_xplusdelx - $y) / $tol;
$del_y = $target - $y;
$guess = $del_y / $slope + $guess;
$dif = abs($del_y);
} while ($dif > $tol);
return $guess;
}