Astronomy and Space Exploration ES

Projects / Grade 11

Grade 11 ⏱ 5 weeks · 10 sessions of 55 min in the computer lab under review

The Earth's Orbit with Euler's Method

“How does a computer predict the motion of the planets if it cannot solve the equation?”

Program Newton's second law step by step in a spreadsheet: Euler's method makes the orbit grow, Euler–Cromer closes it, and by measuring the error against the step h the class discovers the order of the method and achieves an orbit that closes with less than 1 % error.

Goal

Write the law of gravitation as differential equations, solve them numerically in a spreadsheet with the Euler and Euler–Cromer methods, measure the error after one orbit as a function of the step h and verify energy conservation.

Final product

A documented spreadsheet with both methods, a graph of the orbit and another of energy versus time, a table of error against step h with its log–log graph, and a short report explaining why Euler fails and Euler–Cromer does not.

Materials

  • Computer with LibreOffice Calc, Google Sheets or Excel (one spreadsheet per pair)
  • Notebook and calculator for the steps by hand
  • Access to the Keplerian orbit and N bodies simulators for comparison
  • Printed column template: t, x, y, vx, vy, r, ax, ay, E

Math it uses

  • Derivatives: velocity and acceleration as rates of change; second-order differential equations
  • Euler and Euler–Cromer methods; order of a method (global error ∝ h)
  • Mechanical energy per unit mass and its conservation
  • Power functions and logarithms: log–log graph of error against h

The model

For a planet of negligible mass around the Sun, with μ=GM⊙\mu = GM_\odot,

d2rdt2=−μr3 r,ax=−μ xr3,ay=−μ yr3,r=x2+y2.\frac{d^2\mathbf r}{dt^2} = -\frac{\mu}{r^3}\,\mathbf r, \qquad a_x = -\frac{\mu\,x}{r^3},\quad a_y = -\frac{\mu\,y}{r^3},\quad r = \sqrt{x^2 + y^2}.

In au and years, μ=4π2≈39.478\mu = 4\pi^2 \approx 39.478 au³/yr². The Earth starts from x0=1x_0 = 1, y0=0y_0 = 0, vx0=0v_{x0} = 0, vy0=2π≈6.2832v_{y0} = 2\pi \approx 6.2832 au/yr. Its energy per unit mass is E=12v2−μ/r=2π2−4π2=−2π2≈−19.739E = \tfrac12 v^2 - \mu/r = 2\pi^2 - 4\pi^2 = -2\pi^2 \approx -19.739 au²/yr², and it should remain constant.

Euler (step hh): xn+1=xn+h vx,nx_{n+1} = x_n + h\,v_{x,n}, vx,n+1=vx,n+h ax,nv_{x,n+1} = v_{x,n} + h\,a_{x,n} (likewise in yy).

Euler–Cromer: first vx,n+1=vx,n+h ax,nv_{x,n+1} = v_{x,n} + h\,a_{x,n}, and then xn+1=xn+h vx,n+1x_{n+1} = x_n + h\,v_{x,n+1}: the new velocity is used to move the position.

Project phases

Week 1 — From the derivative to the equation of motion

  1. With Velocity, acceleration and derivatives we write v=dx/dtv = dx/dt and a=dv/dta = dv/dt and approximate them with difference quotients: v≈Δx/Δtv \approx \Delta x / \Delta t.
  2. We derive the gravitational acceleration by components from F=GMm/r2F = GMm/r^2 directed toward the Sun (lesson Universal gravitation and satellites).
  3. We check the units: with a=1a = 1 au and T=1T = 1 yr, the third law T2=4π2a3/μT^2 = 4\pi^2 a^3/\mu gives μ=4π2\mu = 4\pi^2.
  4. Three steps by hand with h=0.1h = 0.1 and Euler, in a table in the notebook, as in the lesson. We observe that rr already grows in the first step.

Week 2 — Euler in the spreadsheet

  1. Columns: t, x, y, vx, vy, r, ax, ay, E. Row 2: initial conditions. Row 3 onward: Euler formulas referring to the previous row; hh in a separate cell (for example $B$1) so it can be changed without rewriting.
  2. With h=0.01h = 0.01 (100 steps per year) we drag down 100 rows and plot y against x (scatter chart with lines). The orbit does not close: it is an outward spiral.
  3. We plot E against t: the energy rises steadily. We calculate the relative error after one revolution: ∣r(1 yr)−1∣|r(1\ \text{yr}) - 1| and ∣E(1)−E(0)∣/∣E(0)∣|E(1) - E(0)|/|E(0)|.
  4. We repeat with h=0.1h = 0.1, 0.050.05, 0.010.01, 0.0010.001 (up to 1 000 rows). Table: hh against error. The error goes down proportionally to hh: Euler is first order. For 1 % error we would need h≈0.0016h \approx 0.0016 (about 600 rows); for 0.001 %, a million.

Week 3 — Euler–Cromer

  1. We duplicate the sheet and change only the order: first the velocity, then the position with the new velocity.
  2. With the same h=0.01h = 0.01 the orbit closes and the energy oscillates around −19.74-19.74 without drift. We measure the error in rr after one revolution and the amplitude of the oscillation of EE.
  3. Table and log–log graph of error against hh for both methods: the slope of the line is the order of the method. For Euler ≈ 1; for Euler–Cromer the position error is also ~hh, but the energy does not drift: that is the difference that matters in the long run.
  4. Badge goal: find the largest hh for which the Euler–Cromer orbit closes with less than 1 % error in rr after one revolution, and the largest hh that achieves it with Euler. Compare how many rows each one needs.

