0% found this document useful (0 votes)
5 views45 pages

Understanding Modeling in AI Systems

The document discusses the concept of modeling, emphasizing that a model is a simplified representation of real systems with various functions such as explanation, prediction, and decision-making. It outlines the modeling process, including problem formulation, system examination, and solution techniques, while also addressing the limitations of modeling, such as simplifying assumptions and parameter uncertainty. Additionally, it touches on dynamic systems and provides examples, including the Lotka-Volterra predator-prey model and the Lorenz system.

Uploaded by

dhwanit0202
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views45 pages

Understanding Modeling in AI Systems

The document discusses the concept of modeling, emphasizing that a model is a simplified representation of real systems with various functions such as explanation, prediction, and decision-making. It outlines the modeling process, including problem formulation, system examination, and solution techniques, while also addressing the limitations of modeling, such as simplifying assumptions and parameter uncertainty. Additionally, it touches on dynamic systems and provides examples, including the Lotka-Volterra predator-prey model and the Lorenz system.

Uploaded by

dhwanit0202
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Modelling

23AID201
Lecture 2

Dr. Mrittunjoy Guha Majumdar


School of Artificial Intelligence, Amrita Vishwavidyapeetham Delhi NCR
What is Modelling?
җ As a basic principle we may say that a model is a simplified version of something that is real.

җ The traits of the model can vary according to its use. They can vary in their
1. Level of formality
2. Explicitness
3. Richness in detail
4. Relevance

җ The characteristics depend on the basic function of the model and the modeling goal.

җ Models can have many different functions:


1. Explain Phenomena – Models formalize system behavior (for instance, Newton’s laws for mechanics, IS/LM in economics, predator–
prey in biology).
2. Make Predictions – Models forecast outcomes (for instance, avalanche probability from snow data, climate change from greenhouse
gas emissions, airplane maneuverability from aerodynamic models).
3. Decision Making – Models optimize actions under constraints (for instance, chemical plant design equations, traffic models for route
choice, supply chain optimization).
4. Communication – Models convey structured knowledge (for instance, a route sketch to a visitor, circuit diagrams in engineering, UML
diagrams in software design).
5. Others – Models serve as normative frameworks (for instance, aircraft maintenance checklists, ANSI/DIN/EU standards regulating
industrial and public systems).
Types of Models

Enhanced modelling has made
humanity transition from top-
down to bottom-up approach
of technology development

Ref: Buehler, Markus J., ed. Atomistic modeling of materials failure. Boston, MA: Springer US, 2008.
Constitution of a Mathematical Model

The Modelling Process

Modelling
Process
Functional view of system models
Formulation of the Problem
Problem Statement
A problem statement defines the system under study by specifying its inputs, system parameters, and outputs. It sets the foundation for
the modeling process by clarifying what aspects of the system are being analyzed and how they will be represented.
System Examination
Because complex systems involve many interrelated phenomena, the system is often broken down hierarchically into subsystems. Each
subsystem is described in terms of its input, output, and processing, as well as its relationship to the overall system and other subsystems.
This characterization may require manuals, expert discussions, direct observation, or specialized data collection.
Objectives and Goals
The problem statement should list objectives clearly and precisely, since ambiguous goals prevent actionable conclusions. For instance, in
communications networks, objectives could include determining the best packet size, routing strategy, queuing protocol, or number of
switching stations.
Requirements and Constraints
Requirements define necessary performance levels and operating conditions, while constraints often reflect practical limitations. For
example, military networks may require lower bounds on throughput and upper bounds on delay, while constraints may include transmitter
duty cycles, funding, or hardware availability.
Assumptions
Assumptions are made to simplify analysis by abstracting unnecessary details. For example, in modeling message timeliness, the detailed
bit-level operations at switching stations may be replaced with an average processing delay. Such assumptions often arise during model
formulation or from lessons learned in prior studies.
Example of Problem Formulation: Projectiles

Model Formulation, with Projectile Illustration

The last part of the formulation step involves the search for an appropriate solution technique.

Note: Model formulation is the process of expressing a real system as a precise mathematical structure (for instance, ODEs, PDEs,
algebraic/optimization constraints)—for example, the projectile-with-quadratic-drag model, whereas the appropriate solution
technique is the choice of an analytical approximation or an approximate numerical/simulation method (for instance, a Runge–Kutta
integrator such as RK4/ode45) used to extract trajectories and quantitative insights from that formulation.

This search should be exhaustive, and the technique chosen should exhibit the highest benefit-to-
cost ratio (the chosen one should provide the greatest accuracy, insight, and usefulness/benefit
relative to the effort, computational resources, time, and complexity/cost required to apply it)

