Equally spaced circles between two circles inclusive, with a minimum specified gap but no overlap.

Cato

New member
Joined
Mar 30, 2021
Messages
25
I’m trying to solve a math problem which I’d really appreciate some help with. I’ve tried to visualise it below to help explain it:

Screenshot 2024-08-01 at 16.21.09

I’ve given two examples here. In both examples, this is the information that is known:
  • The length of the horizontal line
  • The position of both circles at the ends of the line
  • The radius of both circles at the ends of the line
  • The minimum gap between any circles to be plotted between the end circles

All four of the above variables can change, I’ve simply shown two examples in the image. My question is, how can I calculate the position(s) of the dashed circle(s)? There are some conditions for these circles:
  1. They must be equally spaced between the end (solid) circles
  2. They must have the same radius as the end (solid) circles
  3. They must be separated by at least the specified gap (to avoid overlap)
  4. If the two end (solid) circles are too close to permit a dashed circle between them with the minimum gap on either side, we must not plot a dashed circle.

Please could someone advise how to achieve this?
 
Please could someone advise how to achieve this?
I would suggest you start by solving the reverse problem: Given a line length L, a radius r, and a number of circles n, how would you calculate the gap w between circles?

Then you can solve this equation for n given L, r, and w. Since you want an integer, you'll have some rounding to do at the end.

Give it a try, and show us your work as far as you get.
 
Thanks Dr Peterson but I already know what the gap is, and I need to enforce this specified gap. The issue is that I don’t know how to find the circles.
 
By the way this is for a computer program so I need to write a function that can perform this regardless of what the four known variables are, as they can change.
 
Thanks Dr Peterson but I already know what the gap is, and I need to enforce this specified gap. The issue is that I don’t know how to find the circles.
Please try doing what I said. Trust me, it will help. Writing an equation that relates a set of quantities, and then solving it for the one we don't know, is the essence of algebra.

What you know is not the actual gap, but the minimum permitted gap. You'll be solving for the number of circles that will result in the smallest gap not less than that.
By the way this is for a computer program so I need to write a function that can perform this regardless of what the four known variables are, as they can change.
This raises a question I failed to ask. You said,
this is the information that is known:
  • The length of the horizontal line
  • The position of both circles at the ends of the line
  • The radius of both circles at the ends of the line
  • The minimum gap between any circles to be plotted between the end circles

What does "position" mean? Knowing the length of the line (the distance between the first and last centers) seems to imply the position of those circles.
 
Ok thank you, I will try what you said. By the position of the circles I mean the (x,y) co-ordinates of their centres.
 
Ok thank you, I will try what you said. By the position of the circles I mean the (x,y) co-ordinates of their centres.
Okay, so it's the length that is redundant, since you could get that from the coordinates; and your ultimate goal will probably be to find the coordinates of the n centers. we'll get there.
 
Dr.Peterson, I have to hold my hands up and admit that I cheated. I was curious to see whether ChatGPT could solve this problem, I asked it the same question. Lo and behold it produced a function that does the job perfectly:

Screenshot 2024-08-01 at 21.31.30.png
I'll be studying this to find out exactly what is going on, but after testing it over 100 times it works flawlessly every time. We live in amazing times indeed.
 
Since you chose not to bother thinking, I'll do it for you; but thinking would be a far better way to learn something, if that were your goal. (It's ours.)

Suppose you have made n circles:
1722545851014.png
The line with length L is composed of (n-1) gaps with width g, and 2(n-1) radii r. So

[imath]L = (n-1)(g + 2r)[/imath]​

Solving for n,

[imath]n=\frac{L}{g+2r}+1[/imath]​

Now, we don't know what the actual gap will be; we just know it has to be at least some minimum m (so [imath]g\ge m[/imath]). And the number n has to be a natural number.

So, to make the gap as small as possible, but no less than m, we have to suppose that g = m, and then round down:

[imath]n=\lfloor\frac{L}{m+2r}+1\rfloor[/imath]​

So that's the formula you wanted. It wasn't so hard, was it? And ChatGPT did essentially that.

From here, of course, you need to find the actual gap, and then space the centers along the line.
 
Dr.Peterson, I have to hold my hands up and admit that I cheated. I was curious to see whether ChatGPT could solve this problem, I asked it the same question. Lo and behold it produced a function that does the job perfectly:

View attachment 38436
I'll be studying this to find out exactly what is going on, but after testing it over 100 times it works flawlessly every time. We live in amazing times indeed.
Amazing times indeed - you have at your disposal a free forum where math experts who helped thousands of students are ready to assist you. But you ignore the suggestion someone took valuable time to offer you and take a shortcut. Well, it will probably help with the task at hand, but in the long run...
 
Amazing times indeed - you have at your disposal a free forum where math experts who helped thousands of students are ready to assist you. But you ignore the suggestion someone took valuable time to offer you and take a shortcut. Well, it will probably help with the task at hand, but in the long run...
I didn't ignore him, I respect him a lot as he has helped me before and I have followed his advice before to solve a problem. I've never used ChatGPT to solve a math problem before, as my instinct is always to try to solve it myself with help. This is why I joined this forum and have used it before. I was just curious as to whether it could solve it, and it did.

I appreciate his recommendation and his time, and I will study his approach in Post #9 to understand it. Thank you Dr.Peterson! :) I will also take his challenge to find the actual gap and I will post back soon once I have solved it for myself. By the way thank you for the reminder, shortcuts don't help in the long run. I agree with you on that.
 
Last edited:
The line with length L is composed of (n-1) gaps with width g, and 2(n-1) radii r. So

[imath]L = (n-1)(g + 2r)[/imath]​
Apologies if this is an elementary question. Please could you explain what ‘n’ represents in this equation? I’m not sure how you formulated this equation.
 
Apologies if this is an elementary question. Please could you explain what ‘n’ represents in this equation? I’m not sure how you formulated this equation.
Suppose you have made n circles:
;)

And, yes, I do appreciate the impressive work ChapGPT can do, when it happens to be right. (I've seen it be dramatically wrong!) I've used it to get ideas, and recently it wrote a program for me when that wasn't what I asked for (because the problem didn't have a nice mathematical solution).
 
Thank you Dr.Peterson for your help, and everyone else for your encouragement. I now understand how to solve this. If I consider a new example where:

[math]L = 8, m = 1, r = 1[/math]
[math]L = (n-1)(g + 2r)[/math] , [math]n = \lfloor\frac{L}{m+2r} + 1\rfloor[/math]
Thus n = 3,

Re-arranging for g:

[math]g = \frac{L}{n-1} - 2r[/math]
Therefore, g = 2.

When I draw this, it produces the intended result. Thank you for the help, I now fully understand what is going on. I guess the critical part was constructing the equation:

[math]L = (n-1)(g + 2r)[/math]
Because after that it became very simple!

My question to Dr.Peterson, did you follow a particular method to construct this equation? Or is it just something you intuitively did by analysing the problem? I guess it becomes more natural the more of these types of problems you solve?
 
Last edited:
My question to Dr.Peterson, did you follow a particular method to construct this equation? Or is it just something you intuitively did by analysing the problem? I guess it becomes more natural the more of these types of problems you solve?
I showed explicitly one way to obtain it; but from experience, I could see that the picture can be broken into n-1 groups of g+2r:

1722861460625.png

This sort of thing occurs in picket fence problems, and in placement of pictures on a wall.

But the general approach of writing an equation to describe the relationship among variables and then solving for one is just how algebra works. So, yes, "analyzing the problem" becomes natural with experience.
 
Top