# Mathematical Systems Modeling

The majority of this book will focus on mathematical models, specifically, models for social media systems. What separates mathematical models from many others is the ability to apply data and parameters to the model as inputs in order to obtain numeric outputs. Additionally, they can easily combine with and complement existing models as needed.

Another benefit of mathematical models is the ability to apply science and engineering methods to them directly. For instance, if a home thermostat is modeled with a mathematical model (one or more equations in this case), then engineering control methods such as feedback loops can be mathematically applied to the model directly to regulate the home’s room temperature. It cannot be done directly with a physical model or schematic drawing, for example.

# Microscopic and Macroscopic Models

So far, we have mostly focused on modeling individual entities. However, it is often useful and even required to model groups acting as a whole. In a previous example, a boulder was rolling down a hill. This can be modeled as a single object. What happens if several smaller rocks are rolling down the same hill after a natural disaster strike or similar situation? It would be impractical and not especially useful to model each rock and combine the models for each when we generally want to know where they will fall. In this case, the concern isn’t where each rock falls, but if you built your house in a poor location down the hill! Given these concerns, models of systems or entities can be defined on a microscopic or macroscopic level.

Microscopic level models (sometimes called agent-based models) focus on individual entities or a collection of individual entities. A school of fish is

FIGURE 6.1: Microscopic and macroscopic modeling of vehicular traffic.

made up of hundreds of individual fish. Each fish swims at a certain speed with a general movement pattern and responds to the fish surrounding it. This group of fish, as neighbor-dependent individuals, will behave in a certain fashion and can be modeled by using each fish’s individual model and accounting for inter-group interactions between the fish. It can be beneficial if we care about any given individual. Perhaps there is a group leader or the physical formation of the fish influences individual behavior. In road traffic, a self-driving car will behave differently from human-driven cars and must be treated differently while modeling. Some users are much more influential on social media services than others due to their number of followers, celebrity status, or expertise in the discussion domain.

Macroscopic level models are concerned with society, the state of society, or a group treated as one entity. By “one entity”, it is not meant to imply that the previously mentioned school of fish is modeled the same as one fish, but as an aggregate (or overall combined whole) of all of the individual fish by integrating and accounting for microscopic characteristics. In this case, a macroscopic level model of a school of fish will combine elements of leading fish, boundary fish, center fish, and any other categories to treat the entire school system as a single “average” entity. For mostly homogeneous groups (where all entities are reasonably similar to each other), this can be an advantageous modeling method. It typically simplifies very complex systems into functional groups that can be readily analyzed or mathematically manipulated. Road traffic in this model level is concerned with overall traffic density, speed, and flow, not any individual car. For social media uses, trending tweets, viral video spread, and even how quickly your favorite show gets spoiled online are good reasons to use macroscopic level models. Any individual will make only a small impact on these cases, and it’s the population as a whole that is of interest.

Figure 6.1 demonstrates the differences between microscopic and macroscopic models for a sample traffic system.

# Basic Steps to Develop a Mathematical Model

There are many ways to create mathematical models. The method used largely depends on the system being modeled. However, several key steps are common throughout most model development, as follows

- 1. Identify and quantify objectives
- 2. Develop and draw a basic conceptual model
- 3. Validate basic model concepts
- 4. Perform basic sensitivity and evaluation tests
- 5. Collect data to validate the model
- 6. Use the model for various applications

The model development process is summarized in Figure 6.2. The first step of model development is to identify and quantify the model objectives. What is the model trying to do, or what questions is it attempting to answer? How accurate or detailed of a model is required? Who will be using the model, and for what purpose? What will the model's output look like, and what time and space scales will it cover? All of these questions must be answered initially in model creation. It will help focus the direction of model development in order to meet a practical goal.

Next, a conceptual model must be developed. Draw or diagram the model as best as possible and identify what physical laws or principles must be integrated into the model along with the system parameters. Additionally, identify what assumptions or approximations should be used to both simplify and generalize the model for typical use (or for a specific application). The diagram should assist in identifying and writing the basic equations necessary. It will result in a basic model that can be further developed.

Validating the basic model concepts is critical at this point because any oversights will lead to much larger problems in the future. Does the model seem to represent the system being modeled accurately? Does the output seem reasonable in scale, and vaguely match the expected results? If not, return to the conceptual model and make corrections based on these preliminary findings.

