# Dynamical system simulation

Dynamical system simulation or dynamic system simulation is the use of a computer program to model the time-varying behavior of a dynamical system. The systems are typically described by ordinary differential equations or partial differential equations. A simulation run solves the state-equation system to find the behavior of the state variables over a specified period of time. The equation is solved through numerical integration methods to produce the transient behavior of the state variables. Simulation of dynamic systems predicts the values of model-system state variables, as they are determined by the past state values. This relationship is found by creating a model of the system.

## Overview

Simulation models are commonly obtained from discrete-time approximations of continuous-time mathematical models. As mathematical models incorporate real-world constraints, like gear backlash and rebound from a hard stop, equations become nonlinear. This requires numerical methods to solve the equations.
A numerical simulation is done by stepping through a time interval and calculating the integral of the derivatives through numerical integration. Some methods use a fixed step through the interval, and others use an adaptive step that can shrink or grow automatically to maintain an acceptable error tolerance. Some methods can use different time steps in different parts of the simulation model.
There are two types of system models to be simulated: difference-equation models, and differential-equation models. Classical physics is usually based on differential equation models. This is why most old simulation programs are simply differential equation solvers and delegate solving difference-equations to “procedural program segments.”Some dynamic systems are modeled with differential equations that can only be presented in an implicit form. These differential-algebraic-equation systems require special mathematical methods for simulation.
Some complex systems’ behavior can be quite sensitive to initial conditions, which could lead to large errors from the correct values. To avoid these possible errors, a rigorous approach can be applied, where an algorithm is found which can compute the value up to any desired precision. For example, the constant e is a computable number because there is an algorithm that is able to produce the constant up to any given precision.

## Applications

The first applications of computer simulations for dynamic systems was in the aerospace industry. Commercial uses of dynamic simulation are many and range from nuclear power, steam turbines, 6 degrees of freedom vehicle modeling, electric motors, econometric models, biological systems, robot arms, mass-spring-damper systems, hydraulic systems, and drug dose migration through the human body to name a few. These models can often be run in real time to give a virtual response close to the actual system. This is useful in process control and mechatronic systems for tuning the automatic control systems before they are connected to the real system, or for human training before they control the real system.
Simulation is also used in computer games and animation and can be accelerated by using a physics engine, the technology used in many powerful computer graphics software programs, like 3ds Max, Maya, Lightwave, and many others to simulate physical characteristics. In computer animation, things like hair, cloth, liquid, fire, and particles can be easily modeled, while the human animator animates simpler objects. Computer-based dynamic animation was first used at a very simple level in the 1989 Pixar short film Knick Knack to move the fake snow in the snowglobe and pebbles in a fish tank.