mathematica制作koch雪花的问题,高手进
g[l_] := Flatten[ Replace[l, {u_ -> {u, Mod[u - 1, 6], Mod[u + 1, 6], u}}, {1}], 1];list1 = {0, 2, 4};ListLinePlot[ Prepend[Accumulate[ Replace[Nest[g, list1, 5], {0 -> {1, Sqrt[3]}, 1 -> {2, 0}, 2 -> {1, -Sqrt[3]}, 3 -> {-1, -Sqrt[3]}, 4 -> {-2, 0}, 5 -> {-1, Sqrt[3]}}, {1}]], {0, 0}], Axes -> False, AspectRatio -> Automatic, AxesOrigin -> {0, 0}]高手帮忙解释一下代码实现的原理。回答好追分这是原题:Fractals are geometric objects that consist of copies of the same basic stone applied in a systematic manner, perhaps one of the easiest and better know ones is the Koch snowflake. This fractal can be described as follows starting with one line segment: 1. Divide the line segment into three segments of equal length. 2. Draw an equilateral triangle (the sides are the same length. Do not draw the base) that has the middle segment from step 1 as its base and points outward. 3. Remove the line segment that is the base of the triangle from step 2.Applying this on a triangle for a few times gives the following results.your assignment- Make an algorithm that draws the koch snowflake for any number of iterations (hint: use an recursive approach)- Create a graphical user interface to control the drawing of the snowflake (hint: use Manipulate)