Comparing student conceptions and construction of while loops in modeling motion

.

With the integration of computation into physics courses becoming more prevalent to adequately prepare our graduates for the workforce, there is a need for instructional and assessment materials for computational practices. In introductory physics courses, computation is typically used to model motion and so while loops are one of the first components of programs that students encounter. Our study examines and compares students' conception of the while loop following the completion of three computational problems and their engagement with the while loop in a new computational problem. We present three student cases who have similar conceptions of the while loop with aspects including its update function and the connection of lines of code in the while loop, specifically in how force, position, and momentum depend on each other. Despite their similar conception of the while loop, there is a variation in the outcomes of their engagement with the while loop in a new computational problem.

I. INTRODUCTION
Computation is an increasingly integral component of scientific research. In order to adequately prepare physics graduates for their future careers, calls and recommendations have been made to encourage the incorporation of computation into physics programs [1,2]. While there had been an uptake in computational physics instruction, there remains a need for material development, teaching practices and assessment strategies [3,4]. Recent physics education research has provided frameworks and guidelines for identifying and assessing computational physics practices [5] and physics computational literacy [6], and has tested strategies for integrating computation into physics courses [7][8][9][10].
Physics education research has a long history of investigating students' understanding of specific concepts and tools in specific contexts resulting in the development of targeted instruction and new assessment instruments (e.g. [11][12][13][14][15][16]). This study aims to contribute to that tradition and to the necessary background for promoting and developing computational physics instruction by investigating students' understanding of the conditional loop component of computer models. Specifically, our goal is to investigate students' conceptions of the while loop for modelling motion. Given their utility for modeling motion, while loops are a prevalent component of programs implemented in introductory physics courses [17]. In this context, while loops typically contain a sequence of update equations that direct the computer on how to change quantities such as force, momentum and position on each iteration through the loop. The while loop also contains conditions for when to start and stop the calculations and how often to iterate.
In this study, we examine and compare students' conception of the while loop following the completion of three computational problems and their engagement with the while loop in a new computational problem. In this paper, we present three case studies that demonstrate that students with a similar conception of the while loop have different outcomes when presented with a new motion model.

II. RESEARCH CONTEXT
Our investigation was situated in a flipped introductory mechanics course designed to provide students with opportunities to engage in various scientific practices including computation [18]. Computation was incorporated to introduce students to a tool for doing and learning physics and to give them experience with computational thinking practices. As such and because the majority of students have no prior coding experience, minimally working programs (MWPs) [19] were used to scaffold student sense-making about computing. In an MWP, students are given a chunk of code that will run but does not correctly model the intended physical scenario. Instead, a piece of the code is intentionally incorrect or some lines of code are missing, so that the student's task is to mod- ify or add to the code to successfully model the scenario [7]. During class, students worked on these problems in groups of four sharing one computer.
The study was conducted midway through the semester when students had already completed three computational problems. What code students had to write in the while loop increased in complexity with each problem. The first involved modeling the relative motion between two objects with different constant velocities so that the while loop only required a position update. The position update for all three problems was written in terms of momentum, e.g. Object.pos = Object.pos + pObject/mObject * dt, where Object.pos is the position of the object, pObject is the momentum of the object, mObject is the mass of the object and dt is the time step. The second problem involved acceleration so that momentum and position updates were required and the third involved a force that changed with position so that force, momentum and position updates were required. Figure 1 shows the finished while loop for the third problem where students modeled the geosynchronous orbit of a satellite around earth. The highlighted lines are those that students needed to add to the provided while loop code in order to successfully model a geosynchronous orbit.

III. METHODOLOGY
A. Data Collection 15 students were recruited to participate in interviews after the first three computational problems in the course were completed. All students in the course (approximately 80) were invited to participate in the interviews through class announcements and email and we interviewed all students who volunteered. Students were informed that the purpose of the interviews were to gain insight into their experiences with and understanding of the computation in the course so far.
The interview protocol was open-ended and consisted of three separate parts. The first part included questions about students previous experience with computation before the course and about their feelings about how the course was going for them so far especially with regard to the computa- tional aspects. The second part focused on their conceptions of the while loop. Here students were asked to talk about the three computational problems they had completed in class, the function of the while loop in each model, and the similarities and differences between the while loop across each model. Students were then presented with the complete code for the satellite (third) problem from class and were asked to walk the interviewer through it. In the last part of the interview, students were given a new MWP problem to consider. The physical scenario was as follows: "A force is applied to a 0.5kg block so that it begins to move across the table with an initial velocity of 2 m/s. After moving some distance across the table it comes to a stop. The coefficient of friction between the block and the table is 0.2" Figure 2 shows the code that was provided. Students were asked if the code accurately models the motion and if not, to makes changes to the code so that it does. They were also asked to think aloud as the worked through the code. The scenario was chosen because although friction had been introduced in class it had not appeared in any of the computational problems. In addition, the while loop here only requires a momentum and position update that places it at medium complexity in terms of the loops they had already encountered. Because the block position update was given, students just needed to add a momentum update line, pblock = pblock + Fnet * dt, to model the motion correctly. We note that the loop termination condition also needs to be modified but we will not discuss that aspect in this paper.

