Fundamentals 12 min read

How to Build a Simple Weight‑Loss Model Using Discrete Equations and Python

This article presents a step‑by‑step mathematical model for reducing a 100 kg, BMI‑34.6 individual to a healthy weight, using weekly calorie intake, metabolic rates, exercise data, a two‑stage plan, and Python code to simulate the process.

Model Perspective
Model Perspective
Model Perspective
How to Build a Simple Weight‑Loss Model Using Discrete Equations and Python

Weight Loss Problem

Background

The widely accepted standard for evaluating body weight is the Body Mass Index (BMI) issued by the World Health Organization, which defines BMI as weight (kg) divided by the square of height (m). The table below shows the WHO classification and the corresponding Chinese reference standards.

Underweight

Normal

Overweight

Obese

WHO standard

< 18.5

18.5–24.9

25.0–29.9

>= 30.0

Chinese reference

< 18.5

18.5–23.9

24.0–27.9

>= 28.0

With rising living standards, the number of overweight people is growing, and many seek to lose weight. Most diet pills are ineffective or unsustainable. Experts recommend controlling diet and exercising moderately to lose weight safely. A mathematical model is proposed to design a reasonable and effective weight‑loss plan based on diet and exercise.

Analysis

Weight changes occur when energy balance is disturbed: calorie intake increases body fat, while metabolism and exercise consume calories, reducing weight. Simplifying assumptions lead to a relationship between weight change and caloric balance.

The plan must avoid harming the body, which can be expressed as not reducing calorie intake too much and not losing weight too quickly. Increasing exercise accelerates weight loss and is incorporated into the model. Weekly intervals are convenient, so a discrete‑time (difference‑equation) model is used.

Assumptions

Weight gain is proportional to absorbed calories; roughly 8000 kcal (1 kcal = 4.2 kJ) leads to a 1 kg increase.

Normal metabolic weight loss is proportional to body weight; each kilogram burns 200–320 kcal per week (about 2000–3200 kcal per day for a 70 kg person).

Exercise‑induced weight loss is proportional to body weight and depends on activity type and duration.

For safety, weekly calorie intake should not fall below 10 000 kcal, and weekly weight loss should not exceed 1.5 kg (equivalent to a 1000 kcal deficit).

Typical calorie contents per 100 g of food and calorie consumption per hour per kilogram of body weight for various activities are listed in the tables below.

Food

Rice

Tofu

Vegetables

Apple

Lean meat

Egg

Calories (kcal/100 g)

120

100

20–30

50–60

140–160

150

Activity

Walking 4 km/h

Running

Dancing

Table tennis / Cycling (moderate)

Swimming 50 m/min

Other

Calories (kcal·h⁻¹·kg⁻¹)

3.1

7.0

3.0

4.4

2.5

7.9

Basic Model

Let the initial weight at week k be w₀ , weekly calorie intake be Cₖ , the calorie‑to‑weight conversion coefficient be α , and the metabolic consumption coefficient be β . Ignoring exercise, the weight‑change equation is:

wₖ₊₁ = wₖ + α·Cₖ - β·wₖ

When exercise is added, the term β·wₖ is replaced by (β + γ)·wₖ , where γ reflects activity type and duration.

Problem Restatement

A person 1.7 m tall weighs 100 kg (BMI = 34.6) and consumes 20 000 kcal per week with stable weight. Design a two‑stage weight‑loss plan to reach 75 kg (BMI = 26) and maintain it: (1) Reduce weekly intake by 1 000 kcal each week until the safe lower limit of 10 000 kcal is reached; (2) Keep intake at the lower limit until the target weight is achieved. Then, (a) accelerate the second stage by adding exercise, and (b) propose a maintenance plan after reaching the goal.

Modeling

(1) Determine the individual's metabolic coefficient β . Since weight remains constant with a weekly intake of 20 000 kcal, we have α·20 000 = β·100 , giving β ≈ 0.16 (kcal per kg per week). This indicates a relatively low metabolic rate.

First stage: weekly intake decreases from 20 000 kcal to the safe limit of 10 000 kcal, i.e., a reduction of 1 000 kcal per week. Substituting the values into the discrete equation yields the weight after each week; after 11 weeks the weight reaches approximately 88 kg.

Second stage: keep intake at 10 000 kcal. Iterating the equation from the 11‑week weight gives the number of weeks needed to reach 75 kg, which is about 22 weeks. The total duration of the two‑stage plan is therefore 32 weeks.

(2) To speed up the process, add exercise in the second stage. Using the activity table, choose a combination (e.g., walking plus table tennis) that provides an additional calorie burn γ·wₖ . Setting γ = 0.02 reduces the required weeks of the second stage to roughly 12 weeks, so the whole plan finishes in 22 weeks.

The weight trajectories for the normal‑metabolism case and the exercise‑augmented case are plotted below.

Code

<code>import numpy as
import matplotlib.pyplot as
plt.rc('font', family='SimHei')
plt.rc('font', size=16)

def fun(delta, *s):
    w = 100
    tw = []
    for k in range(1, 11):
        w = delta * w + 2.5 - 0.125 * k
        tw.append(w)
    print(tw)
    w2 = tw[-1]  # initial value for second stage
    tw2 = []
    k = 0
    while w2 >= 75:
        k += 1
        w2 = delta * w2 + 1.25
        tw2.append(w2)
        tw.append(w2)
    print("k=%d时,w(%d)=%.4f" % (k, k, w2))
    plt.plot(np.arange(1, len(tw) + 1), tw, s[0])

fun(0.975, "s-")
fun(0.97, "*-")
plt.legend(("正常代谢", "增加运动"))
plt.xlabel("$k$/周")
plt.ylabel("$w$/kg")
plt.show()
</code>

Maintenance Strategy

After reaching the target weight, the simplest maintenance method is to keep weekly calorie intake at a constant value that balances metabolic consumption, i.e., set C such that α·C = β·w_target . If exercise is continued, the required intake can be slightly lower, following the same balance equation with the added exercise term.

Model Evaluation

The model demonstrates that weight change follows a predictable pattern and that weight‑loss can be approached scientifically and quantitatively. Although the model is simplified, it offers useful guidance for individuals focusing on weight management. The metabolic coefficient varies among people and even for the same person under different conditions; small changes in this coefficient can significantly affect the required time, highlighting the need for careful calibration when applying the model.

References

Python数学实验与建模 / 司守奎, 孙玺菁, 科学出版社

pythonBMImathematical modelingnutritionweight lossdiscrete equationsexercise
Model Perspective
Written by

Model Perspective

Insights, knowledge, and enjoyment from a mathematical modeling researcher and educator. Hosted by Haihua Wang, a modeling instructor and author of "Clever Use of Chat for Mathematical Modeling", "Modeling: The Mathematics of Thinking", "Mathematical Modeling Practice: A Hands‑On Guide to Competitions", and co‑author of "Mathematical Modeling: Teaching Design and Cases".

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.