Published
Edited
Mar 6, 2020
Importers
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
draw((data) => {
// q = a l
const q = (time, u, v) => (0.5 * Math.exp(alpha*time))*(v*0.5 * Math.exp(beta*time))
const {x: t, y: ys} = data;
const lines = [];
lines.push({
x: t,
y: ys.map( (y, i) => [q(t[i], y[0], y[1])] ),
color: '#000000',
size: 1,
label: 'gross output'
});
return lines;
}, { yRange: [0, 500], xRange: [0, 200]} )
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof policy = policyCtrl
Insert cell
Insert cell
updatePolicy()
Insert cell
setSteadyState = () => {
viewof xy.value = [1 - (delta+alpha+beta)*sigma/s, (gamma+alpha)/rho];
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
draw((data) => {
const {x: t, y: ys} = data;
return [{
x: t,
y: ys.map( (y, i) => [getProfitRate(t[i], y[0], y[1])] ),
color: PROFIT_RATE_COLOR,
size: 1,
}];
})
Insert cell
Insert cell
Insert cell
Insert cell
md`
## Derived Measurements
`
Insert cell
getProfitRate = (time, u, v) => (1-s)*(1-u)/((0.5*Math.exp(alpha*time))*(0.5*Math.exp(beta*time))*sigma*v)
Insert cell
PROFIT_RATE_COLOR = colors[0]
Insert cell
gq = (_t, u, _v) => s*(1-u)/sigma - delta
Insert cell
GQ_COLOR = colors[1]
Insert cell
gl = (_t, u, _v) => s*(1-u)/sigma - delta -alpha
Insert cell
GL_COLOR = colors[2];
Insert cell
gw = (_t, _u, v) => rho*v - gamma
Insert cell
GW_COLOR = colors[3]
Insert cell
Insert cell
Insert cell
draw = (getState = x => x, options = {}) => {
console.log('alpha='+alpha);
console.log('beta='+beta);
const [x0, y0] = init;
const data = simulate(0, 100, [x0, y0], goodwin({ alpha, beta, gamma, delta, sigma, rho, s}));
const lines = getState(data)
return getMultiLineGraph(lines, {
width: width,
height: 420,
margin: {top: 20, right: 30, bottom: 30, left: 40},
xRange: [0, 100],
yRange: [0, 30],
xLabel: 'time',
...options
});
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
OUTPUT_SHARE_COLOR = xColor
Insert cell
EMPLOYMENT_RATE_COLOR = yColor
Insert cell
Insert cell
init = xy
Insert cell
Insert cell
import { getMultiLineGraph, colors } from "@mstn/graphs"
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