Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using draw squares.py as model, do the following: import numpy as np import matplotlib.pyplot as plt def draw_squares(ax,n,p,w): if n>0: i1 = [1,2,3,0,1] q =

Using draw squares.py as model, do the following:

import numpy as np import matplotlib.pyplot as plt def draw_squares(ax,n,p,w): if n>0: i1 = [1,2,3,0,1] q = p*w + p[i1]*(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([[0,0],[0,orig_size],[orig_size,orig_size],[orig_size,0],[0,0]]) fig, ax = plt.subplots() draw_squares(ax,15,p,.8) ax.set_aspect(1.0) ax.axis('off') plt.show() fig.savefig('squares.png') 

image text in transcribed

Write a recursive method to draw the following figures: a) b) e) Write a recursive method to draw the following figures: a) b) e)

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

More Books

Students also viewed these Databases questions