fractalkitty looking for math? fractalkitty.com

all

π²/6

#text#image#interactive#animation#accumulates#math#number-theory

sumNroundDsumationaddN

let sumN = 0;
let n, d, A;
let roundD = 7;
let sumation;
function preload() {
  sumation = loadImage("/assets/pi6.png");
  A = 0;
}
function setup() {
  cnv = createCanvas(500, 500);
  background(255);
  n = 1;
  d = width / 2;
  strokeWeight(0.05);
  image(sumation, 20, 20, 50, 30);
}
function draw() {
  frameRate(min(n, 60));
  translate(width / 2, height / 2);
  push();
  noStroke();
  rect(-width / 2 + 10, height / 2 - 40, width, 30);
  pop();
  text("Diameter:" + round(sumN, roundD), -width / 2 + 20, height / 2 - 20);
  text(
    "π²/6:  " + str(round((PI * PI) / 6, roundD)),
    width / 2 - 90,
    height / 2 - 20
  );
  text("n: " + str(n), 0, height / 2 - 20);
  addN();
}

function mousePressed() {
  for (let i = 0; i < 1000; i++) {
    addN();
  }
}

function addN() {
  strokeWeight(max(40 / (n * n), 0.05));
  sumN = 1 / (n * n) + sumN;
  A = (PI * sumN * sumN) / 4;
  push();
  noFill();
  circle(0, 0, sumN * d);
  pop();
  n++;
}