Analytical solutions generally are preferred because they are exact.

Unfortunately, the vast complexity of many systems precludes the use of analytical solution
techniques.

For such systems, simulation may be the only effective solution method.
Solution Techniques (Analytical/Closed-Form)
Method Description Applicability / Assumptions

Solve equations exactly using algebraic


Linear or nonlinear ODEs/PDEs where integrable
Closed-form algebraic solution manipulation and known functions (polynomials,
in terms of known functions
exponentials, trigonometric, special functions)

Decompose PDE/ODE into products of functions Linear PDEs with separable boundary/initial
Separation of Variables
each depending on a single variable conditions

Transforms ODE/PDE into algebraic equations in Linear ODEs with initial conditions, semi-infinite
Laplace Transform
complex frequency domain domains

Expands functions in sines/cosines; transforms


Fourier Transform / Fourier Series Linear PDEs on infinite or periodic domains
differential operators into algebraic multipliers

Constructs solution as convolution of source Linear PDEs/ODEs with well-posed boundary


Green’s Function Method
with system’s impulse response conditions

Reduces first-order PDEs to ODEs along


Method of Characteristics Quasilinear first-order PDEs
characteristic curves

Uses continuous symmetries to reduce order or Nonlinear ODEs/PDEs with identifiable


Lie Group / Symmetry Analysis
dimension of differential equations symmetry groups

Express PDE/ODE as an equivalent integral Linear or nonlinear problems where kernels are
Integral Equation Reformulation
equation well-defined
Solution Techniques (Approximate/Perturbative)
Method Description Applicability / Assumptions

Expand solution in powers of a


Perturbation Methods
small parameter ε

Approximate nonlinear system


Linearization / Stability Analysis by its first-order Taylor Local analysis near fixed points
expansion around equilibrium
Separate solution behavior
Oscillatory or multi-scale
Multiple Scales / WKB Methods across different spatial or
PDEs/ODEs
temporal scales
Approximate solution by
Variational Methods / Rayleigh– PDEs in mechanics, quantum
minimizing an associated
Ritz mechanics, structural analysis
functional
Tracing solution branches for
Homotopy / Continuation Embed nonlinear problem into a
nonlinear algebraic or
Methods family of solvable problems
differential systems
Solution Techniques (Numerical/Discretization)
Method Description Applicability / Assumptions

Finite Difference Method (FDM) Approximate derivatives using differences on a grid Structured grids, moderate accuracy

Decompose domain into elements, approximate


Finite Element Method (FEM) Complex geometries, variational problems
solution with basis functions

Linear PDEs with simple Green’s functions; reduces


Boundary Element Method (BEM) Discretize only domain boundaries
dimensionality

Expand solution in orthogonal global basis (e.g.,


Spectral / Pseudospectral Methods Smooth solutions, periodic or bounded domains
Chebyshev, Fourier)

Stepwise ODE integration with controlled truncation


Runge–Kutta Methods Initial value ODE problems
error

Solve discretized PDEs on hierarchical grids for rapid


Multigrid Methods Elliptic PDEs on structured/unstructured grids
convergence

Adaptive Mesh Refinement (AMR) Refine grid dynamically in regions of high gradients Hyperbolic/elliptic PDEs with localized phenomena

Operator Splitting / Fractional Step Decompose PDE into simpler sub-problems Complex PDEs (advection-diffusion-reaction)
Solution Techniques (Stochastic/Probabilistic)
Method Description Applicability / Assumptions
Use repeated random sampling to High-dimensional problems,
Monte Carlo Simulation
estimate solution statistics stochastic ODEs/PDEs
Numerical integration of SDEs using
Stochastic Differential Equation Systems with white noise or
stochastic calculus (e.g., Euler–
(SDE) Solvers Brownian motion terms
Maruyama)

Solution Techniques (Optimization-based/Data-Driven)


