Question: Write a program in R, Python or your favourite programming language to plot a random walk approximation to Brownian motion. You should write a function/method

Write a program in R, Python or your favourite programming language to plot a random walk approximation to Brownian motion.

You should write a function/method called RWapprox(a,mu,sigma,t,n,yrange) that does the following:

Generate a vector T of t values t0, . . . , tn with tj = (j/n) t;

Generate a vector Y of y values y0, . . . , yn with y0 = a and yj+1 is randomly either yj + h with probability 1/2* (1 + (/) *h) or yj h with probability 1/2* (1 - (/) *h) where h is the time step, t/n (and is mu and is sigma);

Plot the points (t0, y0), . . . , (tn, yn) joined by lines on axes where the horizontal axis goes from 0 to t; and the vertical axis goes from yrange to +yrange.

Display a sample output of RWapprox(0,0,1,10,10,5) RWapprox(0,0,1,10,100,5), RWapprox(0,0,1,10,1000,5) and RWapprox(0,0,1,10,1000000,5)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!