Bari IVP Test Set · Problem II.6 · 28 first-order ODEs

Pleiades Seven-Body Lab

Seven point masses with mi = i attract each other under Newtonian gravity (g = 1). Change the solver, the tolerance or the starting state and the whole run is recomputed in your browser, with the same step-size control as MATLAB's ode45 and ode23.

Grading guide: each question with its MATLAB code and results ↓
Try this
t = 0.000
7 bodies · m = 1 … 7
Part (c): x₁ and y₁ over time
x₁(t)y₁(t)
Step sizes: every accepted step h, log scale. Ticks along the bottom mark rejected steps.
accepted hrejected step

Initial state at t = 0

BodyMass mxyx′y′

Edits apply right away. Changed cells are outlined. The accuracy measures need the reference solution, so they appear only for the unchanged test-set problem on [0, 3].

Work versus precision

Each filled point is one browser run of the unchanged problem, at rtol = atol = 10⁻³ … 10⁻¹¹ (h₀ = rtol·10⁻²) for the adaptive methods and h = 0.02 … 0.00016 for RK4. Hollow rings are the ode45 and ode23 rows of your MATLAB table. Further right costs more, higher up is more accurate.

Dormand–Prince (browser) ode45 (MATLAB) Bogacki–Shampine (browser) ode23 (MATLAB) RK4 fixed step current run

COMP626 · Applied Math for Scientists · Project 1

Assignment guide

One block per part of the assignment. Each shows the question, the answer, the results and the MATLAB code that produced them. The code, the table and the comments are copied unchanged from the submitted files. Where a browser check appears, it is the simulator above rerunning that case live.

Lit.

Literature review: the Pleiades before the differential equation

A short illustrated book. Click the right-hand page to turn it, swipe, or use the arrows below.

Chapter I

A calendar in the sky

Long before telescopes, people learned the sky by watching it, and used the predictable rising and setting of stars as a calendar for farming, migration and navigation1,2.

One of the most conspicuous objects in that sky is the Pleiades, Messier 45: an open cluster in Taurus about 445 light-years away, with more than a thousand stars, of which only a handful are bright enough to see by eye3.

1

Watching the Seven Sisters. Around the fire, a child points at the cluster. Look closely at the pair on its right edge: the faint one, Pleione, flickers beside Atlas.

2
Chapter II

Seven sisters, many peoples

The cluster turns up in almost every written tradition. Babylonian astronomy called it MUL.MUL, "the Stars", and linked it to the month Ajaru4,5. It is named in the Younger Avesta and later became Parvin in Persian6.

Hesiod's Works and Days tells farmers to harvest when the Pleiades rise and plow when they set7. Greek myth made them the Seven Sisters, the daughters of Atlas and Pleione8, and Aboriginal Australian songlines carry a separate Seven Sisters story across thousands of kilometres9,10.

3

Hesiod's calendar. "When the Pleiades, daughters of Atlas, are rising, begin your harvest, and your ploughing when they are going to set." Works and Days, tr. H. G. Evelyn-White7.

4
Chapter III

Seven, or six?

The stories say seven, but most people today see six. Today Pleione sits so close to the much brighter Atlas that their light blends to the unaided eye.

Norris and Norris traced the motions of the two stars backwards and found that about 100,000 years ago Pleione stood farther from Atlas, so seven stars would have been easier to tell apart. If so, the story may be older than the human migrations out of Africa11.

5

The real motion. SIMBAD positions and proper motions of the nine named stars (pleiades_stars.m), run back in a straight line: Pleione about 7.4′ from Atlas 100,000 years ago, about 5.0′ today. The extrapolation ignores the cluster's internal dynamics.

6
Chapter IV

From myth to mathematics

The Seven Sisters are one of humanity's oldest continuous relationships with the natural world, a story carried across generations.

The Pleiades problem of the Bari test set follows seven bodies of masses mi = i moving under mutual gravitation: seven points of light whose motion, here, is computed rather than remembered.
7
Watch Thumbnail of the video The Hidden History of the Pleiades Star Clusterfrom 10:05 The Hidden History of the Pleiades Star ClusterIan Lauer Astro · opens on YouTube at 10:05

Videos can't play inside this page, so the card opens YouTube in a new tab.

