Particle Models

A particle model track is a mathematical model of a point mass. The step positions of the particle are determined by the parameters of the model rather than being marked with the mouse.

There are two types of models: analytic and dynamic. An analytic model defines position functions of time, while a dynamic model defines force functions and initial conditions for numerical ODE solvers.

A particle model has a settable mass and generates motion data and vectors just like any other point mass. See Point Mass for additional information.

1. Defining Model Parameters

A model inspector displays analytic and dynamic particle model parameters in tables as shown below. To display the inspector, choose Model... from the model's track menu.

1. The Parameters table shows parameters supplied by Tracker or defined by the user. A parameter value may be a numerical constant or a function of other parameters.
2. The Initial Values table identifies the model variables and allows the user to set their initial values. Initial values may be numerical constants or functions of parameters.
3. The Functions table identifies the functions that determine the model behavior. The user defines these by entering valid mathematical expressions containing parameters and model variables.

Analytic and Dynamic Models of a Freely Falling Projectile with Horizontal Initial Velocity and No Air Resistance

When a particle model is first created, there are no user-defined parameters (m is defined by Tracker) and all model values are zero. To define a new parameter, click the New Parameter button. To edit a value, click a table cell.

Empty Analytic Particle Model

An analytic model of a simple projectile demonstrates how parameters can be defined as functions of other parameters (initial values can also be functions of parameters). In the example shown below, defining vx and vy to be functions of v and theta enables the user to vary the speed and launch angle independently.

Projectile Analytic Particle Model

2. Functions and the OSP Parser

Function expressions are interpreted and evaluated using a parser which recognizes parameter and variable names, standard operators ( + - * / ^ ), parentheses, and the one- and two-parameter math functions shown in the table below.

abs(a) | acos(a) | acosh(a) | asin(a) | asinh(a)
atan(a) | atanh(a) | ceil(a) | cos(a) | cosh(a)
exp(a) | floor(a) | frac(a) | int(a) | ln(a)
log(a) | random(a) | round(a) | sign(a) | sin(a)
sinh(a) | sqr(a) | sqrt(a) | step(a) | tan(a)
tanh(a) | atan2(a, b) | max(a, b) | min(a, b) | mod(a, b)

Math Functions Recognized by the OSP Parser

The parser also recognizes "if" functions that use the following form: if (conditional statement, expression1, expression2). The expression1 is evaluated if conditional statement is true and expression2 is evaluated if conditional expression is false. For example, the result of the statement if(x < 0, -x, x) is -x if x is less than zero and x if x is greater than zero (i.e., absolute value of x). Another valid expression example is sin(if(x > 0, 2*x, 3*x)). "If" functions can be nested.

The table below shows the boolean operators that can be used in conditional statements.

< | less than
> | greater than
= | equal
<= | less than or equal
>= | greater than or equal
<> | not equal
& | logical and
| | logical or
! | logical inversion

Boolean Operators Recognized by the OSP Parser

If a function expression cannot be parsed, the background is colored to indicate a fault condition. In the example below, the expression "-mg" is incorrect because products must employ the * operator.

3. Numerical ODE Solvers

The dynamic model uses a numerical ODE solver that can use any of several algorithms including the Euler, Verlet, and fourth-order Runge-Kutta methods. The default solver is a very accurate and stable adaptive multistep method. For more information, see the Open Source Physics web site.

To select a solver, choose from the drop-down list near the bottom of the inspector.

4. Undo and Redo

The Undo and Redo buttons on the inspector make it easy to visually compare models with different parameters. There is no limit to the number of parameter sets in the undo chain.