In this project, you are going to write a program which draws the
trajectory of an E. coli bacterium looking for food.
- The food is located at position,
.
- The bacterium starts out at position,
.
- The initial heading of the bacterium,
, is random.
- When not tumbling, the bacterium moves in a straight line with
speed one pixel per second.
- The distance between the bacterium and the food can
be computed using the following formula:
where
is the distance of the bacterium from the food,
and
are the
and
coordinates of the bacterium's
position (all at time,
).
- The probability that the bacterium will tumble at any given time
can be computed using the following formula:
where
and
are the distances of the bacterium
from the food at time,
and
. Notice that
is nearly one
when
(the bacterium is going in the wrong
direction) and nearly zero when
(the
bacterium is going in the right direction).
- The heading of the bacterium at time
remains the same
with probability,
, and changes by
, a random
number between 0 and 359, with probability,
:
where
is a random number between 0 and 359.
- The position of the bacterium at time
can be computed
from the position at time
and the heading using the
following equations:
where
is the heading of the bacterium at time,
.
- The bacterium stops when it is less than one pixel from the
food, i.e.,
.