After the basic model concepts are verified, preliminary sensitivity and evaluation tests should be performed. For example, a system might perform differently under extreme conditions (hot or cold weather, examining tiny populations, etc.) or behave very differently after a small change of one parameter. Do very high and low values as inputs lead to outputs that make sense in reality, or does the model break down at those ranges? If so, perhaps the model assumptions are flawed, or approximations should be adjusted. Think through and test different typical and extreme values to see where the model begins to fail (ideally using computer software).

To properly validate a model, data must Ire collected. The sensitivity analysis results should help determine what data and level of detail for that data are needed. Use that data to test the model against reality. Ideally, a very high confidence interval is desired. However, this is much more difficult in systems with a great deal of uncertainly and chaos, such as biological or social systems. The model will never validate perfectly, but it should give clues as to when the model is valid or invalid.

The model can finally be used in practice. During this time, it may need to be re-evaluated or expanded as new cases arise that were unanticipated. That is fine. In fact, it’s a necessary step in evolving scientific and engineering paradigms as these fields gain understanding through new research and discoveries.

# Model Validation

Once a model is mostly complete, there are several questions one must ask. How good is the model? Does it compare well with experimental results? Does it accurately match the real system being modeled as closely as practical? Do assumptions or approximations heavily influence the output of the model? These questions all fall under model validation, the processes, and activities intended to verify that models perform as expected and are in line with their design objectives.

There are many ways to validate a model, particularly a mathematical model. This topic will be discussed in detail in later chapters using social media model examples. For now, we will simply say that model validation is the comparison of the model to the actual system, resulting in favorable outputs. If a model reasonably predicts an output given an input, we can say that the model is generally good. For mathematical systems, a simple test of a good model is having low error. If an identical input is sent to both a model and a real-world system, a resulting pair of outputs is produced (one for the model and one for the real-world system). The numeric difference between these outputs is known as the model error. A small error is favorable, while a significant error usually points to a problem with the model, assumptions, or approximations that must be reexamined. Sometimes it may be difficult to validate models in a practical sense, especially with social system models, and special validation schemes must be developed with care.

# Modeling and the State-Space Representation

As system complexity increases, it becomes more challenging to represent multiple system elements in an understandable fashion mathematically. Some

FIGURE 6.2: Summary of model development steps.

equations may be first or second-order differential equations, and the input- output relationship of the system model may not be intuitively clear. It is especially true if one system element influences another and cannot be examined independently. In other words, when system dynamics are coupled or complex, a new way to represent them is useful.

State-space representation attempts to address this issue by representing mathematical models as a set of input, output, and state variables related by first-order differential equations referred to as state equations. Based on the input values and state equations, the state variables update their value at any given time as the system evolves. Similarly, the output variables will update based on the state variable values and output equations. Here, we will take the simplest case, where the dynamical system is a linear time-invariant (LTI) system. In this case, differential equations can be written as simple algebraic equations and matrices. This representation allows for a convenient way to represent and manipulate systems with multiple inputs and outputs.

The general state-space representation of an LTI system has the following form:

where:

- • x is the state vector
- • у is the output vector
- • u is the input or control vector
- •
*A*is the system matrix - •
*В*is the input matrix - •
*C*is the output matrix - •
*D*is the feedthrough or feedforward matrix - • *(f) is
*£x{t)*

The first equation. x(t) is known as the state equation or “dynamics” of the system. It is one or more functions that describe the evolution of the .system over time. The control term of the system, u(t), is the input to the system, usually in order to influence the system output. This control element can be included in one or more state equations to affect the system beyond its natural evolution. The second equation is referred to as the output equation, which describes the system output. It is important to note that the state variables must be linearly independent. In other words, they cannot be expressed as a linear combination of any other state variables.

For an intuitive understanding of models in state-space form, addition and subtraction of terms in state equations can be interpreted as elements that contribute to a change in the system states. The control term *Bu(t), *for example, is the addition of a control action to the system in order to change the output. In contrast, the ,4x(t) term is the natural evolution of the system, without external influence. Multiplication and division of terms in state equations can be interpreted as an interaction of elements contributing to a change in the system states. Next, we will examine several examples of system models and how to represent these models in the state-space form.