Log in to edit a copy.
Download.
Other published documents...
Треугольник Серпинского
573 days ago by kpp
a = RDF(10); b = RDF( sqrt(a^2 - (a/2)^2) ); pts0 = [(0,0), (a,0), (a/2, b)]; result = list_plot(pts); result.show()
addp = (random()*a,random()*b); (result + point(addp, color='red')).show();
new_points = [addp]; for i in range(0,100000): choice = pts0[randint(0,2)]; addp = tuple([(choice[i]+addp[i])/2 for i in range(0,2)]); new_points.append(addp); result = result + list_plot(new_points, color='red');
result.show(figsize=[15,15])