Published
Edited
May 19, 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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// The arguments are the coefficients of the polynomial, in the order above.
p = CompletePolynomial([1,1,0,1])
Insert cell
// You can provide an array with the value of each variable, in order, to determine
// the output of the function. Here x1 = 0, x2 = 1.
p.eval([0,1])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
p.eval([0,1])
Insert cell
p.eval([1,0])
Insert cell
Insert cell
Insert cell
p1 = CompletePolynomial([1,1,1,1])
Insert cell
p1.eval([0,1]) == p1.eval([1,0])
Insert cell
md`Remove the ${tex`x_1`} term: ${tex`1 + x_1 x_2`}`
Insert cell
p2 = CompletePolynomial([1,0,0,1])
Insert cell
p2.eval([0,1]) == p2.eval([1,0])
Insert cell
Insert cell
// This is the same as the p1 polynomial, we just created it in a different way.
p1_s = SymmetricPolynomial([1,1,1])
Insert cell
p1_s.eval([0,1]) == p1_s.eval([1,0])
Insert cell
// This is the same as the p2 polynomial, we just created it in a different way.
p2_s = SymmetricPolynomial([1,0,1])
Insert cell
p2_s.eval([0,1]) == p2_s.eval([1,0])
Insert cell
Insert cell
Insert cell
Insert cell
q = SymmetricPolynomial([0,0,1])
Insert cell
Insert cell
r = SymmetricPolynomial([0,1,1])
Insert cell
Insert cell
s = RandomChoice(q, r, 0.5)
Insert cell
Insert cell
{
const state = [0,1];
return {q: q.eval(state), r: r.eval(state), s: s.eval(state)};
}
Insert cell
Insert cell
Insert cell
import { FunctionSpace, CompletePolynomial, SymmetricPolynomial, RandomChoice } from "@dglmoore/hfsp"
Insert cell
import { Range, Table } from "@observablehq/inputs"
Insert cell
jscomb = import('https://cdn.jsdelivr.net/npm/js-combinatorics@1.4.5/combinatorics.min.js');
Insert cell
d3 = require('d3@6')
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