2

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

Cye Waldman
  • 8,196
  • 4
    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 – Ethan Bolker Nov 18 '18 at 23:45
  • 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 – Cye Waldman Nov 19 '18 at 00:02
  • 1
    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.) – Ethan Bolker Nov 19 '18 at 00:06
  • 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. – Cye Waldman Nov 19 '18 at 01:43
  • 1
    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. – Ethan Bolker Nov 19 '18 at 01:49
  • @CyeWaldman I assume the three largest circles are given. The center of the first generated circle is wrongly located at $(0,0).$ This influences all the rest. – Viera Čerňanová Feb 04 '19 at 20:45
  • Thanks for your comment. I do not choose the location of the first generated circle. The program does it. I have observed over time that my program, which is straightforward application of the extended Descartes Theorem does not do 'well' in the vicinity of the origin. In practice, I will offset the region being filled to avoid these problems. But let me reiterate my original problem. The two figures were generated by the program, albeit that the starting circles are negative conjugates (or mirror images). So why would it work in one case and not the other? Again, thanks for your interest. – Cye Waldman Feb 05 '19 at 21:48
  • I just posted a question (https://math.stackexchange.com/q/3469224) about Apollonian packings using as well extended Descartes Theorem, ignoring yours. I see a possible error source that hasn't been mentionned : if you work with a language such as Matlab and use a dot product $C.Z$ for expression $\sum c_kz_k$, you have the surprise to see that your expression is in fact considered as $\sum c_k z_k^$ (hermitian dot product). – Jean Marie Dec 09 '19 at 09:01

0 Answers0