Given an Ito Diffusion i.e.:
$$ dX(t) = \mu dt + \sigma dW(t) $$
and a function
$$ k(x) = \lambda x^2 $$
and I want to find the expected value $E[k(X(t)]$ of the function - the only way I know how to do is to average the function evaluated at the solution of the diffusion
$$ E[k(X(t))] = \frac{1}{n} \sum_{1}^{n} k(X_i(t)) $$
where $n$ is the number of the simulated paths.
If the transition density of the diffusion is known i.e.:
$$ p(x,t) = \frac{1}{\sqrt(2 \pi \sigma^2 t)} e^\frac{-(x-x_0-\mu t)^2}{2 \sigma^2 t}$$
Can I say that the expectation is also equal to the following?
$$ E[k(X(t))] = \intop\nolimits_{-\infty}^{\infty} k(x) p(x,t)dx $$
where $k(x) = \lambda x^2$ deterministic
You will need the ito lemma:
For $dX_{t}=\mu _{t}\,dt+\sigma _{t}\,dB_{t}$ and $f=f(t,x)$ , we have $ df=\left({\frac {\partial f}{\partial t}}+\mu _{t}{\frac {\partial f}{\partial x}}+{\frac {\sigma _{t}^{2}}{2}}{\frac {\partial ^{2}f}{\partial x^{2}}}\right)dt+\sigma _{t}{\frac {\partial f}{\partial x}}\,dB_{t} $
and the required parameter you are looking for is $\left({\frac {\partial f}{\partial t}}+\mu _{t}{\frac {\partial f}{\partial x}}+{\frac {\sigma _{t}^{2}}{2}}{\frac {\partial ^{2}f}{\partial x^{2}}}\right)$ .