From: George George Date: 2009-04-08T21:02:04+09:00 Subject: what is happening here i have some perl code while ($high - $low > 0.001) { # precision # calculate the sum of all normalized scores my $sum = Pn * Pn * exp($lambda * $match) * 4 + Pn * Pn * exp($lambda * $mismatch) * 12; # refine guess at lambda if ($sum > 1) { $high = $lambda; $lambda = ($lambda + $low)/2; } else { $low = $lambda; $lambda = ($lambda + $high)/2; } } trying to rewrite this in ruby while (high - low > 0.001) #calculate the sum of all normalized scores sum = Pn * Pn **(lambda * match) * 4 + Pn * Pn **(lambda * mismatch) * 12 #refine guess at lambda if sum > 1 high = lambda lambda = (lambda + low)/2 else low = lambda lambda = (lambda+high)/2 end end Is this the right way? i seem to get different results when i execute the ruby version. any ideas? -- Posted via http://www.ruby-forum.com/.