Kronecker product based fractals: Difference between revisions
Content deleted Content added
Added Go |
m added whitespace to the simple matrices and used a better glyph, added whitespace and highlighting to the task preamble, added whitespace before the table of contents (TOC) . |
||
Line 1:
{{task|Fractals}}
This task is based on [[Kronecker product| Kronecker product]] of two matrices.
language has no a built-in function for such product then you need to implement it first.<br>▼
▲If your language has no a built-in function for such product then you need to implement it first.
The essence of fractals is self-replication (at least, self-similar replications).
So, using '''n''' times self-product of the matrix (filled with '''0'''/'''1''') we will have a fractal of the
Actually, "self-product" is a Kronecker power of the matrix. In other words: for a matrix '''M''' and a power '''n''' create a function like '''matkronpow(M, n)''', which returns MxMxMx... (n times product).<br>▼
A formal recurrent <i>algorithm</i> of creating Kronecker power of a matrix is the following:<br>▼
Actually, "self-product" is a Kronecker power of the matrix.
<b>Algorithm:</b>▼
▲
<br>which returns M<small>x</small>M<small>x</small>M<small>x</small>... ('''n''' times product).
<ul>
<li>Let M is an initial matrix, and Rn is a resultant block matrix of the Kronecker power, where n is the power (a.k.a. order).</li>
Line 15 ⟶ 26:
Even just looking at the resultant matrix you can see what will be plotted.<br>
There are virtually infinitely many fractals of this type. You are limited only by your creativity and
the power of your computer.
;Task:
Using [[Kronecker_product| Kronecker product]] implement and show two popular and well-known fractals, i.e.:
Line 21 ⟶ 34:
* [[wp:Sierpinski carpet| Sierpinski carpet fractal]].
;Test cases:
These 2 fractals (each order/power 4 at least) should be built using the following 2 simple matrices:
<pre>
</pre>
;Note:
* Output could be a graphical or ASCII-art representation, but if an order is set > 4 then printing is not suitable.
Line 34 ⟶ 51:
* It would be nice to see one additional fractal of your choice, e.g., based on using a single (double) letter(s) of an alphabet, any sign(s) or already made a resultant matrix of the Kronecker product.
<br><br>
=={{header|C}}==
|