Published
Edited
Nov 22, 2021
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
digraphIFS = {
let phi = (1 + Math.sqrt(5)) / 2;
let g = 2 * Math.PI * (2 - phi);
let r = 0.96;

return new DigraphIFS([
{
source: 0,
target: 0,
f: rotate(3 * g).compose(scale(r)),
p: 0.92
},
{
source: 0,
target: 1,
f: shift([1, 0]).compose(scale(0.1)),
p: 0.3
},
{
source: 1,
target: 0,
f: shift(rotate(g).compose(scale(r)).f([1, 0])).compose(scale(0.1)),
p: 0.04
},
{
source: 1,
target: 0,
f: shift(
rotate(2 * g)
.compose(scale(r ** 2))
.f([1, 0])
).compose(scale(0.1)),
p: 0.04
},
{
source: 1,
target: 1,
f: rotate(3 * g).compose(scale(r)),
p: 0.7
}
]);
}
Insert cell
Insert cell
my_pics = digraphIFS.render_stochastic({ n: 50000 })
Insert cell
Insert cell
my_pics[0]
Insert cell
Insert cell
digraphIFS.render_stochastic({ n: 100000, edge_probabilities: "input" })[0]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
digraphIFS.dimension
Insert cell
Insert cell
Insert cell
pics = digraphIFS.render_stochastic({
n: 100000,
colors: true,
image_width: width / 2 - 2,
edge_probabilities: auto_probabilities ? "compute" : "input"
})
Insert cell
import {
scale,
shift,
rotate,
reflect,
pi,
DigraphIFS
} from "@mcmcclur/digraphifs-class"
Insert cell
MathJax = require("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js").catch(
() => window["MathJax"]
)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more