Method Description Applicability / Assumptions
Reformulate differential/algebraic Gradient descent, constrained
Optimization-based Solvers
system as extremization problem nonlinear programming
Approximate high-dimensional
Reduced-order / Surrogate Parametric PDEs, real-time
system with low-dimensional
Modeling simulation
representation
Train neural networks to satisfy
Physics-Informed Neural Networks Complex nonlinear PDEs, sparse or
differential equations and boundary
(PINNs) noisy data
conditions
Limitations of Modelling
• Simplifying Assumptions and Idealizations: All models intentionally simplify reality by neglecting certain variables, interactions, or nonlinearities. While these
abstractions make problems tractable, they can lead to inaccuracies when the excluded factors become significant. For example, assuming laminar flow in a fluid
model fails to capture turbulence effects at high velocities.
• Parameter Uncertainty: Models rely on input parameters that are often estimated, measured with error, or derived from incomplete data. Even small errors in
these parameters can propagate through the model, potentially resulting in significant deviations from real-world behavior. For instance, ecological population
models are highly sensitive to uncertainties in birth and death rates.
• Structural Uncertainty: Beyond parameter errors, the underlying mathematical structure of a model may not fully capture the true dynamics of the system.
Structural inadequacy means that even perfectly measured inputs may not produce accurate predictions. An example is using linear elasticity to model materials
that exhibit plastic deformation under high stress.
• Computational Limitations: Numerical models introduce errors through discretization, finite precision, and approximations. High-fidelity simulations can be
computationally expensive, sometimes prohibitive, forcing compromises on resolution or time-stepping. For example, simulating turbulent flows requires
extremely fine grids, which may be impractical on available hardware.
• Overfitting and Model Complexity Trade-off: Increasing model complexity can improve fit to historical data but reduce predictive generalizability. Overfitted
models may capture noise rather than underlying system behavior, leading to poor performance on new scenarios. Neural networks with excessive parameters
trained on limited datasets are a classic example.
• Scale and Resolution Constraints: Models often operate at specific spatial or temporal scales, averaging or parameterizing smaller-scale effects. This can miss
critical subgrid dynamics or interactions. Climate models, for example, cannot resolve individual thunderstorms, requiring parameterization of their aggregate
effects.
• Nonlinearity and Chaos: Nonlinear systems can exhibit sensitive dependence on initial conditions, meaning tiny uncertainties can grow exponentially over time.
As a result, long-term predictions become inherently unreliable, even if the model equations are exact. Weather forecasting beyond approximately two weeks is
fundamentally limited by such chaotic behavior.
• Boundary and Initial Condition Sensitivity: The accuracy of a model is highly dependent on its initial and boundary conditions. Errors or uncertainties in these
inputs can amplify over time, producing divergent predictions. Ocean circulation models, for instance, are extremely sensitive to initial temperature and salinity
distributions.
• Data Limitations: Models often require observational or experimental data for calibration, validation, and forcing. When data are sparse, noisy, or biased, model
reliability suffers. Early-stage epidemiological models are particularly vulnerable, as limited infection data can lead to widely divergent projections.
• Inadequate Representation of Uncertainty: Many models produce deterministic outputs, neglecting variability and stochastic effects inherent in real systems.
Ignoring probabilistic phenomena can misrepresent risks or extreme events. For example, deterministic flood models cannot adequately capture the
probabilistic nature of storm surge or rare rainfall events.
What is a Dynamic System?

ENSO
Foundations of Dynamical Systems

Using Numerical and Analytical Methods for Differential
Equations in Dynamical Systems (Example)

Observations
• Euler method underestimates decay (first-order method).
• RK4 method is highly accurate (fourth-order), nearly identical to
analytical solution.
• Smaller step size improves Euler accuracy, but RK4 is more robust for
larger steps.
Phase Plane Analysis (2D Nonlinear System)

Phase Plane Analysis (2D Nonlinear System)
• Interpretation:
• Both negative → trajectories shrink into point (Stable
Node).
• Both positive → trajectories move away (Unstable
Node).
• Opposite signs → some directions stable, others
unstable (Saddle Point).
• Complex with negative real part → spiral inward (Stable
Focus).
• Complex with positive real part → spiral outward
(Unstable Focus).
• Purely imaginary → closed orbits (Center).
The intuition is that the eigenvalues tell us if perturbations
‘die out’ or ‘explode’.
Example: Lotka–Volterra Predator–Prey Model

MATLAB Implementation
% Lotka–Volterra Predator-Prey Model syms x y k2 = f(x(:,n) + 0.5*dt*k1);

% dx/dt = alpha*x - beta*x*y f1 = alpha*x - beta*x*y; k3 = f(x(:,n) + 0.5*dt*k2);

% dy/dt = delta*x*y - gamma*y f2 = delta*x*y - gamma*y; k4 = f(x(:,n) + dt*k3);

J = jacobian([f1; f2], [x y]); x(:,n+1) = x(:,n) + dt/6*(k1 + 2*k2 + 2*k3 + k4);


clear; clc; close all;
end
for i = 1:size(x_eq,1)
% Parameters
J_eval = double(subs(J, {x,y}, {x_eq(i,1), % --- Step 4: Phase Plane Plot ---
alpha = 1.0; % prey growth rate x_eq(i,2)}));
[x1,x2] = meshgrid(0:0.5:6, 0:0.5:6);
beta = 0.5; % predation rate eigvals = eig(J_eval);
u = alpha*x1 - beta.*x1.*x2;
delta = 0.5; % predator growth rate fprintf('Equilibrium %d: (%f,%f), Eigenvalues =
%s\n', ... v = delta.*x1.*x2 - gamma*x2;
gamma = 2.0; % predator death rate
i, x_eq(i,1), x_eq(i,2), mat2str(eigvals,4));

