1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mathematica で burning ship fractal

Posted at

Burning Ship fractal を Mathematica で描いてみた!

1. 条件

  • 漸化式
\left\{ \begin{align}&z_{n+1}=(|\mathfrak{R}(z_n)|-i\,|\mathfrak{I}(z_n)|)^2+c\\&z_0=0\end{align}\right.
  • 最大反復回数:100 回
  • 画像の縦の長さ:1920 px
  • 表示範囲:左上 -1.8 + 0.0825 i , 右下 -1.7 - 0.0175 i

2. コード

burningship.nb
burningship[re_, im_, maxIter_] := (c = re + im I; z = 0. I; 
  For[i = 1, i < maxIter + 1, i++, 
   z = (Abs[Re[z]] - I Abs[Im[z]])^2 + c; 
   If[Abs[z] > 2, Return[N[i/maxIter]]]]; Return[0])
   
xrange = {-1.8, -1.7}; yrange = {0.0825, -0.0175};
width = xrange[[2]] - xrange[[1]];
height = yrange[[1]] - yrange[[2]];

rows = 1920;
columns = Round[(width/height) rows];
result = ConstantArray[0, {rows, columns}];

rspace = Array[# &, rows, yrange];
cspace = Array[# &, columns, xrange];

For[rowIndex = 1, rowIndex < rows + 1, rowIndex++, 
  im = rspace[[rowIndex]]; 
  For[columnIndex = 1, columnIndex < columns + 1, columnIndex++, 
   re = cspace[[columnIndex]]; 
   result[[rowIndex, columnIndex]] = burningship[re, im, 100]]];
   
wb = ImageAdjust[Image[result]] (*白黒*)
Colorize[wb,ColorFunction->Hue,ColorRules->{0->Black}] (*カラー*)

3. 出力結果

burningshipwb.jpg
burningshipcolor.jpg

名前の通り(沈んでいる)船みたいに見えます。
めちゃくちゃ綺麗!!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?