Mathematical Modeling of Real-World Problems


Insights from mathematical models make the headlines daily, though the accompanying numbers and graphs do not always make sense to the uninitiated. What makes it difficult for models to agree on climate change predictions? Why is it so hard to predict and mitigate the impacts of a pandemic?

Exposing students to authentic problems equips them with sophisticated problem-solving skills that are essential to succeed in future job markets and to thrive as global citizens. The Computing with R for Mathematical Modeling project (CodeR4MATH) is developing mathematical modeling activities within an interactive online environment that help high school students apply mathematical concepts and skills such as writing equations and reading and understanding charts to solve real-world problems. Students explore open-ended questions using real-world data and a powerful and popular programming language.

Mathematical modeling activities

Mathematical modeling activities are a common component of computer science (CS) courses. However, not every secondary school offers CS courses, and when they do, the courses are typically electives. By bringing real-world mathematical modeling experiences to high school math classrooms we aim to provide students and teachers with the opportunity to exercise computational thinking through math modeling using the R programming language, an environment for statistical computing and graphics that is widely used by academics and data science professionals worldwide.

CodeR4MATH activities are designed to help students explore how mathematics and computation can be combined to build models that represent and help make sense of the world around them. While CodeR4MATH activities mimic the types of challenges and learning processes that professionals face when solving problems, various levels of scaffolding are available to students through pre-populated code snippets, hints, prompts, and quizzes.

New CodeR4Math activities for secondary students.
Figure 1. New CodeR4Math activities for secondary students.

The CodeR4MATH activities follow a common pattern. First, they present a real-world situation and pose an open-ended question, then they guide students through the process of brainstorming the problem, making assumptions, and defining the essential variables. This culminates in a simplified description or model of the problem. Students then create algorithms to solve the simplified model, testing their algorithms and assumptions by coding in R. By the end of each activity, students have a mathematical model in the form of computer code, representing a solution to the simplified version of the original, open-ended problem. Students revisit their list of initial assumptions, with the goal of improving their models.

In the “Lifehacking with R” activity, each student assumes the role of a college advisor, responsible for giving financial advice to first year college students who need to decide whether to purchase a meal plan or pay for food on a per meal basis, called simply “meal plan” and “pay as you go.” Students quickly realize that one size does not fit all. In addition to the financial aspect, the answer may depend on other factors, some of which are hard to quantify, such as personal preferences and values.

Brainstorming bare necessities

The first step is to brainstorm the problem. Students are given the cost of a meal plan at a specific college as well as hypothetical costs for each meal. They are told that the college has many restaurants at its campus center, and receive a list of several. Students are free to use any search engine to browse these restaurants, the kinds of food they serve, prices, and more. They are asked to jot down anything they think would influence the decision. To start, they consider the financial aspect. What is the cheapest option? What factors control the costs?

Creating algorithms and the first steps of coding

Keeping the initial assumptions in mind, students experiment with several code snippets, already populated with a full or partial R code (Figure 2). The activity offers high scaffolding when the student runs existing code to check the output, medium scaffolding when the student can modify a small portion of the code and run it to check the new output, or minimal scaffolding when the student follows examples to add new elements such as new variables or mathematical expressions. If code changes prevent it from running, a “Start Over” button allows the student to reset to the original code. Students also have access to hints with templates that help them modify their code with new equations and graph outputs. After students submit their work, they can see the solution.

Example of an exercise from a CodeR4MATH activity with an R code snippet for students to complete and run. They can start over or check hints at any time, and the solution becomes available after they submit their work.
Figure 2. Example of an exercise from a CodeR4MATH activity with an R code snippet for students to complete and run. They can start over or check hints at any time, and the solution becomes available after they submit their work.

Data-driven models and the impact of visualizations

After exploring and working with some code snippets, students dig into real datasets. They are able to explore tables (which R calls “data frames”), extract statistical information from different variables, explore relationships and dependencies, work with data visualizations, and compare results. Figure 3 shows some of the elements that can appear in the CodeR4MATH activities, such as code snippets, outputs like statistics, graphs, and tables, and multiple-choice and open-ended questions.

R code snippets and their outputs, including graphs, statistical information tables, and open-ended and multiple-choice questions.
Figure 3. R code snippets and their outputs, including graphs, statistical information tables, and open-ended and multiple-choice questions.

Conclusion

Almost 140 students have participated in classroom implementations of CodeR4MATH activities. Our results have shown that even students who have never done any prior computer programming are able to understand mathematical modeling and how professionals use computer programming to create, test, and validate models.

Through CodeR4MATH activities, students learn to apply the iterative process of mathematical modeling: defining the problem, making assumptions, simplifying the problem, defining variables, getting solutions, validating the model, and reporting results. Throughout the process, students engage in computational thinking while learning the basics of coding in a widely used programming language. The teacher’s role is to spark and facilitate brainstorming, control the pace of the activity, provide feedback to students, coordinate group or individual projects, and evaluate student work.

With a new set of activities, we hope even more students will have the opportunity to make sense of real-world problems through math modeling (Figure 1). Teachers and students can access free web-based CodeR4MATH activities without downloading software or registering for accounts using any computer with a current Web browser.

Kenia T. Wiedemann (kwiedemann@concord.org) is a postdoctoral researcher.

This material is based upon work supported by the National Science Foundation under grant DRL-1742083. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.