Mathematics Intersection Programming

Karthik Thiagarajan

IIT Madras

2026-01-24

Sneak Peek

Motion

Randomness

Fractals

p5.js

Go to

https://editor.p5js.org/

Created by

Lauren McCarthy

What is it?

https://p5js.org/

Why “p”, “5” and “js”?

https://processing.org/

  • p for Processing
  • 5 for HTML5
  • js for javascript

Workshop

Pre-requisites

  • Familiarity with at least one programming language
  • Basic vector algebra
  • Basic probability
  • Knowledge of JavaScript not required

Format

  • Code along
  • Workshop
    • Learn how to build something
    • Build something
  • Learning outcomes
    • Basic JavaScript
    • JavaScript library
    • Creative coding

Certificate

Record a Video

  • Screencast with voice-over
  • Video has to be at least 15 minutes
  • Content
    • art
    • mathematics
    • physics
  • You must code live without the help of AI

Review other Submissions

  • All submissions will be added to a playlist
  • Review at least three submissions by your peers
  • Record a useful comment for each submission that you review

AI

AI Usage

  • Intelligent use of AI
    • Using it to get feedback.
    • Using it to get alternative versions.
  • Unacceptable use of AI
    • Using it to get the complete code.
    • Using it to fix bugs.
    • Using it to review other submissions.

Warning

  • Machines reduce human effort
  • Reduction in effort is not always desirable
  • Effort brings joy
  • Coding can be fun

Basic p5.js

Basics

Executation sequence

  • setup

  • draw

  • frameRate

  • frameCounter

Interactivity

  • mouseX, mouseY

  • mouseIsPressed

  • mousePressed

  • keyPressed

Randomness

Random Walker

Uniform Distribution

Gaussian Distribution

Gaussian Distribution