# -*- coding: utf-8 -*- """ Created on Wed Oct 19 13:11:42 2016 @author: florent In this program, we set f(t)=exp(-t) and compute the Ito process X starting at zero such that (for B a Browian motion) dX=f(t)dB We plot f,B,X """ import numpy as np import numpy.random as npr import scipy.stats as sps import matplotlib.pyplot as plt T=5. N=int(1e4) deltat=T/float(N) t=np.linspace(start=0,stop=T,num=N) dB=np.sqrt(deltat)*npr.randn(N) B=np.cumsum(dB) expmt=np.exp(-t) X=np.cumsum(expmt*dB) plt.plot(t,expmt,"g--",label="f(t)") plt.plot(t,B,color="r",label="B") plt.plot(t,X,color="b",label="X") plt.legend(loc="best")