b'\n_START_ARTICLE_\nPapro\xc4\x87 Barnsleya\n_START_SECTION_\nAlgorytm\n_START_PARAGRAPH_\nAlgorytm generowania tego fraktala polega na procesie iteracji (wielokrotnego przekszta\xc5\x82cania) wsp\xc3\xb3\xc5\x82rz\xc4\x99dnych rysowanego punktu. Pocz\xc4\x85tkowo losowo wybieramy wsp\xc3\xb3\xc5\x82rz\xc4\x99dne punktu, a nast\xc4\x99pnie r\xc3\xb3wnie\xc5\xbc losowo wybieramy jedno z przekszta\xc5\x82ce\xc5\x84 afinicznych z odpowiednim prawdopodobie\xc5\x84stwem. Po obliczeniu nowych wsp\xc3\xb3\xc5\x82rz\xc4\x99dnych punktu, proces powtarzamy okre\xc5\x9blon\xc4\x85 ilo\xc5\x9b\xc4\x87 razy.\n_START_SECTION_\nMatlab\n_START_PARAGRAPH_\nProgram napisany w Matlabie generuj\xc4\x85cy papro\xc4\x87 widoczn\xc4\x85 na animacji obok:_NEWLINE_for max_step=[1000 10000 50000  100000  500000];_NEWLINE_    x=zeros(1,max_step);_NEWLINE_    y=zeros(1,max_step);_NEWLINE_    for n=1:max_step_NEWLINE_        r=rand();_NEWLINE_        if r<=0.01_NEWLINE_            x(n+1)=0;_NEWLINE_            y(n+1)=0.16*y(n);_NEWLINE_        elseif r<=0.08_NEWLINE_            x(n+1)=0.2*x(n)-0.26*y(n);_NEWLINE_            y(n+1)=0.23*x(n)+0.22*y(n)+1.6;_NEWLINE_        elseif r<=0.15_NEWLINE_            x(n+1)=-0.15*x(n)+0.28*y(n);_NEWLINE_            y(n+1)=0.26*x(n)+0.24*y(n)+0.44;_NEWLINE_        else_NEWLINE_            x(n+1)=0.85*x(n)+0.04*y(n);_NEWLINE_            y(n+1)=-0.04*x(n)+ 0.85*y(n)+1.6;_NEWLINE_        end_NEWLINE_    end_NEWLINE_    plot(x,y,\'.\',\'Color\', \'g\', \'MarkerSize\',1)_NEWLINE_    title([\'N = \' num2str(max_step)])_NEWLINE_    drawnow_NEWLINE_    pause(0.5)end\n_START_SECTION_\nPython\n_START_PARAGRAPH_\nProgram napisany w Pythonie:_NEWLINE_import randomimport matplotlib.pyplot as pltX = [0]Y = [0]for n in range(100000):_NEWLINE_    r = random.uniform(0, 100)_NEWLINE_    if r < 1.0:_NEWLINE_        x = 0_NEWLINE_        y = 0.16*Y[n-1]_NEWLINE_    elif r < 86.0:_NEWLINE_        x = 0.85*X[n-1] + 0.04*Y[n-1]_NEWLINE_        y = -0.04*X[n-1] + 0.85*Y[n-1]+1.6_NEWLINE_    elif r < 93.0:_NEWLINE_        x = 0.2*X[n-1] - 0.26*Y[n-1]_NEWLINE_        y = 0.23*X[n-1] + 0.22*Y[n-1] + 1.6_NEWLINE_    else:_NEWLINE_        x = -0.15*X[n-1] + 0.28*Y[n-1]_NEWLINE_        y = 0.26*X[n-1] + 0.24*Y[n-1] + 0.44_NEWLINE_    X.append(x);Y.append(y)\'\'\'Tworzenie wykresu\'\'\'plt.figure(figsize = [15,15])plt.scatter(X,Y,color = \'g\',marker = \'.\')plt.show()\n_START_SECTION_\nJavaScript (HTML5)\n_START_PARAGRAPH_\nProgram napisany w JavaScript (HTML5):_NEWLINE_<canvas id="canvas" height="700" width="700"></canvas><script>_NEWLINE_    let canvas;_NEWLINE_    let canvasContext;_NEWLINE__NEWLINE_    let move;_NEWLINE__NEWLINE_    let fps = 250;_NEWLINE__NEWLINE_    let pointColor = "green";_NEWLINE_    let backgroundColor = "black";_NEWLINE_    let pointRadius = 1;_NEWLINE__NEWLINE_    let x = 0;_NEWLINE_    let y = 0;_NEWLINE__NEWLINE_    window.onload = function () {_NEWLINE_        canvas = document.getElementById("canvas");_NEWLINE_        canvasContext = canvas.getContext(\'2d\');_NEWLINE__NEWLINE_        canvasContext.fillStyle = backgroundColor;_NEWLINE_        canvasContext.fillRect(0, 0, canvas.width, canvas.height);_NEWLINE__NEWLINE_        move = setInterval(doIt, 1000/fps);_NEWLINE_    };_NEWLINE__NEWLINE_    let doIt = function () {_NEWLINE_        for (let i = 0; i < 20; i++)_NEWLINE_            moveAll()_NEWLINE_    };_NEWLINE__NEWLINE_    function moveAll() {_NEWLINE__NEWLINE_        let nextX, nextY;_NEWLINE_        let r = Math.random();_NEWLINE_        if (r < 0.01) {_NEWLINE_            nextX =  0;_NEWLINE_            nextY =  0.16 * y;_NEWLINE_        } else if (r < 0.86) {_NEWLINE_            nextX =  0.85 * x + 0.04 * y;_NEWLINE_            nextY = -0.04 * x + 0.85 * y + 1.6;_NEWLINE_        } else if (r < 0.93) {_NEWLINE_            nextX =  0.20 * x - 0.26 * y;_NEWLINE_            nextY =  0.23 * x + 0.22 * y + 1.6;_NEWLINE_        } else {_NEWLINE_            nextX = -0.15 * x + 0.28 * y;_NEWLINE_            nextY =  0.26 * x + 0.24 * y + 0.44;_NEWLINE_        }_NEWLINE__NEWLINE_        // Skalowanie i pozycjonowanie_NEWLINE_        let plotX = canvas.width * (x + 3) / 6;_NEWLINE_        let plotY = canvas.height - canvas.height * ((y + 2) / 14);_NEWLINE__NEWLINE_        drawFilledCircle(plotX, plotY, pointRadius, pointColor);_NEWLINE__NEWLINE_        x = nextX;_NEWLINE_        y = nextY;_NEWLINE__NEWLINE_    }_NEWLINE_    const drawFilledCircle = (centerX, centerY, radius, color) => {_NEWLINE_        canvasContext.beginPath();_NEWLINE_        canvasContext.fillStyle = color;_NEWLINE_        canvasContext.arc(centerX, centerY, radius, 0, 2 * Math.PI, true);_NEWLINE_        canvasContext.fill();_NEWLINE_    };</script>\n_START_SECTION_\nQBasic\n_START_PARAGRAPH_\nProgramy napisany w QBasic:_NEWLINE_SCREEN 12WINDOW (-5, 0)-(5, 10)RANDOMIZE TIMERCOLOR 10DO    SELECT CASE RND        CASE IS < .01            nextX = 0            nextY = .16 * y        CASE .01 TO .08            nextX = .2 * x - .26 * y            nextY = .23 * x + .22 * y + 1.6        CASE .08 TO .15            nextX = -.15 * x + .28 * y            nextY = -.26 * x + .24 * y + .44        CASE ELSE            nextX = .85 * x + .04 * y            nextY = -.04 * x + .85 * y + 1.6    END SELECT    x = nextX    y = nextY    PSET (x, y)LOOP UNTIL INKEY$ = CHR$(27)\n_START_SECTION_\nR\n_START_PARAGRAPH_\nProgram napisany w j\xc4\x99zyku R:_NEWLINE_# Papro\xc4\x87 Barnsley\'a# Utworzenie funkcji z rachunkiem prawdopodobie\xc5\x84stwa i obecnym punktem_NEWLINE_fractal_fern2 <- function(x, p){_NEWLINE_  if (p <= 0.01) {_NEWLINE_    m <- matrix(c(0, 0, 0, .16), 2, 2)_NEWLINE_    f <- c(0, 0)_NEWLINE_  } else if (p <= 0.86) {_NEWLINE_    m <- matrix(c(.85, -.04, .04, .85), 2, 2)_NEWLINE_    f <- c(0, 1.6)_NEWLINE_  } else if (p <= 0.93) {_NEWLINE_    m <- matrix(c(.2, .23, -.26, .22), 2, 2)_NEWLINE_    f <- c(0, 1.6)_NEWLINE_  } else {_NEWLINE_    m <- matrix(c(-.15, .26, .28, .24), 2, 2)_NEWLINE_    f <- c(0, .44)_NEWLINE_  }_NEWLINE_  m %*% x + f_NEWLINE_}# liczba powt\xc3\xb3rze\xc5\x84; im wi\xc4\x99ksza, tym bardziej dok\xc5\x82adny efekt ko\xc5\x84cowy_NEWLINE_reps <- 10000# stworzenie wektora z warto\xc5\x9bciami prawdopodobie\xc5\x84stwa oraz macierzy do przechowywania wsp\xc3\xb3\xc5\x82rz\xc4\x99dnych_NEWLINE_p <- runif(reps)# zainicjalizowanie punktu pocz\xc4\x85tkowego w pocz\xc4\x85tku uk\xc5\x82adu wsp\xc3\xb3\xc5\x82rz\xc4\x99dnych_NEWLINE_coords <- c(0, 0)# obliczanie wsp\xc3\xb3\xc5\x82rz\xc4\x99dnych fraktalu_NEWLINE_m <- Reduce(fractal_fern2, p, accumulate = T, init = coords)_NEWLINE_m <- t(do.call(cbind, m))# stworzenie wykresu_NEWLINE_plot(m, type = "p", cex = 0.1, col = "darkgreen",_NEWLINE_     xlim = c(-3, 3), ylim = c(0, 10),_NEWLINE_     xlab = NA, ylab = NA, axes = FALSE)\n_START_SECTION_\nProcessing\n_START_PARAGRAPH_\nProgram napisany w Processing (wersja 3.4):_NEWLINE_// deklarowanie zmiennych x i yfloat x, y;// stworzenie planszyvoid setup() {_NEWLINE_  size(600, 600);_NEWLINE_  background(255);}/* ustawianie wygl\xc4\x85du punkt\xc3\xb3w, mapowanie planszy i nast\xc4\x99pnie rysowanie punkt\xc3\xb3w */void drawPoint() {_NEWLINE_  stroke(34, 139, 34);_NEWLINE_  strokeWeight(1);_NEWLINE_  float px = map(x, -2.1820, 2.6558, 0, width);_NEWLINE_  float py = map(y, 0, 9.9983, height, 0);_NEWLINE_  point(px, py);}/* algorytm na obliczanie (n+1)ego  wyrazu x i y bazuj\xc4\x85cy na przekszta\xc5\x82ceniu macierzy */void nextPoint() {_NEWLINE_  float nextX, nextY;_NEWLINE_  float r = random(1);_NEWLINE_  if (r < 0.01) {_NEWLINE_    nextX =  0;_NEWLINE_    nextY =  0.16 * y;_NEWLINE_  } else if (r < 0.86) {_NEWLINE_    nextX =  0.85 * x + 0.04 * y;_NEWLINE_    nextY = -0.04 * x + 0.85 * y + 1.6;_NEWLINE_  } else if (r < 0.93) {_NEWLINE_    nextX =  0.20 * x - 0.26 * y;_NEWLINE_    nextY =  0.23 * x + 0.22 * y + 1.6;_NEWLINE_  } else {_NEWLINE_    nextX = -0.15 * x + 0.28 * y;_NEWLINE_    nextY =  0.26 * x + 0.24 * y + 0.44;_NEWLINE_  }_NEWLINE_  x = nextX;_NEWLINE_  y = nextY;}/* iteracja w p\xc4\x99tli funkcji obliczaj\xc4\x85cych i rysuj\xc4\x85cych */void draw() {_NEWLINE_  for (int i = 0; i < 100; i++) {_NEWLINE_    drawPoint();_NEWLINE_    nextPoint();_NEWLINE_  }}'