#!/usr/bin/perl -w

print "Find where cosine is zero";

# The zero of cosine is *somewhere* between 0 ... 4
$h = 4;
$l = 0;
while ($h > $l + 0.000000001)
{
	$m = ($h + $l) / 2;
	$diff = cos($m) - 0;
	print "L = $l M = $m H = $h Diff = $diff\n";
	$h = $m if ($diff < 0);
	$l = $m if ($diff > 0);
}