8
Pages 1–2 of 8
References (from references.bib, numbered in order of first citation)
  1. Thurston, H. (1994). Early Astronomy. Springer.
  2. Edgar, J. S. (2019). Observer's Handbook 2020. Royal Astronomical Society of Canada.
  3. NASA Science. Messier 45 (The Pleiades). Hubble Messier Catalog.
  4. British Museum. Astronomical tablet K.8538.
  5. British Museum. Babylonian astronomical tablet 1885,0430.15.
  6. MacKenzie, D. N. Constellations. Encyclopaedia Iranica.
  7. Hesiod. Works and Days. Perseus Digital Library, Tufts University.
  8. The Metropolitan Museum of Art. The Pleiades.
  9. National Museum of Australia. Seven Sisters.
  10. National Museum of Australia. Songlines: Tracking the Seven Sisters.
  11. Norris, R. P. and Norris, B. R. M. (2021). Why are there Seven Sisters? Advancing Cultural Astronomy.
  12. Ian Lauer Astro. The Hidden History of the Pleiades Star Cluster. YouTube video: https://www.youtube.com/watch?v=ZmP8dZ-iznc
(a)

Right-hand side in Pleiades.m

QuestionWrite in a MATLAB Pleiades.m file the code for the right-hand-side of the E5 model.
Answer

Pleiades.m implements the first-order system (II.6.3): z′ = w, w′ = f(z), 28 equations. The state is u = [x₁…x₇, y₁…y₇, x′₁…x′₇, y′₁…y′₇], so component 1 is x₁ and component 8 is y₁.

  • Accelerations: x″ᵢ = Σj≠i mⱼ(xⱼ − xᵢ)/rᵢⱼ3/2, and the same for y, with mᵢ = i, g = 1 and rᵢⱼ the squared distance.
  • All pairs are computed at once as matrices DX(i,j) = xⱼ − xᵢ. The diagonal of rᵢⱼ3/2 is set to Inf so the self-interaction terms vanish.
  • The assignment says "E5 model", but the surrounding text and equations are the Pleiades problem, so that is what is implemented (noted in the file header).
Result: du = Pleiades(0, P.u0), evaluated live in the browser

The first two columns are the initial velocities, as z′ = w requires. The last two are the gravitational accelerations at t = 0.

(b)

Seven solvers, three tolerance triples

QuestionSolve Pleiades using rtol = 10⁻⁴, 10⁻⁷, 10⁻¹⁰ with atol = rtol and h₀ = 10⁻⁶, 10⁻⁹, 10⁻¹², using MATLAB ODE solvers ode45, ode23, ode113, ode15s, ode23s, ode23t, ode23tb, where the first three are non-stiff ODE solvers and the last four are stiff ODE solvers.
Answer

run_pleiades.m loops over the 7 solvers and the 3 triples defined in pleiades_setup.m: 21 integrations on [0, 3]. Each configuration is run:

  • once with 'Stats','on', whose printed counters are parsed by pleiades_parsestats.m;
  • once through a counting wrapper, for an exact #f (MATLAB prints large counters in %g format and loses digits);
  • five times with statistics off for timing, keeping the minimum.

All 21 runs reach t = 3. The end states are saved as the 21 × 28 matrix UEND in pleiades_results.mat.

Result: correct digits (scd) at t = 3 for all 21 runs, with steps underneath
(c)

Plot of x₁ and y₁

QuestionMake a plot, as in Figure II.6.2, of the evolution of x₁, y₁, using one of the solvers you used with one of the triples (rtol, atol, h₀) given in the previous item.
Answer

pleiades_figure.m solves with ode113 and the middle triple (rtol = atol = 10⁻⁷, h₀ = 10⁻⁹) on 3001 output points, so the quasi-collisions are resolved, and writes pleiades_x1y1.png and .fig. Any solver and triple can be chosen: pleiades_figure('ode45', 3).

The sharp kinks near t = 1.23, 1.46 and 1.68 are the close encounters involving body 1 (Table II.6.1).

Result: the submitted figure, pleiades_x1y1.png
MATLAB plot of x1(t) and y1(t) on [0, 3] computed with ode113
(d)

Table of run characteristics

QuestionFor each run report in a table: solver, rtol, atol, h₀, mescd, scd, steps, accept, #f, #Jac, #LU (number of LU systems solved) and CPU (minimum time of running the ODE solver five times).
Answer

pleiades_accuracy.m computes the two accuracy measures exactly as defined in the assignment:

mescd = -log10( ||u - uref||_inf / (atol/rtol + ||uref||_inf) ) all 28 components scd = -log10( ||(u - uref)./uref||_inf ) 14 positions x1..x7, y1..y7
  • scd uses the 14 positions, as the test set specifies for this problem (page II-6-3). Both index sets are set once in pleiades_setup.m.
  • "#LU (number of LU systems solved)" can be read two ways, so the table gives both: #LU = LU decompositions and #solve = linear systems solved.
  • CPU is the minimum of 5 runs, timed with tic/toc around the solver call alone.

