New answers tagged


Once $q(x)$ is normalized, then the mean of $X$ is 0. Therefore, the variance is the expectation of $X^2$. To estimate the variance using self-normalizing importance sampling one can perform the following steps: (* Define the function proportional to the pdf of the nominal distribution *) q[x_] := Exp[-Abs[x]^3/3] (* pdf of proposal distribution (also ...


Tis needs an explanation. Consider: fred := a*b; bob[a_, b_] := fred; joe[a_] := Sum[Print[{"a=", a, "b=", b, "bob=", HoldForm[bob[a, b]], bob[a, b], "fred=", fred}]; bob[a, b], {b, Range[3]}]; joe[2] {a=,2,b=,1,bob=,bob[2,b],a,fred=,a} {a=,2,b=,2,bob=,bob[2,b],2 a,fred=,2 a} {a=,2,b=,3,bob=,bob[2,b],3 a,fred=...


The question is similar to how to construct a series of pure functions. Function /@ Table[(Slot[1] + Slot[2]) v, {v, {Slot[1], Slot[2]}}] Some codes similar with @BobHanlon in the comment is Outer[Function[{x, y}, (x + y) #] &, {x, y}]

Top 50 recent answers are included