B. Analysis
Given the difference between the first two parts and last part of the interview, we are performing two different types of analysis. A phenomenographic method [21,22] is being used to identify themes in how students experience the in-class computational problems and to explore the variation in their conceptions of the while loop. A description of those themes will be the focus a subsequent paper. Here, we focus only on three student cases who belong to a similar theme where students outline key ideas related to the struc-ture and function of the while loop like updates, iteration, dependency of force, momentum, and position and how you connect those quantities through code. Other themes include ideas around function only, a focus on differences in structure of while loops across previous problems, and describing complexity/difficulty in coding the while loop.
Our examination of the student engagement with the new friction problem takes the form of a task analysis [20] where the steps (actions and processes) each student goes through is identified [7]. Steps are categorized using the Weller et al. [5] computational thinking framework.

IV. RESULTS
In this section, we present our analysis of three student cases. All three students were physics majors or minors and none of them had any prior experience with computation.

A. Student conceptions of the while loop
Student A emphasizes the importance of the while loop in modeling motion and describes how more quantities need to be updated as the motion being modeled increases with complexity.
"The while loop is the most important thing just because if you want it to do anything you will have a while loop in order for it to update everything" "[First program] In the code there's only a couple of equations, the position update formula and the velocity formula. You can update the position in the code so that you're dot ends up in a different place.... but in the week after that it gets more complicated because we're starting to add more things like acceleration which changes velocity and the velocity is supposed to change the position... you have to have a new formula added to the code" They also specifically identify the "momentum update formula" in the satellite problem code and state that "the final momentum equals the initial momentum, which is up here [in parameters and initial conditions], plus the F net, which we calculated to be the force due to gravity, times the change in time" and allude to the iterative nature of the loop when explaining dt as "the time step, which is approximately how many steps it'll update itself". Student B also highlights the importance of the while loop ("the while loop seems like the most important piece in every program") and explains its purpose as "telling the object or whatever you are trying to get to move or have motion what to do at each time step" They talk about the connectedness of the lines in a while loop in general ("in a way each line depends on the line above it") and the lines present in the satellite problem: "Once you have Fnet you can then use the momentum to get the change that it's going in which then gives you the position." They also refer to the while loop in the satellite problem as the "calculations... for each time step".
In their conception of the while loop from a previous class problem, we see these three cases as similar in how they describe its structure and function. Students A, B, and C connect lines of code in the while loop, specifically in how force, position, and momentum depend on each other. They all describe the basic function of the while loop as an update, using similar language to emphasize its importance in modeling physical situations from previous class problems. Figures 3, 4, and 5 show a detailed task analysis of each of the students interaction with and path taken through the friction problem. We observe a variation in the steps and path followed by each of the three students. The following text summarizes the parts that pertain most to students' interpretation and modification of the given while loop.

B. Task analysis of the friction problem
Upon reading the while loop, Student A identifies the central problem with the given code for modeling the desired motion: "they are only updating the position of the block based on the momentum of the block, but that's kinda like saying the block is moving at a constant momentum." Following the running of the code, they state that "we should have a momentum update formula which says that our final momentum will be changed by the force due to friction" and then they immediately write a correct momentum update line completing an expert-like interaction with the code.
Student B also examines the while loop early in their interaction of the friction problem and identifies that "you're missing a lot of steps for how to get the block's position...It needs force." Again after running the code and confirming that friction is not currently affecting the motion of the block, the student identifies that the momentum in the while loop "needs to have friction involved in it... we need to add the force of friction in here to make it affect the momentum." They first suggest adding a force term to the current block position line but following a number of interview guided tasks, the student writes a new variable for momentum p2block and sets it equal to Fnet * dt, and they then replace the momentum with this new variable in the position update equation. They run their code to check, see the block is now not moving, and fix the new momentum equation to include an update. The interviewer prompts them to look the update equation for position, which leads them to replace p2block with just pblock and successfully modify and run the program.
Student C does not consider the while loop before running the code for the first time. Though they observe the animation display a constant motion, a second examination of the code leads them to conclude that the code is correctly modeling the required motion: "I don't really see anything wrong with this block position...I don't really see anything wrong with this." When the interviewer prompts them to reconsider the student identifies an error with momentum representation in the while loop: "I'm thinking that the momentum of the block...yeah the momentum of the block doesn't look too right to me. Shouldn't that be change in momentum? So shouldn't there be initial momentum plus...I'm not exactly sure." It is still a number of steps later, including more interviewer prompting, before the student writes the momentum update line. However once the need for the update is identified, the student writes it correctly without guidance.

V. DISCUSSION AND CONCLUSION
Based on our analysis of student conceptions of the while loop, it appears that all three students (all had no prior computational experience) have successfully incorporated the iterative nature of the while loop and the connectedness of quantity update formulas into their conception of the while loop after engaging in only three computational problems. However, we observe a variation in outcomes from their interaction with a new problem. Student A applies their identified conception aspects successfully, recognizing the need for and writing the momentum update. Student B's recognition of the need for momentum to have friction 'involved in it' suggests the application of quantity connectedness. However, their defining of a second momentum variable indicates a lack of clarity on how the iteration aspect gets applied in the loop and their struggle to add the update line suggests that they do not have all the necessary resources (or they are not activated) to write the commands they wish to. For Student C neither aspect of their conception of the while loop from previous problems seems to get applied without significant interviewer prompting. The student does not focus on the while loop initially and when they do, they evaluate it as correct though it does not connect any of the interacting quantities. In summary, even students who can well articulate the structure and function of the while loop experience difficulty recognizing the need for a connected set of updates (momentum and position) and adding the update correctly to the while loop. The variation in how students interact with the while loop in a new MWP despite similar conceptions based on previous problems, indicates that there are other necessary conception aspects or additional resources that need to be activated to successfully interpret and write new code. We plan to conduct interviews at a later stage in the course to investigate how students conception and engagement with new while loops develop through experience with additional contexts.