fractalkitty looking for math? fractalkitty.com

Mathober 2025

Orthogonal Polynomial

#random#trig#grid#interactive#animation#math#spiral#polar#mathober

hermitedrawGrid


let t = 0;
let n = 25;
let g = 6;
function setup() {
  createCanvas(500, 500);
  background(255);
  describe(
    "Radial graph paper with staticky graphs of a circle, spiral, and other Hermite Polynomials where x is the angle and H(x) is the radius in polar coordinates."
  );
  rectMode(CENTER);
  strokeWeight(0.5);
  strokeCap(SQUARE);
  g = random([3, 4, 5, 6, 7, 8, 10, 11, 12, 15]);
}

function draw() {
  background(245, 250, 255, 20);
  translate(width / 2, height / 2);
  stroke(100, 110, 120, 10);
  drawGrid();
  v = 0;
  t += 0.05;

  hermite();
  strokeWeight(1);
  noFill();
  stroke(100, 110, 120, 30);
  rect(0, 0, width / 1.02, width / 1.02);
  rect(0, 0, width / 1.04, width / 1.04);
}

function hermite() {
  fill(50, 60, 70, 150);
  noStroke();
  one = width / 25 / 2;

  for (let i = 0; i < 1000; i++) {
    a = one * 1 + randomGaussian(0, 1);
    x = random(0, 4 * PI);
    circle(a * cos(x), a * sin(x), randomGaussian(1, 0.5));
    a = one * 2 * x + randomGaussian(0, 1);
    circle(a * cos(x), a * sin(x), randomGaussian(1, 0.5));
    a = one * (4 * x * x - 2) + randomGaussian(0, 1);
    circle(a * cos(x), a * sin(x), randomGaussian(1, 0.5));
    a = one * (8 * x * x * x - 12 * x) + randomGaussian(0, 1);
    circle(a * cos(x), a * sin(x), randomGaussian(1, 0.5));
    a = one * (16 * x * x * x * x - 48 * x * x + 12) + randomGaussian(0, 1);
    circle(a * cos(x), a * sin(x), randomGaussian(1, 0.5));
    a =
      one * (32 * x * x * x * x * x - 160 * x * x * x + 120 * x) +
      randomGaussian(0, 1);
    circle(a * cos(x), a * sin(x), randomGaussian(1, 0.5));
  }
}

function drawGrid() {
  for (let i = 0; i < n; i++) {
    rotate((2 * PI) / n);
    line(-width / 1.5, 0, width / 1.5, 0);
    circle(0, 0, (width / n) * 2 * i);
  }
  noStroke();
  for (let i = 0; i < 500; i++) {
    x = random(-width / 2, width / 2);
    y = random(-width / 2, width / 2);
    fill(245, 250, 255, 150);
    circle(x, y, 2);
  }
}

function mousePressed() {
  setup();
  draw();
}