Skip to content

Instantly share code, notes, and snippets.

@chrishwiggins
Last active April 11, 2016 06:27
Show Gist options
  • Save chrishwiggins/d119bb0a33b9545209f17c116fccffdb to your computer and use it in GitHub Desktop.
Save chrishwiggins/d119bb0a33b9545209f17c116fccffdb to your computer and use it in GitHub Desktop.
%%% little code to compute steady state "q" from creation+decay "wp,wm"
% wp=creation
% wm=destruction
function q=qdef(wp,wm);
% 1) most important line p=\Pi (wp_j/wm_{j+1})=S^+_n/S^-/n
p=cumprod( wp(1:(end-1)) ...
./ ...
wm((1+1):end) ...
);
% 2) add p0=1
p=[1;p(:)];
% 3) normalize
q=p(:)/sum(p(:));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment