Share Brilliantly
differential equations
let state= {
orders:20,
rawMaterials:0,
finishedProduct:0,
shippedProduct:0
};
function next(state){
let result = {};
result.orders = 20;
result.rawMaterials = state.orders + state.rawMaterials * 0.1;
result.finishedProduct = state.rawMaterials *0.9;
result.shippedProduct = state.finishedProduct + state.shippedProduct;
return result;
}
let series = [state];
$range(1,20).forEach(p=>{
state = next(state);
series.push(state);
})
Try it!