Calculating the Number of Squares Inside a Circle in the 1st Quadrant

  • Context: MHB 
  • Thread starter Thread starter Wilmer
  • Start date Start date
  • Tags Tags
    Square
Click For Summary
SUMMARY

The discussion focuses on calculating the number of 1x1 squares fully contained within a circle inscribed in a 10x10 square in the first quadrant. The proposed method involves iterating through x-coordinates from 1 to the radius (r) of the circle, using the formula y = FLOOR[SQRT(r^2 - x^2)] to determine the corresponding y-coordinates. The total count of squares is then multiplied by 4 to account for all quadrants. The initial calculation of 60 squares is confirmed to be correct based on the provided algorithm.

PREREQUISITES
  • Understanding of basic geometry, specifically circles and squares.
  • Familiarity with programming concepts, including loops and conditional statements.
  • Knowledge of mathematical functions such as square root and floor functions.
  • Experience with a programming language capable of implementing the discussed algorithm.
NEXT STEPS
  • Implement the algorithm in Python or JavaScript to visualize the calculation.
  • Explore variations of the problem by changing the radius and square dimensions.
  • Research optimization techniques for similar geometric calculations.
  • Learn about graphical representations of geometric shapes using libraries like Matplotlib or p5.js.
USEFUL FOR

Mathematicians, computer science students, and programmers interested in geometric algorithms and their applications in computational geometry.

Wilmer
Messages
303
Reaction score
0
A 10by10 square contains 100 1by1 squares (of course!).
A circle is drawn inside above square, tangent to all 4 sides.
How many of the 1by1 squares are fully inside the circle?

I get 60...which I think is correct.
Trying to devise a general case formula...
 
Mathematics news on Phys.org
Couldn't come up with general case formula.

However, this simple program seems to work:

-center of circle at origin
-examine the 1/4 circle in 1st quadrant

r = radius
x,y = points on circumference

INPUT r
LOOP x FROM 1 TO r
y = FLOOR[SQRT(r^2 - x^2)]
count = count + y
ENDLOOP
PRINT count*4

See anything wrong?
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 45 ·
2
Replies
45
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
10
Views
6K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 6 ·
Replies
6
Views
12K