2017-06-08から1日間の記事一覧

マンデルブロ集合を描いてみる(Ruby)

このサイトのそのままパクリです(ありがとうございます!)。やったのは Java から Ruby へ移植しただけ。 def mandelbrot_count(c) z = Complex(0) 100.times do |i| z = z ** 2 + c return i if z.abs > 10 end 100 end Diff = 0.001 io = open("mandelbr…

コッホ曲線を描く(Python, Ruby)

自己相似図形であるコッホ曲線を Python と Ruby で描いてみました。 Python では手軽にタートル・グラフィックスが使えるので、これを利用するのが簡単です。 3次のコッホ曲線を描きます。 from turtle import * def draw(length, depth): if depth == 0: f…