m4_define(memoed, `$1() {return("$1" in Memo?Memo["$1"]:Memo["$1"]=_memoed_$1() )} function _memoed_$1()') function model() { return x() - 1/x() } function memoed(x) { return normal(10,4) } function normal(m,s) { return m+box_muller()*s; } function box_muller(m,s, n,x1,x2,w) { w=1; while (w >= 1) { x1= 2.0 * rand() - 1; x2= 2.0 * rand() - 1; w = x1*x1 + x2*x2}; w = sqrt((-2.0 * log(w))/w); return x1 * w; }