end figure;
% Define system of ODEs
quiver(x1,x2,u,v,'r'); hold on; % vector field
f = @(x) [alpha*x(1) - beta*x(1)*x(2); % --- Step 3: RK4 Simulation ---
plot(x(1,:), x(2,:), 'b','LineWidth',1.5); % trajectory
delta*x(1)*x(2) - gamma*x(2)]; dt = 0.01; T = 50;
plot(x_eq(:,1),
N = floor(T/dt); x_eq(:,2),'ko','MarkerFaceColor','k','MarkerSize',8); %
% --- Step 1: Equilibria --- equilibria
x = zeros(2,N);
% Solve f(x) = 0 xlabel('Prey Population (x)');

x_eq = [0 0; gamma/delta, alpha/beta]; % Initial condition (not at equilibrium) ylabel('Predator Population (y)');

disp('Equilibria (x*, y*):'); x(:,1) = [2; 1]; title('Phase Plane: Lotka–Volterra Predator–Prey');

disp(x_eq); legend('Vector Field','Trajectory','Equilibria');


for n = 1:N-1
grid on; axis tight;
k1 = f(x(:,n));
% --- Step 2: Jacobian at equilibria ---
Stability and Lyapunov Analysis

Linearization at an Equilibrium Point of a System of
Differential Equations

Lorenz System

Solution of Lorenz System

Solution of Lorenz System

Solution of Lorenz System

Nonlinear Dynamics and Chaos (Lorenz System)
%% Lorenz System Simulation x(1)*(rho - x(3)) - x(2); xlabel('Time'); ylabel('Distance between trajectories');

clc; clear; close all; x(1)*x(2) - beta*x(3)]; title('Sensitive Dependence on Initial Conditions');

grid on;
% Parameters %% Numerical integration using ode45

sigma = 10; [~,X1] = ode45(lorenz, t, x0_1);


%% 2D Phase Portraits
rho = 28; [~,X2] = ode45(lorenz, t, x0_2);
figure('Name','2D Phase Portraits','NumberTitle','off');
beta = 8/3;
%% Plot 3D phase portrait (butterfly attractor) subplot(1,2,1);

% Time settings figure('Name','Lorenz Butterfly plot(X1(:,1), X1(:,2), 'b'); hold on;


Attractor','NumberTitle','off');
tspan = [0 50]; plot(X2(:,1), X2(:,2), 'r'); xlabel('x'); ylabel('y');
plot3(X1(:,1), X1(:,2), X1(:,3), 'b', 'LineWidth', 1.5);
dt = 0.01; hold on; title('x-y Phase Portrait'); grid on;

t = tspan(1):dt:tspan(2); plot3(X2(:,1), X2(:,2), X2(:,3), 'r', 'LineWidth', 1.5);

xlabel('x'); ylabel('y'); zlabel('z'); subplot(1,2,2);

title('Lorenz System - Butterfly Attractor'); plot(X1(:,1), X1(:,3), 'b'); hold on;


% Initial conditions
legend('IC1','IC2 (perturbed)'); plot(X2(:,1), X2(:,3), 'r'); xlabel('x'); ylabel('z');
x0_1 = [1; 1; 1]; % First initial condition
grid on; view(45,30); title('x-z Phase Portrait'); grid on;
x0_2 = [1.001; 1; 1]; % Slightly perturbed initial
condition

%% Plot divergence of nearby trajectories

%% Lorenz system as a function figure('Name','Sensitive Dependence','NumberTitle','off');

lorenz = @(t,x) [ sigma*(x(2)-x(1)); plot(t, sqrt(sum((X1 - X2).^2,2)), 'LineWidth', 1.5);


Stochastic Models

Exercise

Parameter Sensitivity and Uncertainty

Exercise

Model Validation and Analysis

Exercise

Exercise
1. How can you simulate the Lotka–Volterra predator-prey equations in MATLAB to plot
predator and prey populations over time?
2. How can you model a spring-mass-damper system in MATLAB with both linear and
nonlinear damping and compare their displacement and velocity responses?
3. How can you implement the Black–Scholes PDE in MATLAB to calculate and plot
European call and put option prices for varying strike prices and maturities?
4. How can you simulate traffic flow on a single-lane highway in MATLAB to study the
impact of vehicle density on congestion formation over time?

You might also like