Conjunction tool fixed (hopefully)

I had a significant bug in the conjunction tool because of my guesswork. For a conjunction, you need to find minima of the separation function (distance between the two objects), which is to be computed numerically. So one uses a numerical algorithm to find the minima of a numerically defined function f(x) on interval [a, b] which works by following this procedure:

While x x = x + step;
--> sign = sgn( f(x) - f(x - step) )
--> if sign != prevSign and prevSign = -1 { # For minima
----> Go back and forth till you find the minimum
--> }
--> prevSign = sign;
}

I had made an error in passing the sign argument to the “Go back and forth till you find the minimum” method – I had passed prevSign as the current sign instead of sign. To compensate for that, I had illogically checked for maxima instead of minima!!

Now, thanks to Jason’s beautiful patch to make the conjunction tool faster, this bug was exposed and swatted dead. The conjunctions tool should work perfectly now, with the recent commit, which also increases the accuracy of the timings and separation reported.

It looks like the KDE 4.1 release will have a nice KStars with a lot of clean code and a lot of bugfixes.

Advertisements