Engineering Computational Science

Professor James Hetherington

2026-04-30

Or…

Data &

Computers &

Code &

People

Part one: An exploration of scientific programming

1.1 A young person’s guide to programming gravity

  • It’s about 1989
  • A BBC Micro starts, “beeep-boop”
  • A teenager has been reading about gravity.

1.2 - The rules of gravity

  • Change your velocity toward anything heavy:
    • The heavier it is → the more you accelerate
      • Twice as heavy → twice as much
      • The further away → the less you accelerate
      • Falls off with the square of the distance
    • “Toward” means a vector:
      • velocity has a speed and a direction
      • the change points toward the heavy thing

1.3 An introduction to pseudocode

Let's have a time step dt, and make it small, so dt = 0.1
Each time step:
    x = x + vx * dt
    y = y + vy * dt
    Draw it
And that's the end of the time step, so go round and do it again.

The code on this slide is not meant to be real, runnable source.

It is pseudocode: code-like text designed to pull out the key idea.

1.4 Adding gravity

The loop structure is the important thing: we repeat a small update over and over again:

dt = 0.1
loop:
    distance_to_sun = square_root (x^2 + y^2) -- Pythagoras!
    amount_to_accelerate = gravity_strength * sun_mass / distance_to_sun^2
    x_share_of_acceleration = x / distance_to_sun
    y_share_of_acceleration = y / distance_to_sun
    vx = vx + amount_to_accelerate * x_share_of_acceleration
    vy = vy + amount_to_acceerlate * y_share_of_acceleration
    x = x + vx * dt
    y = y + vy * dt
end of loop

1.5 Pseudocode as an intuition builder

  • If I can’t code it, I didn’t really understand it.

Most of that benefit is in pseudocode, not real code.

def acceleration(position):
    r = np.sqrt(position[0]*position[0] + position[1]*position[1])
    G = 100.0  # Gravitational constant
    g = G / (r * r)  # Gravitational acceleration
    return - g * (position / r) # Make it point toward origin
  • Pseudocode isn’t enough - we need a working model to be confident there isn’t something we missed
  • But the careful thinking isn’t in the language syntax.

1.6 Simple isn’t always correct

1.7 - Birds and sheep are particles too

The rules for the Boids:

  1. Cohesion – fly toward the centre of the flock.
  2. Separation – avoid getting too close to neighbours.
  3. Alignment – match velocity with nearby boids.

1.8 Simulation and Modelling

Modelling allows us to use simple rules to build human understanding of complex systems.

Simulation allows us to build detailed models to predict how the world will behave.

1.9 Speed - readability tradeoffs

Some of you will have noticed that the gravity programme is inefficient:

    distance_to_sun = square_root (x^2 + y^2) -- Pythagoras!
    amount_to_accelerate = gravity_strength * sun_mass / distance_to_sun^2

could be:

    amount_to_accelerate = gravity_strength * sun_mass/ (x^2 + y^2)

1.10 Performance and complexity

  • Speed matters in scientific programming
  • It adds to complexity
  • It is necessary
Log-log plot of gravity law evaluation time vs number of bodies for numpy and jax-cpu engines.

1.11 Warehouse scale computers as toys and tools

UCL announces award of National Compute Resource grant
UCL's existing national service, Michael.

1.12 The abstraction stack

By working with programs that use other programs that use other programs, we are much more capable.

But the systems become much more complex.

And hard to understand.

A diagram of the abstraction stack in scientific computing.

1.13 Part one - recap

  • Code for understanding, as well as to drive the computer
  • Can code for sheep as well as physics
  • Models and simulations
  • Performance matters for scientific programming
  • So abstractions leak

Part two: Reproducibility and Reliability in Computational Science

2.1 - Effective

Class structure of my PhD thesis code
Some results from the thesis code

2.2 The Avoiding Mass Extinctions Engine

  • Save the world and make a bob or two doing it.
  • Sustainable change.
  • Socio-technical solutions.
AMEE logo Image credit: Gavin Starks et al.

2.3 Computational science as a political football

A cartoon illustrating science as a political football. Image credit: Generated with the DALL·E image model, OpenAI, accessed via ChatGPT (April 2026).

2.4 The Joint Biosecurity Centre

The MRC-IDE codebase from the Imperial College London laboratory. Image credit: Screenshot from Github.com April 2026.
The SIR compartmental model of epidemiology.

2.5 Software Engineering

Protesting sub-postmasters outside the Royal Court of Justice Image credit: Photo by PA Media, purchased for this lecture.

2.6 What is engineering?

The tools, practices and systems that enable repeatable, reliable, safe and scalable technical construction.

Illustration of an earthquake damaging only some buildings.

2.7 Not just software engineering

A photo of the entrance to the Alan Turing Institute, in the British Library Image credit: The Alan Turing Institute.

2.8 Science and Engineering

Diagram showing the relationship between science and engineering

2.9 The Research Engineer

Black and white historical photographs of an academic and a smith working in a forge Image credit: Beineke Library, used by permission, composed by the Software Sustainability Institute.

2.10 Definition

Engineering Computational Science is the development and application of tools, practices and systems for the efficient, trustworthy, ethical and safe use of information technologies as part of trying to produce knowledge about the world.

2.11 Epistemic cultures

A cartoon illustrating different cultures of knowledge production, from humanities to astronomy. Image credit: Generated with the DALL·E image model, OpenAI, accessed via ChatGPT (April 2026).

2.12 The reproducibility crisis

Science is the formalisation of ways to avoid lying to ourselves

  • Reproducibility is a key part of how science views itself.
  • This ideal is far from realised
  • We should be able to do well in computational science.
Illustration of the CI/CD workflow building this lecture

2.13 Service provision as an academic practice

UCL ARC's hybrid academic-service model
  • Utility
  • Curiosity
  • Community

Part three: Some futures

3.1 Physics-free gravity

3.2 The triumph of stamp collecting.

A magnifying glass inspecting a stamp collection Image credit: Wikimedia commons, Heptagon, CC-SA.

“All science is either physics or stamp collecting” - attributed to Ernest Rutherford, perhaps apocryphal.

3.3 FAIR and Open science

  • Findable
  • Accessible
  • Interoperable
  • Reusable

3.4 Five Safes

  • Safe Data
  • Safe People
  • Safe Projects
  • Safe Settings
  • Safe Outputs

3.5 Models as data

3.6 Living with Machines

18th Century factory workers with a large engine Image credit: Living With Machines project, Alan Turing Institute and British Library.

3.7 Research software engineering and LLM coding

3.8 Mathematical assertions as AI specs and automated tests

In the limit that the timestep is small, and the floating point precision is high:
      orbits should be ellipses with the sun at one focus, 
      with orbital periods squared proportional to major axis cubed
def Converges (F : ℕ → ℕ → Set State) (L : Set State) : Prop :=
  Tendsto (fun q : ℕ × ℕ => F q.1 q.2) (atTop.prod atTop) (𝓝 L)

theorem kepler
    (P : Params) (x0 : State) :
    ∃ L : Set State,
      Converges (solveOrbit P x0) L ∧
      IsEllipse P L ∧
      (period L) ^ 2 = ((4 * Real.pi ^ 2) / P.μ) * (semiMajorAxis L ^ 3) := by
  sorry
The logo of the LEAN programming language Image credit: Lean Focused Research Organization (FRO).

Part four - endmatter

4.1 Recap

  • We’ve understood what research engineering is from code examples
  • We’ve defined it as a discipline
  • We’ve considered it in relation to science and engineering and its links to both
  • We’ve considered methods of knowledge production and concluded that academic service provision is an important part of scholarly practice.
  • We’ve looked at some futures: data-driven science, security and federation, and AI-assisted engineering

4.2 Thanks (part one)

All those who have mentored and helped me in each of my prior roles

  • Chris, Alan, Ben and Bryan for the PhD
  • Anne, Rob, Anthony, Peter and Ofer for the beacon project
  • Kris, Malcolm and Gavin at the Mathworks
  • James, Jen, Andrew and Gavin at AMEE
  • Peter, Derek, Rupert, Miguel, Dave and Owain at the CCS

4.3 Thanks (part two)

  • Claire, Bruno, Owain, Jonathan, Mayeul, Jens, David, Raquel and many others from RITS
  • James, Martin, Christine, Jon, Alan, and many others at the Turing
  • Bryony and Mark at UKRI
  • Clare and various nameless folk at the Joint Biosecurity Centre

4.4 Thanks (part three)

All those who have helped me over the last five years in UCL, including but not limited to:

  • Donna, Jonathan, Ben, James, Jenya, Owain, Emma, Tim, Rachel, Susan and many others in ARC
  • Andy, Ben, James, Paul, Sarah, Jo, Ric, Tom, Alan, Lloyd, Sandra, Fiona, Caroline, Maysaa, Sophie
  • Geraint, Claire, Aimee, Paul (RIP), David, Steve, Danny and many more across UCL
  • Allison, Katherine, Max, Martin, Katie, Lynn, James, Francisco, Sam and the grand challenges team

4.4 Thanks (part four)

Colleagues from across the research engineering community

  • Neil, Simon and the gang at the SSI
  • Rob, Mark, Sadaf, Simon, Paul, Jeremy, Mark, and many others in related roles across the UK
  • Greg and successors at the Carpentries
  • The RSE Association and all its leaders over the years
  • Sandra, Dan, Michelle, and others across the international community

4.5 Thanks (part five)

  • Sue
  • Lindsay
  • Bob, James, Clare, Lorna, Chris, Julian, Caroline, Steve, Khadija, Jan, Salley, Jim, Katherine, Kath, Matt, Phil, Alex, Graham, James, Dave and others for silly games and silly conversations.

4.6 Background for the questions