Week 4 — Mars and an elliptical orbit

  1. Mars: x0=1.524x_0 = 1.524, vy0=2π/1.524≈5.09v_{y0} = 2\pi/\sqrt{1.524} \approx 5.09 au/yr (circular velocity). How many steps are needed to complete one revolution? We measure the period in the sheet (when y crosses zero going upward again) and compare it with the third law: T=1.5243/2≈1.88T = 1.524^{3/2} \approx 1.88 years.
  2. Elliptical orbit: Earth with vy0=0.8×2πv_{y0} = 0.8 \times 2\pi. We calculate the expected eccentricity from the energy and the angular momentum and compare it with the one the sheet gives (e=(rmax⁡−rmin⁡)/(rmax⁡+rmin⁡)e = (r_{\max} - r_{\min})/(r_{\max} + r_{\min})).
  3. We check with the simulator Keplerian orbit (exact solution) and, to see higher-order integrators, with N bodies.
  4. Kepler’s second law in the sheet: we calculate L=xvy−yvxL = x v_y - y v_x in each row: with Euler–Cromer it is conserved much better.

Week 5 — Report

  1. Report of 3 to 4 pages: model and units, methods, graphs (orbits and energy), error table with the log–log graph, result of the 1 % goal, Mars and the ellipse, conclusions.
  2. A 5-minute presentation per pair showing the sheet live: they change hh and the audience sees how the orbit changes.
  3. Final discussion: why does such a small change in the order of two lines (Euler → Euler–Cromer) change the result so much? (Euler–Cromer is symplectic: it preserves area in phase space; they will see this at university.)

Mathematics in the project

  • Differential equation: r¨=−μ r/r3\ddot{\mathbf r} = -\mu\,\mathbf r/r^3 is second order; it becomes a first-order system with v=r˙\mathbf v = \dot{\mathbf r}.
  • Euler: yn+1=yn+h f(yn)y_{n+1} = y_n + h\,f(y_n). Local error ∼h2\sim h^2, global error after N=T/hN = T/h steps ∼h\sim h.
  • Energy: E=12(vx2+vy2)−μ/rE = \tfrac12(v_x^2 + v_y^2) - \mu/r. In Euler, on a circular orbit, each step multiplies rr by 1+h2v2/r2\sqrt{1 + h^2 v^2/r^2}: the energy grows ~h2h^2 per step and ~2πh2\pi h per revolution.
  • Log–log graph: if error =Chp= C h^{p}, then log⁡(error)=log⁡C+plog⁡h\log(\text{error}) = \log C + p \log h: the slope is pp.
  • Third law: T2=4π2a3/μT^2 = 4\pi^2 a^3/\mu; with μ=4π2\mu = 4\pi^2, T=a3/2T = a^{3/2} (years, au).

Assessment rubric

CriterionDevelopingAchievedAdvanced
Model and unitsCopies the equations without justificationDerives the acceleration components and justifies μ=4π2\mu = 4\pi^2Verifies the model with the third law for Mars and an ellipse
ImplementationSheet with reference errors or without parameterized hhBoth methods correct, hh in a cell, graphs of orbit and energyDocumented sheet, with LL and ee calculated and compared with theory
Error analysisNotices that Euler “opens up”Error–hh table and log–log graph with slope ≈ 1Explains with the energy why Euler drifts and Euler–Cromer oscillates; reaches the 1 % goal
Report and presentationIncompleteComplete, with graphs and conclusionsShows the sheet live and answers questions about the order of the method

Variants and extensions

  • Programming language: rewrite the sheet in Python or JavaScript (20 lines) and compare with the spreadsheet; then try the Verlet method or RK4 (the basis of the higher-education project Your own N-body integrator).
  • Earth satellite: replace μ\mu with μ⊕=398 600\mu_\oplus = 398\,600 km³/s² and simulate a satellite in low Earth orbit (units km and s).
  • Two planets: add Jupiter as a second body (without mutual interaction first, with it afterwards) and observe the perturbation on the Earth.

Inclusion

  • Spreadsheets work with screen readers; the graphs are complemented with the numerical table read out loud.
  • Pair work with roles: one writes the formulas and the other checks the first three steps by hand; then they swap.
  • A template with the columns and the first row for those who need initial scaffolding; the 1 % goal has levels (5 %, 2 %, 1 %).

Safety

  • Computer-lab work: eye breaks every 25 minutes and proper posture.
  • Save the sheet often and with a version name (orbita-v1, orbita-v2).
  • As everywhere on the portal: never look at the Sun directly or with instruments without a certified filter.

References and data sources

  • Project units: distances in au, times in years; with them μ = GM☉ = 4π² au³/yr² (Kepler's third law with a = 1 au, T = 1 yr). Circular orbital velocity at 1 au: v = 2π au/yr ≈ 29.8 km/s.
  • Error of Euler's method for the circular orbit: the energy grows ~h² per step and ~2πh per revolution (see the lesson “Simulating an orbit with the Euler method”, tables in units GM = 1). Euler–Cromer (symplectic Euler) conserves the energy on average: Cromer, A. (1981). Stable solutions using the Euler approximation. Am. J. Phys. 49, 455.
  • Mars: semi-major axis 1.524 au, eccentricity 0.0934 (JPL, Approximate Positions of the Planets).
  • Ministerio de Educación Nacional (2006). Estándares Básicos de Competencias en Matemáticas [Colombian national standards in Mathematics], Grades 10 to 11: “I interpret the notion of derivative as a rate of change and as the value of the slope of the tangent to a curve, and develop methods to find the derivatives of some basic functions in mathematical and non-mathematical contexts” and “I analyze the relationships and properties between algebraic expressions and the graphs of polynomial and rational functions and of their derivatives”. Natural Sciences, Grades 10 to 11: “I model mathematically the motion of everyday objects from the forces acting on them” and “I establish relationships between the gravitational field model and the law of universal gravitation”.