Question
using python,matplotlib,numpy,random modules Define a function that generates a random vector field on the grid. This function may take as input, for instance, the size
using python,matplotlib,numpy,random modules
Define a function that generates a random vector field on the grid. This function may take as input, for instance, the size of the grid or where it is located in space. How you generate random vectors will be left up to you, but you are encouraged to make use of numpy.random functions to generate your random vectors. This function should return the vector field (as an nd.array, for instance). This function does not perform any graphing.
Define a function that graphs a given vector field on the grid. Make sure this function is compatible with the output format from the previous function. This function must take a vector field as input, but you may again take as input the size of the grid or other similar inputs if this seems necessary to you. However, this function should only graph a given vector field, it shouldnt try to create a vector field. Define a function that performs the random walk described in this project. This function should of course take a vector field as its input. In theory, these random walks can go on forever so feel free to end the random walk after a certain number of steps or after the random walk leaves the grid. You may find when testing this that vectors that are too small result in walks that dont go anywhere or get stuck too easily, which may force you to enlarge the random vectors being generated in the first function in order to get interesting results. This function does not perform any graphing, but instead returns the random walk as some sort of list/array showing each step.
Define a function to plot the random walk. Make sure this function is compatible with the output format of the previous function. This function should only graph the random walk, it shouldnt try to create a random walk.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started