Published
Edited
Nov 26, 2018
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
convexity = {
const fn = ([p1, p2, p3]) => {
if (p1 > p2 && p2 > p3) return -1 * fn([p3, p2, p1]);
const b = Math.abs(delta(p2, p3) / p2);
const a = delta(p1, p2) / p1;
return a == 0 || b == 0 ? a || -b || 0 : b / a;
};
return fn;
}
Insert cell
convexity([10, 10, 9]) // between -1 and 0
Insert cell
convexity([9, 10, 10]) // between 0 and 1
Insert cell
convexity([8, 10, 12]) // should be between 0 and 1 - inc but no accel
Insert cell
convexity([8, 10, 14]) // something above 1 - accel
Insert cell
convexity([8, 10, 20]) // something above 1 - accel
Insert cell
Insert cell
Insert cell
convexity([10, 10, 10]) // should be 0
Insert cell
convexity([14, 10, 8]) // something below 1 - decel
Insert cell
Insert cell
roc = ([a, b]) => delta(a, b) / a
Insert cell
Insert cell
mulTx = src => withLastTx((last, now) => (1 + last) * now, 1, src)
Insert cell
[...mulTx([1, 2, 3])]
Insert cell
[...withLastTx((last, now) => (1 + last) * now, 1, [1, 2, 3])]
Insert cell
Insert cell
// rocPathTxOld = tx.comp(tx.partition(2, 1), tx.map(roc), mulTx())
Insert cell
// [...tx.iterator(rocPathTxOld, [1, 2, 4, 8, 16])]
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
// path of change
pocTx = period => tx.comp(txStats.roc(period), mulTx())
Insert cell
pocTraceTx = period =>
tx.comp(
tx.multiplex(pocTx(period), tx.identity),
tx.map(([poc, val]) => val * (1 + poc))
)
Insert cell
[...tx.iterator(pocTraceTx(2), [10, 10.4, 10.1, 9.8])]
Insert cell
[...tx.iterator(pocTx(1), [1, 0.5, 1, 0.8, 1, 0.2, 0.1])]
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
txStats.roc(1, [10, 25])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
quantInfo = applyFnMap(quantInfoFns)
Insert cell
Insert cell
// quantInfoTx = tx.multiplexObj({})
Insert cell
Insert cell
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