Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We wish to do an experiment to determine if ants search for food using a random search or directed search method. To help design the
We wish to do an experiment to determine if ants search for food using a random search or directed search method. To help design the experiment we first will run some simulations. In the experiment,
ants are placed inside a box. They cannot climb the wall, but can escape through an opening of size in the wall. Repeated measurements of how far an ant travels in second
show an average speed of per second. Our simulation needs to determine the probability that an ant escapes the box in seconds hint: so your main iteration would look like for in
range : if their motion is indeed random. Assume the ant is always initially placed in the center of the box and simulate a simple random walk in D on discrete time in this fashion: Have the ant
live on a discrete lattice. The ant takes to the left if a random number satisfies The ant moves to the right if the ant moves up if and
down if is distributed uniformly between and hint: use np random. uniform low high to generate it If a step would take the ant into a wall, repeat the step until it
is successful result is still one timestep With attempts linspace run your main iteration under the loop for in attempts: and construct a dataframe with columns
for number of attempts ie M number of escapes, and probability of escape for every M Your dataframe would eventually look something like this with rows and real values:
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