import numpy as np
import math as m
from matplotlib import pyplot as plt
#Q1
def bm(s,n):
np.random.seed(222)
dw = np.random.normal(0,1,size=(s,n))*m.sqrt(1/n)
w = np.cumsum(dw, axis=1)
a = np.mean(w, axis=0)
b = np.std(w, axis=0)
plt.plot(np.arange(n),w[:10:,:].T)
plt.plot(np.arange(n),a.T)
plt.plot(np.arange(n),b.T)
plt.show()
bm(1000,600)
This code creates Brownian Motions generated from random standard normal distributions. Every graph needs to start at 0, so I need to append 0 to the beginning of each graph. How can I do this?
pyplotis imported aspltrather thanpt.