import matplotlib.pyplot as plt import numpy as np theta = np.linspace (0,2*np.pi, 100) fig, axes = plt.subplots(1,3) axes.axis('off') axes.set_aspect('equal') xylim = (-10,10) axes.set_xlim(xylim) axes.set_ylim(xylim) for i in range(-11, 11, 3): axes.axvline(x=i, color='gray', alpha=0.5) axes.axhline(y=i, color='gray', alpha=0.5) def koncentriske_circler(r, x0=0, y0=0): x=rnp.cos(theta) y = r * np.sin(theta) return x+x0, y+y0 def create_peripheral_circles(ax, N, radius_main_circle, radius_sub_circles): angle_step = 2 × np.pi / N for i in range(N) : b = 10 a = 3 angle = i * angle_step x = radius_main_circle * np.cos(angle) y = radius_main_circle ✶ np.sin(angle) circle = plt.Circle((x, y), radius_sub_circles, color='r') ax.add_artist (circle) c = (b-a)/2 r = [b, a] colors = [(1, 0, 0, 0.3), ('C1'), ('C1')] N_values = [3, 5, 8] for i, colors, N_value in zip(r, colors, N_values): x, y = koncentriske_circler(i, 0, 0) axes.plot(x, y) axes.fill(x, y, color=colors) create_peripheral_circles (axes, N_value, (a+c), c) plt.show() 10- -10- -10

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The original question: 
Let the two concentric circles have radius a and b respectively. Let the radius of the N circles be c. If you know the values ​​for a and b, the value of c follows. Derive an expression for c when a and b are known. Make an overall figure where you plot for a=3, b=10 and N being 3, 5 and 8. 

I have attempted to write a script that works, but I can't get it to work. If you could help me figure out what I'm missing, that would be great. I have attached an image of what the plot should look like, and an image of my code

import matplotlib.pyplot as plt
import numpy as np
theta = np.linspace (0,2*np.pi, 100)
fig, axes = plt.subplots(1,3)
axes.axis('off')
axes.set_aspect('equal')
xylim = (-10,10)
axes.set_xlim(xylim)
axes.set_ylim(xylim)
for i in range(-11, 11, 3):
axes.axvline(x=i, color='gray', alpha=0.5)
axes.axhline(y=i, color='gray', alpha=0.5)
def koncentriske_circler(r, x0=0, y0=0):
x=rnp.cos(theta)
y = r * np.sin(theta)
return x+x0, y+y0
def create_peripheral_circles(ax, N, radius_main_circle, radius_sub_circles):
angle_step = 2 × np.pi / N
for i in range(N) :
b = 10
a = 3
angle = i * angle_step
x = radius_main_circle * np.cos(angle)
y = radius_main_circle ✶ np.sin(angle)
circle = plt.Circle((x, y), radius_sub_circles, color='r')
ax.add_artist (circle)
c = (b-a)/2
r = [b, a]
colors = [(1, 0, 0, 0.3), ('C1'), ('C1')]
N_values = [3, 5, 8]
for i, colors, N_value in zip(r, colors, N_values):
x, y = koncentriske_circler(i, 0, 0)
axes.plot(x, y)
axes.fill(x, y, color=colors)
create_peripheral_circles (axes, N_value, (a+c), c)
plt.show()
Transcribed Image Text:import matplotlib.pyplot as plt import numpy as np theta = np.linspace (0,2*np.pi, 100) fig, axes = plt.subplots(1,3) axes.axis('off') axes.set_aspect('equal') xylim = (-10,10) axes.set_xlim(xylim) axes.set_ylim(xylim) for i in range(-11, 11, 3): axes.axvline(x=i, color='gray', alpha=0.5) axes.axhline(y=i, color='gray', alpha=0.5) def koncentriske_circler(r, x0=0, y0=0): x=rnp.cos(theta) y = r * np.sin(theta) return x+x0, y+y0 def create_peripheral_circles(ax, N, radius_main_circle, radius_sub_circles): angle_step = 2 × np.pi / N for i in range(N) : b = 10 a = 3 angle = i * angle_step x = radius_main_circle * np.cos(angle) y = radius_main_circle ✶ np.sin(angle) circle = plt.Circle((x, y), radius_sub_circles, color='r') ax.add_artist (circle) c = (b-a)/2 r = [b, a] colors = [(1, 0, 0, 0.3), ('C1'), ('C1')] N_values = [3, 5, 8] for i, colors, N_value in zip(r, colors, N_values): x, y = koncentriske_circler(i, 0, 0) axes.plot(x, y) axes.fill(x, y, color=colors) create_peripheral_circles (axes, N_value, (a+c), c) plt.show()
10-
-10-
-10
Transcribed Image Text:10- -10- -10
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education