Skip to content

Instantly share code, notes, and snippets.

@sspboyd
Created August 9, 2022 17:04
Show Gist options
  • Save sspboyd/dc7dae47f8ae3d42b82a111388c3ad7e to your computer and use it in GitHub Desktop.
Save sspboyd/dc7dae47f8ae3d42b82a111388c3ad7e to your computer and use it in GitHub Desktop.
The following are a collection of mathematical constants I use in my coding/art practice. The constants are typically used to modulate the relationships between visual elements on screen or bias the selection between different options.
// Stephen Boyd, @sspboyd
// August 2022.
// The following are a collection of mathematical constants I use in virtually
// all of my coding/art practice.
// The constants are typically used to modulate the relationships between
// visual elements on screen or bias the selection between different options.
const SQR_2 = 1.4142135623730951;
const TWO_PI = 6.283185307179586;
// Sourced from:
// https://en.wikipedia.org/wiki/List_of_mathematical_constants
const SR = {
nat: 2.4142135623730951,
inv: 1 / 2.4142135623730951,
title: "The Silver Ratio",
forumla: 1 + Math.sqrt(2),
};
const PHI = {
nat: 1.618033988749895,
inv: 0.6180339887498948,
title: "PHI",
formula: (Math.sqrt(5) + 1) / 2,
};
const SGR = {
nat: 1.46557123187676802665,
inv: 1 / 1.46557123187676802665,
title: "Super Golden Ratio",
};
const GA = {
nat: 2.39996322972865332223,
inv: 1 / 2.39996322972865332223,
title: "The Golden Angle",
};
const EUL = {
nat: 2.71828182845904523536,
inv: 1 / 2.71828182845904523536,
title: "Euler's Number",
};
const RFC = {
nat: 3.35988566624317755317,
inv: 1 / 3.35988566624317755317,
title: "Reciprocal Fibonacci constant",
};
const FC = {
nat: 4.66920160910299067185,
inv: 1 / 4.66920160910299067185,
title: "Feigenbaum constant",
};
export { TWO_PI, SQR_2, RFC, FC, SR, PHI, GA, SGR, EUL };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment