Generic Feedback for Project 2

Generic Feedback for Project 2
1
Writing and Exposition
Beside many common mistakes similar to those in Project 1, specific problems related to this project
are listed and commented below.
1.1
Reference to existing materials
This project is extended from the case study Pursuit Problems with Event Location from the textbook [2, Chap. 12]. There are several common problems related to citation and referencing. Usually,
if there is any materials (paraphrased sentences or equations), the reference should be cited explicitly; there were cases where sentences or equations were copied without proper citation.
The above reference about the case study of the pursuit problem is a book. Even if the material
can be accessed from the internet, what should appear in the bibliography is the information of the
book, but not just the URL (which is optional).
Many copied directly from [2] the following ODEs1
d
y1 (t) = s(t) r1 (t) − y1 (t) ,
dt
d
y2 (t) = s(t) r2 (t) − y2 (t) ,
dt
where
k
q
2
d
r (t)
dt 1
+
2
d
r (t)
dt 2
.
s(t) = q
2
2
(r1 (t) − y1 (t)) + (r2 (t) − y2 (t))
However, there are many reasons to use a variant of these equations:
(1) The above equations actually come from the reference [1] (cited in [2]), where more background
information about the problem and more insights can be found. In general, authoritative
original references like [1] are preferred to the second hand references like [2],
(2) The notations used above are not so consistent with those in the project description: here
(r1 , r2 ) and (y1 , y2 ) are the coordinates of the rabbit and the fox respectively, while subscripts
r and f are used in the project description.
(3) Finally, it is better to avoid extra notations like s(t) (which is not exactly the speed). The
variable k as the ratio of the speed is popular in the dynamics, because it characterises one
important property of dynamics with constant speeds: if k > 1, the predator will eventually
catch the prey. But in Question 2, k is not a constant and the formulation of the equation is
more complicated than needed (similarly for the code based on this formulation).
1
Here there are two ordinary differential equations, and it is a minor mistake say “the ODE” as in [2].
In summary, if used in the right way, citations can make your writing more authoritative, but other
practical considerations about how the cited references fit into your report should be taken carefully.
1.2
Ambiguous pronouns
Because two animals are involved in the dynamics, very often the pronoun “it” can be ambiguous
in a sentence (is “it” the fox or the rabbit?), like the following example:
If the rabbit is in sight, the fox will run directly towards it, until either it catches it.
While there should be no ambiguity for the first it (the rabbit), but this is not the case for the next
two. This sentence can be rewritten as
If the rabbit is in sight, the fox will run directly towards it, until either it catches the
rabbit.
There are other ambiguous pronouns like this, that, etc.
The system of ODEs can be solved by ode45 with Event Location. This can be done
easily in MATLAB.
It is a little ambiguous what “this” is in the above example (the solver or the Event Location?)
Probably you do not need another short yet complete sentence to say something can be done
“easily“; you can just add add the word ”easily“ into the previous sentence.
1.3
Other issues
(a) Instead of modelling with differential equations, it is perfectly fine to formulate and solve the
problem in discrete time steps. But in most reports where the latter approach was taken, more
details should be given. Some justification of the time step chosen should be discussed, so that
the conclusion will not change as the size of the time step varies (especially when the time step
is chosen as unit).
(b) Avoid copying directly large chunk of texts from the project description—try to formulate the
problem in your own words.
(c) The quality of the figures in many reports should be improved 2 . More details can be found in
the slides Publishable Quality Graphics. Figures should be labeled with captions, and referred
in the text. Avoid using the above/below figure (use Figure 1 or Fig. 1 instead), because the
relative position of the figures could change with automatic typesetting softwares like LATEX.
(d) Some got the conclusion that the south-west corner does not block the sight because the path do
not intersect the part of the warehouse near this corner. Unfortunately, this is true only under
very restricted conditions. For instance, counterexamples can be constructed for Question 2,
where the sight could be blocked by the southwest corner while the path without considering
the warehouse does not actually intersect the warehouse.
(e) When defining angles, for instance, for the line from (x
f , yf ) to (xr , yr ), avoid using absolute
yr − yf yr − yf
(then you have to discuss the
instead of θ = arctan value, that is, θ = arctan
xr − xf
xr − xf relative positions again). An even better command is atan2, where atan2(y,x) returns the
angle of the point (x,y) on the plane with range (−π, π].
2
All reports are marked based on the original submitted version, not the Blackboard version with digit receipt in
which figures look more “blurry”.
(f) Avoid abbreviations like SOHCAHTOA. (You can assume that the readers are familiar with
basic trigonometry, and you can safely ignore trivial definitions like those for sine and cosine).
(g) It is better to assign variables for the initial conditions and other parameters, and then use
these variables through the code. This practice will minimise the possible places of changes,
when certain parameters are altered.
(h) For the ODEs for the distance travelled,
d
df (t) = sf 0 e−µf df (t) ,
dt
d
dr (t) = sr0 e−µr df (t)
dt
the solutions can be obtained by explicit integrals (they are separable first order ODEs), or
by MATLAB Symbolic Math, or by the solverode45 (these extra equations are added to the
system).
(i) Do not complicate thing! For example, there is no need to introduce ODEs governing the time
change of the velocities (No Newton’s second law).
(j) It is OK to talk about the gradient between two points (xr , yr ) and (xf , yr ), but not the angle
between these two points. Strictly speaking, you can only talk about the angle between two
(tangent) lines, while for gradient one line is assumed to be the horizontal axis (and the other
line goes through the two points).
2
The solution approach
The problem can be formulated in many ways, and solved accordingly, with only one approach
detailed below.
2.1
Problem formulation
The whole dynamics are governed by ODEs, where the velocities can be expressed as functions of the
displacements (in Newton’s second law, the accelerations are expressed as functions the velocities
and displacements). Since the rabbit runs in a straight line with angle θr to the horizontal axis, the
ODEs for its displacement (xr , yr ) are
d
xr = sr cos θr ,
dt
d
yr = sr sin θr .
dt
(1)
If the rabbit is in sight, the fox runs towards the rabbit with direction given by the unit vector
1
xr − xf
~n = p
.
(xr − xf )2 + (yr − yr )2 yr − yf
Then the velocity of the fox is sf ~n, and the ODEs for the fox’s displacement are
d xf
sf
xr − x f
=p
.
dt yf
(xr − xf )2 + (yr − yf )2 yr − yf
(2)
If the sight of the fox is blocked by the corner with coordinate (xc , yc ), then the ODEs are exactly
the same as (2), except that (xr , yr ) is replaced by (xc , yc ). Because the velocity does not change
with time during this stage, the right hand side of the ODEs in (2) can be specified as constants.
In Question 2, the ODEs for the speeds
d
df (t) = sf 0 e−µf df (t) ,
dt
d
dr (t) = sr0 e−µr df (t)
dt
(3)
can be obtained analytically (using the initial condition df (0) = dr (0) = 0)
df (t) =
1
log(1 + sf 0 µf t),
µf
dr (t) =
1
log(1 + sr0 µr t),
µr
leading to the explicit expressions of the time-dependent velocities
sr0
sf 0
, sr (t) =
.
sf (t) =
1 + s f 0 µf t
1 + sr0 µr t
Alternatively, (3) can be augmented into the system of ODEs consisting of (1) and (2).
2.2
Event Location
The event that the rabbit reaches its burrow3 is not needed, because the total time is explicitly
available in both cases (the discrepancy in the final result between defining an event function or
specifying the time span should be very small). The event function for the rabbit being captured is
also easy, but that for the sight of view blocked by the corners is more complicated. This event is
triggered when the rabbit (xr , yr ), the fox (xf , yf ) and the corner (xc , yc ) are on the same straight
line, where (xc , yc ) is the coordinate of either corner. First the straight line going through (xr , yr )
and (xf , yf ) is
xr − xf
(y − yf ) + xf ,
x=
yr − yf
where this special representation is used to avoid possible difficulties when xr = xf (notice that yr
never equals yf ). Therefore, the event is triggered if and only if4
xc =
2.3
xr − xf
(yc − yf ) + xf .
yr − yf
(4)
The approach
The problem can be solved step by step: the dynamic is solved from the given initial condition,
until certain events are triggered, and then proceeded to the next step with a different rule for the
fox. Another approach is to define the ODEs of the fox, depending on whether its sight is blocked or
not. This approach is more general, but is more time-consuming because of the logical comparisons
involved in determining the sight.
References
[1] Harold T. Davis. Introduction to nonlinear differential and integral equations. Dover Publications, Inc., New York, 1962.
[2] Desmond J. Higham and Nicholas J. Higham. MATLAB guide. Society for Industrial and
Applied Mathematics (SIAM), Philadelphia, PA, second edition, 2005.
3
This event can be simply the horizontal or vertical coordinate is larger than that of the burrow
Strictly speaking, one extra condition should be added that (xc , yc ) lies on the line segment connecting (xr , yr )
and (xf , yf )
4