pleiades_table.m formats the table and writes pleiades_table.txt.

Result: pleiades_table.txt, with a live browser check of the ode45 and ode23 rows

Browser check: the simulator reruns that configuration with the same Dormand–Prince and Bogacki–Shampine step-size control as ode45 and ode23. "identical" means steps, accept, #f, mescd and scd all agree. The other five solvers have no browser port, so they show a dash. A dash in #Jac, #LU or #solve means the solver forms no Jacobian.

(e)

Comments on the results

QuestionComment on your results utilizing the table generated. Do not forget to provide the table.
Answer, from Report.pdf, Section 8 (Part e: discussion)

The text below is copied word for word from the report. The table it discusses is in part (d) above.

The three non-stiff solvers consistently outperform the stiff solvers at all three tolerance levels. At rtol = 10−10, ode113 achieves 7.71 correct digits in just 0.017 s with 2,239 function evaluations. In comparison, ode23s requires 11.2 s and approximately 1.82 million function evaluations, while achieving only 5.23 correct digits. This makes ode23s roughly 650 times slower, despite producing about 2.5 fewer correct digits.

We note that this difference does not necessarily mean that the stiff solvers are less effective. They perform additional computations, including Jacobian evaluations, matrix factorizations, and Newton iterations, that provide little benefit for this non-stiff problem. In the Pleiades system, the step size is primarily determined by the accuracy required during close encounters between the stars, instead of numerical stability restrictions. As a result, solvers designed for non-stiff problems are better suited to this system and achieve greater accuracy with significantly less computational effort.

Reducing the tolerance by six orders of magnitude leads to a substantial increase in the number of steps required by most solvers. The step counts increase by the following factors:

ode23: 98.7×,ode23t: 100.6×, ode23tb: 99.9×,ode23s: 99.2×, ode45: 11.5×,ode113: 3.1×, ode15s: 7.9×.

These results are consistent with the classical relationship steps ∼ tol−1/(q+1), where q is the order of the numerical method. For a second-order method (q = 2), this relationship predicts a 100-fold increase in the step count, which closely matches the results for ode23, ode23t, ode23tb, and ode23s. For ode45, using q = 4 predicts an increase of approximately 15.8 times, compared with the observed factor of 11.5.

Among all the solvers, ode113 shows the smallest increase in step count, at only 3.1 times. Its ability to adjust the method order allows it to maintain efficiency as the tolerance becomes more restrictive. At rtol = 10−10, it is also the fastest solver in the comparison. Meanwhile, ode45 achieves the highest accuracy, with scd = 8.84, while requiring only 0.052 s of computation time.

At rtol = 10−4, none of the solvers achieves two correct digits, with scd values ranging from 0.61 to 1.82. This indicates that the numerical errors affect even the leading digits of the final positions. The three close encounters involving body 1, shown in the figure in part c, can amplify errors accumulated during integration and contribute to the loss of accuracy.

This behavior highlights an important distinction between local and global error. The specified tolerance controls the estimated local error at each integration step, but does not guarantee the same level of accuracy in the final solution. Because the Pleiades system is sensitive to accumulated numerical errors, a tolerance of 10−4 does not necessarily produce four correct digits. Therefore, the accuracy of each solver should be evaluated by comparing its results with a reliable reference solution.

From rtol = 10−4 to 10−10, ode45 improves from scd = 1.14 to 8.84, about 1.3 digits per decade, and ode23 from 1.82 to 7.84. The stiff solvers gain less: ode23t goes from 0.61 to 4.73, about 0.7 digits per decade, and stays two to four digits behind the explicit solvers at equal tolerance.

The mescd values are higher than the scd values in all 21 runs, with differences ranging from 0.59 to 0.98 digits. Because the two measures in Equation 3 use different components and scaling methods, this difference is not constant.

The mescd measure considers the largest absolute error across all 28 components and scales it by a single constant, 6.2251. In every run, the largest absolute error occurs in a velocity component, most commonly x′5 or x′1. These components tend to have relatively large values and change rapidly throughout the simulation.

In contrast, scd considers only the 14 position components and divides each error by its corresponding reference value. The largest relative error occurs in x1, with a reference value of 0.3706, in most runs, and in x5, with a reference value of 0.3426, in the remaining runs. These are the two smallest reference positions in absolute value, making their relative errors more sensitive to a given absolute error.

As a result, the difference between mescd and scd depends on how the numerical errors are distributed between the position and velocity components. Since this distribution changes across solvers and tolerance levels, the gap between the two measures also varies. Despite these differences, both measures give the same ranking of solvers in this experiment. However, their results could differ substantially if a reference position were close to zero at t = 3.

