Expression Syntax for Force & Torque: - simphysoftwares/SimPHY-docs GitHub Wiki

Each component of force can be set as a valid mathematical expression with following allowed operators and variables,

Operators: plus minus(+ -), product (*), division(/), power (^)

Variables: e, pi, instantaneous time (t), speed(v), velocity components (v_x, v_y), coordinates (x, y) of the body on which force is applied.

Functions: All trigonometric and inverse functions like sin, cos etc and algebraic functions such as sqrt, exp etc

Variables are automatically updated to their instantaneous values before applying force in every step.

Example:

Force given to block is sin(x)i+ej. The corresponding motion can be analyzed or predicted as below. Look at the variation of force with x.

Example input

Similarly, in order to simulate harmonic oscillation along the x axis with force constant k and damping coefficient b on the body, set force's x component as k*x-b *v_x and forces's y component as 0.

F= (k*x-b *v_x)i (also make sure either gravity is zero or object is placed on smooth platform)