BEST代写-最专业、靠谱的代写

Best代写-最专业、靠谱的代写IT&CS | 留学生作业 |编程代写 | Java | Python | C/C++ | PHP | Matlab | Assignment Project Homework代写

Matlab代写 | MA51004: Computational Modelling and Programming

Matlab代写 | MA51004: Computational Modelling and Programming

MA51004: Computational Modelling and Programming – Fall 2019
Homework 1
Complete the following problems by 11:59 PM on 14 October, 2019. All work should be submitted in
the electronical (in the PDF format) version.
All code should be reasonably documented, such that the marker understands your steps.
1. Consider the following equations of motion for an N-body system:
x¨i =
X
N
j=1
j6=i
f (xi
, xj , t)
xj − xi
||xj − xi
|| + g(xi
, t)x˙ i
xi(0) = xi,0
x˙ i(0) = vi,0,
for 1 ≤ i ≤ N.
(a) Rewrite this as a system of 2N first-order equations for xi and vi = x˙ i
, 1 ≤ i ≤ N. (5 pts)
(b) Implement these equations in MATLAB with the 4th-order Runge-Kutta stepping. (5 pts)
(c) Solve the system for N = 5, xi,0 chosen randomly in the unit circle, vi,0 = 0, g = 0, and
f(xi
, xj , t) = 
(ri,j − 1)2 − 2e
−8ri,j if ri,j ≤ 1
0 else, where ri,j = ||xi − xj ||
Plot the trajectories for 0 ≤ t ≤ 10, and make sure you record the initial positions. (5 pts)
(d) Suppose now that g = −1. Recompute your solutions for the same initial points as the
previous problem. How is the behaviour affected? (5 pts)
2. Suppose that there is no x¨i (for all i) term in the N-body system (i.e. setting its right hand
side to be zero). Reformulate the system as N equations for x˙i
, rewrite the MATLAB code
accordingly, and solve the system for the same initial positions as before (taking g = −1). How
does the solution behaviour compare to the previous two versions? (20 pts)

bestdaixie