The solvers ode15s, ode23t, and ode23tb each evaluate the Jacobian only once during the entire integration, regardless of the tolerance. They also perform relatively few LU factorizations, ranging from 112 to 351. This suggests that the Newton iterations converge efficiently for this non-stiff problem and allow MATLAB to reuse the same Jacobian without repeatedly recomputing it. For example, at rtol = 10−10, ode23t performs 81,467 linear solves using only 159 LU factorizations, with 81,498 function evaluations, approximately one per step.

In contrast, ode23s requires considerably more computation. Its Rosenbrock method uses the Jacobian directly in its numerical formula, and the results show that a new Jacobian and LU factorization are computed at every step. At rtol = 10−10, the solver performs 58,702 Jacobian evaluations, 58,702 LU factorizations, and 176,106 linear solves, corresponding to three solves per step, one for each stage.

For this 28-dimensional system, approximating each Jacobian numerically requires approximately 28 additional evaluations of the right-hand-side function. This accounts for much of the approximately 1.82 million function evaluations reported for ode23s. In addition, repeatedly performing LU factorizations, which require O(n3) operations for a dense system of size n, adds substantial computational cost. These factors explain why ode23s is the slowest solver in the comparison.

Providing an analytical Jacobian could reduce the number of function evaluations by avoiding the additional evaluations needed for numerical approximation. However, it would not eliminate the cost of repeated LU factorizations. Therefore, ode23s would likely remain less efficient than the other solvers for this non-stiff problem.

The difference between attempted and accepted steps is largest at rtol = 10−4. At this tolerance, ode45 rejects 21 out of 127 attempted steps, while ode15s rejects 59 out of 522. As the tolerance becomes more restrictive, the number of rejected steps decreases, reaching zero for most solvers at rtol = 10−10.

We can explain this behavior through how the solvers adjust their step sizes. With a larger tolerance, the solvers initially attempt larger steps, which may produce excessive errors during close encounters between the stars. These steps are then rejected, forcing the solvers to reduce their step sizes and try again. With tighter tolerances, the solvers already take smaller steps which makes it less likely that the estimated error will exceed the allowed limit.

The initial step sizes of 10−6, 10−9, and 10−12 are much smaller than necessary at t = 0, where the solution is relatively smooth. However, the adaptive solvers adjust their step sizes within the first few steps such that the small initial values have little effect on the overall computation. Although they may introduce a few additional steps, they also help prevent the solver from starting with a step that is too large. Therefore, the initial step size is unlikely to be a major factor in the performance differences observed in the table.

8.1 9. Comparison with the test set (Table II.6.3):

Only the scd values can be directly compared between the two tables, for the reasons explained in Section 7. At rtol = 10−10, the reference test set reports scd values of 5.72 for DASSL, 7.39 for GAMD, 6.94 for MEBDFI, 7.55 for PSIDE-1, 9.20 for RADAU, and 5.20 for VODE. In comparison, our MATLAB results are 8.84 for ode45, 7.84 for ode23, 7.71 for ode113, 6.04 for ode15s, 5.23 for ode23s, 4.73 for ode23t, and 4.68 for ode23tb.

The MATLAB non-stiff solvers perform well compared with those in the reference test set. Among the reported methods, ode45 is surpassed only by RADAU, while ode113 and ode23 achieve higher scd values than both MEBDFI and PSIDE-1. In contrast, the MATLAB stiff solvers generally produce lower accuracy, with several performing near or below the lower end of the reference results. This is consistent with our earlier observation that non-stiff solvers are better suited to the Pleiades problem.

However, the CPU times from the two tables should not be compared directly because the experiments were conducted on different hardware and used different timing procedures. The reference test set reports the median of ten runs, whereas part d requires the minimum time from five runs.

(f)

Deliverables

QuestionProvide your source code for all the simulations, the generation of the graphic, the generation of the table, with instructions about how to run your code in interactive mode, and a text file Pleiades.txt with your comments about the table columns.
Answer
  • Simulations: Pleiades.m, pleiades_setup.m, run_pleiades.m, pleiades_parsestats.m, pleiades_accuracy.m
  • Graphic: pleiades_figure.m → pleiades_x1y1.png / .fig
  • Table: pleiades_table.m → pleiades_table.txt
  • Interactive instructions: README.txt, section HOW TO RUN
  • Comments on the columns: Pleiades.txt, part (f), shown below
  • Everything in one command: >> project1 runs (b), (c) and (d), in about 2–3 minutes
What each table column means (Pleiades.txt, part f)