Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please comment what each line is doing. Need good explaining of what these two programs are doing. (Python) import matplotlib.pyplot as plt import numpy as

Please comment what each line is doing.
Need good explaining of what these two programs are doing. (Python)
image text in transcribed
image text in transcribed
import matplotlib.pyplot as plt import numpy as np import math def circle (center,rad): n - int (4*rad*math.pi) t = np . linspace ( 0, 6.3,n) x = center [0]+rad*np. Sin(t) y - center[ 1]+rad*np.cos (t) return x,y def draw circles(ax,n,center,radius,w): if n>0: x, y circle ( center, radius) ax.plot (x,y,color-'k') draw circles (ax, n-1 , center, radius*w,w) plt.close( "all") fig, ax - plt.subplots() draw_circles (ax, 50, [100,0], 100, .9) ax.set aspect (1.0) ax.axis 'off') plt.show () fig.savefig('circles.png' ) import numpy as np import matplotlib.pyplot as plt def draw_squares (ax, n,p,w): if n>0: qp*w + p[il]* (1-w) ax.plot (p[,0],p[:,1], color-'k') draw squares (ax,n-1,q,w) plt.close( "all") orig_size - 800 p - np.array(II0,01,i0,orig sizel, [orig_size,orig_size], [orig_size,0,[0,0]]) fig, ax = pit. subplots() draw-squares ( ax , 15, p , . 8 ) ax.set_aspect(1.0) ax.axis('off ') plt.show () fig.savefig( 'squares.png' )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions