2
$\begingroup$

I'm working on a general Apollonian gasket (i.e., with no particular symmetry). One example might be to populate a Steiner chain with Apollonian circles. I programmed a recursive Descartes' theorem using the equations given in Wikipedia (Descartes' Theorem). I get a nice result for a sample case I set up; it's shown on the left of the figure below.

However, when I tried a test case from another part of the plane a got cockamamie results. To demonstrate this I took the original example, call it $Z$, and applied the same algorithm to $-Z^*$, i.e., the negative conjugate. The results are seen on the right of the figure below.

I'm trying to determine what's wrong here. Am I making an error? Is the complex Descartes' theorem of limited applicability? I can create a workaround by rotating the working area to the vicinity of the positive $x$-axis, but I'm really seeking to develop a robust algorithm.

Any insights or suggestions would be appreciated.

enter image description here

$\endgroup$
  • 4
    $\begingroup$ I think debugging your code without seeing the code is impossible. But posting the code here will probably not get you the help you need. I suggest narrowing the problem down by experimenting to see just where in the plane the problem occurs. Then perhaps post instead at stackoverflow.com $\endgroup$ – Ethan Bolker Nov 18 '18 at 23:45
  • $\begingroup$ Thanks for your reply. It's always nice to know that someone is reading these things. But...Clearly, there's nothing wrong with the code. If it works with one set of circles it should work for all sets. The only inputs are the radii and centers of the circles. And I've tried other set-ups besides the one that's shown. And finally, If I rotate the image on the left by $\pi$, it works correctly $\endgroup$ – Cye Waldman Nov 19 '18 at 0:02
  • 1
    $\begingroup$ There can't be "nothing wrong with the code" if it produces wrong answers some of the time.Students often tell me their programs "should work" even when they fail some of my test cases. (A clock that's stopped is right twice a day.) $\endgroup$ – Ethan Bolker Nov 19 '18 at 0:06
  • $\begingroup$ Point taken. Didn't mean to sound like an arrogant jerk, but the algorithm is really quite straightforward. You pop in three radii and positions and get one back. $\endgroup$ – Cye Waldman Nov 19 '18 at 1:43
  • 1
    $\begingroup$ No offense. I don't know the formulas you're using, but they might have square roots in them, with ambiguity about sign. I think you have two outputs: new center and new radius.The picture suggests you are getting the radius right all the time. $\endgroup$ – Ethan Bolker Nov 19 '18 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.