Creates a very simple monad, so you can give it a value - continually modifying it as you'd like, and then get a value out of it.
addTwo = (value) => value + 2;
addTwo(3); // 5
// https://stackoverflow.com/questions/25582882/javascript-math-random-normal-distribution-gaussian-bell-curve | |
module.exports.boxMueller = function boxMueller(min = 0, max = 1) { | |
const u = 1 - Math.random(); | |
const v = Math.random(); | |
let num = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v); | |
// translate from (-10,10) to (0,1) inclusive | |
num = num / 10.0 + 0.5; // Translate to 0 -> 1 | |
num = Math.max(0, num); | |
num = Math.min(1, num); |
Very simple snippet to export a set of objects, into:
Note that vega (through altair) is supported in iPython through Altair
If we wanted to make simple charts within a JavaScript environment, such as the iJavaScript kernel, then what we need to do are four main steps.
The snippet below handles this for you, so you can do something like this: