How can I integrate computation into my physics classes and curriculum?

posted December 21, 2023
by Danny Caballero, Larry Engelhardt, Marie Lopez del Puerto, and Kelly Roos

As educators, we should give our students the opportunity to engage with computation throughout the physics curriculum both to better support our students to enter an increasingly data-rich and model-driven world, and to better represent the discipline of physics in light of where it is - with many of the most recent noteworthy discoveries in physics (Aad et al. 2012; Chatrchyan et al. 2012; Abbott et al. 2017) involving extensive use of computation. Nationally, more physics faculty are integrating computation into their courses (Caballero and Merner 2018) in a variety of ways from small to big: incorporating a few computational activities into existing courses, creating a “Computational Physics” course, or more methodically integrating computation throughout the four years of an undergraduate degree. It is ok to start small and make gradual changes! In this recommendation we will (a) discuss how to make a plan, (b) link to resources and to examples of successful approaches from a variety of instructors at a variety of institutions, and (c) talk about other issues to consider as you integrate computation.

What kinds of computation skills might I want to teach my students?

Computational skills encompass three different types of skills:

  1. computational physics skills (e.g., translating models into code, choosing scales and units, choosing appropriate algorithms and tools, extracting physical insight, understanding the limitations of computers and computer models),
  2. the use of a variety of computational tools (e.g., spreadsheets, structured programming languages, computer-based symbolic manipulations, modeling packages), and
  3. technical computing skills (e.g., analysis, visualization, and presentation of data).

For any course you are teaching, think about the course goals and how they relate to computation. For example, a goal for a physics course may be for students to model physical systems and understand the limitations of those models. To see more examples of goals for computations skills, see the AAPT Recommendations for Computational Physics in the Undergraduate Physics Curriculum (Behringer et al. 2016) which lists learning outcomes, curricular issues, and challenges.

Where can I find resources and materials for teaching computational skills?

The PICUP collection of peer-reviewed Exercise Sets as well as contributions to the Faculty Commons contain many computational activities with implementations in a variety of programming languages that can be adapted to your course; materials can be filtered by course level or by subject. Also consider joining the PICUP Community on Slack - an inclusive and supportive community where faculty can ask each other questions about pedagogy, get help resolving technical issues, and ask for advice in using computing in your physics classes.

Three good places to start for ideas for how think more broadly about integrating computation throughout the undergraduate physics curriculum and examples of successful approaches are

  1. the AAPT Recommendations for Computational Physics in the Undergraduate Physics Curriculum (Behringer et al. 2016) which lists learning outcomes, curricular issues, and challenges;
  2. the EP3 Guide’s chapter on Computational Skills which has information on benefits, effective practices, and programmatic assessments; and
  3. the 2021 PICUP Virtual Capstone Conference Report which discusses the current state of computation in the physics classroom, themes that emerged from the conference such as how to create an effective computational learning environment for students, how to support faculty looking to integrate computation, and considerations for integrating computation across the curriculum, and includes an appendix with a literature review of resources for adopters.

How can my department integrate computation into the broader physics curriculum?

We should remember that the reason we are integrating computing into our physics courses is for our students to learn physics well. In each of our classes, we need to support students with all forms for prior experience with physics and attitudes towards physics or computing. We must work to design instruction that is active as well as inclusive and to promote positive attitudes towards computing in physics. Providing responsive and supportive feedback to students as they develop their knowledge and skill of computing is key.

The uses of computing in physics are many and varied, and we should support all attempts to make our course instruction in physics more relevant and practiced. There are many ways to start integrating computing in your course, but it is critical to take an intentional and steady approach. Collect data around your goals. Talk with your students. What is working? What is not? Reflect on your data. Share your reflections with friends and colleagues, and with the PICUP community.

For departments, it is, again, important to support all attempts to integrate computing in physics. As we’ve found, the time, energy, and expense of doing this work is real (Dancy and Henderson 2008; Wieman 2017; Leary, Irving, and Caballero 2018). Chairs and deans can support their faculty and students through mini grants, teaching and learning projects, teaching releases, sabbatical projects, and so on. Again, collect data. Talk with students and instructors. And encourage open and respectful discussion of the goals and progress.

Computational skills can be included in an existing physics course, or you can develop a whole course on computational physics. Integrating these skills into a single existing course is an easy way to start. Developing a whole intro course is a good way to set you up for integrating these skills throughout the curriculum.

How do I include computation in an existing physics course?

Think about the course goals and how they relate to computation. For example, a goal for a physics course may be for students to model physical systems and understand the limitations of those models. Doing this computationally at the introductory level could include building a spreadsheet or using GlowScript to model projectile motion with air resistance and then investigating how the model works for different projectile speeds and sizes. At the upper-level students could model heat flow through a rod, the efficiency of a water turbine, rainbows, gravitational waves from binary orbits, or other interesting phenomena

How do I design a whole course on computational physics?

One important question will be where this course fits into your broader physics curriculum: at the introductory level, or at the upper level? This question will impact both the details of what happens inside of the course, and how the course connects with the other courses in the curriculum.

For example, there are advantages to having students take this course during the same semester that they take introductory E&M. With introductory mechanics as a course prerequisite, there are plenty of computational activities from which to choose, and there are many opportunities to foreshadow more advanced topics by giving your students a little peek, or taste, of what is to come.

If you develop a computational course that is offered at the introductory level, consider the next steps that can be taken to help benefit the entire curriculum:

  1. Make this course a graduation requirement for the physics major — and perhaps also for engineering majors if you have them. This doesn’t need to happen immediately, but whenever the opportunity arises, add this requirement!
  2. Add this course as a prerequisite for your upper-level physics courses. This doesn’t mean that faculty are required to integrate computation into their upper-level courses, but it will make it easier for them to do so if they so desire.
  3. Once the computational course has been added as a prerequisite, talk to your colleagues who are teaching the upper-level courses, show them what the students already know how to do, and help them to think about ways that computation could be added to their courses…which might start out as just making some plots of the traditional physics content.
  4. Hopefully computation will eventually find its way throughout your curriculum, and when that happens, update the catalog descriptions for the upper-level physics courses to state that computation is an important part of the course. This will make it more likely for this integration of computation to persist into the future when different faculty teach the courses.

Designing an introductory computation physics course

In an introductory computational physics course, students need to learn certain basic programming skills, which include: using some programming platform (e.g., Python, Matlab, etc.), writing lines of code to use the computer as a calculator (using variables), writing code to use the computer as a spreadsheet (storing numbers in arrays), creating plots, and looping to iteratively update the values of variables. In the process of learning these basic skills, students will also begin to learn about the process of debugging, and hopefully by the end of the course they will become proficient at debugging!

Once the students have been introduced to these basic skills, they can apply these skills to many interesting mechanics problems. With a basic knowledge of 1D free-body diagrams, they can use their computational skills to analyze the stresses within a space elevator. They can simulate and analyze dynamics problems that have a time dependent force, including air resistance, which can be applied to skydiving from the upper atmosphere or launching a V2 rocket. Two dimensional problems can be analyzed, such as traveling to Mars, 2-body orbits, and even binary systems of extremely massive objects that lead to an in-spiral orbit with the emission of gravitational waves.

Other typical topics include basic data science (file input and output, fitting data, and using libraries such as pandas), an introduction to Monte Carlo methods, solving systems of equations (basic linear algebra, often using libraries such as scipy and/or sympy), and basic Fourier analysis (for a full list of computational skills, see Behringer et al. 2016). If time permits, students could also be introduced to more advanced topics such as Machine Learning and Molecular Dynamics.

Popular books for an introductory-level computational physics course include Newman 2012 and Kinder and Nelson 2021. Open source alternatives are also available: Linge and Langtangen 2020 provides a free, open access introduction to scientific computing, and Langtangen 2016 provides a more comprehensive reference.

Designing an upper-level computational physics course

For an upper-level computational physics course, there are many great textbooks available, and the physics content that can be simulated is vast! To get a sense of the types of problems that you can consider, Gould, Tobochnik, and Christian 2007 and Landau, Paez, and Bordeianu 2011 are both freely available from ComPADRE and both cover a lot of physics content. An upper-level computational physics course is a lot of fun to teach, and can help to prepare students for graduate study and future employment. But it is unlikely that it will provide as much of an opportunity to prepare students to use computation in their other undergraduate courses, as compared with an introductory-level computational course.

How do I integrate computation in an equitable and inclusive way?

All of this work will have little impact if we do not support all learners, instructors, and staff to do this work. In order to create a diverse, equitable, and inclusive physics curriculum, we should reflect on our instruction and practice in critical ways when integrating computing. Who is getting supported? Who is not? Do you need to establish pathways to support anyone who requires accommodations? While inclusive teaching and learning in physics is an active area of research, there are already resources for instructional designs that support all students including some linked from the Effective Practices for Physics Program site.

How do I decide on appropriate programming platforms?

Thinking about the course goals, as well as what resources you and your students have access to, will help you decide on an appropriate programming platform. For introductory courses, this often means spreadsheets, GlowScript/vPython, simulations, and video analysis software. At the introductory level, computational activities are often integrated into the laboratory or problem-solving sessions given the longer time period and smaller class size. For upper-level courses common programming language choices are Python, MATLAB, and Mathematica, with computational activities given as homework or longer projects. The PICUP Resources page contains a selection of recorded workshops for faculty demonstrating different programming platforms and showing examples of how to engage students with them, as well as examples of how faculty at different kinds of institutions integrate computation into their courses.

References