# MinVal

Computes the minimum value of a user specified function, which could be a MotionSolve expression or a user subroutine.

The minimum value of a signal $f\left(q\left(t\right)\right)$ satisfies the following condition: If T* is the point in time when is $f\left(q\left(t\right)\right)$ minimum, then $f\left(q\left(T*\right)\right)\ge f\left(q\left(t\right)\right)$ when t ≠T*. If the expression has no minimum value, the initial value will be returned as the minimum value.

A smooth approximation to the MIN function is implemented in MotionSolve, so that its sensitivities are analytically computed. The smooth approximation, known as the alpha soft approximation, is:(1)
The parameter $a<0$ is used to control the accuracy of the calculations.
Note: $\text{M}\text{i}\text{n}\left(\text{x}\right)=\underset{⍺\to \infty }{\mathrm{lim}}Minval\left(x\right)$ .

## Example

Assume that you want to put a lower limit on the velocity of a vehicle.

Here is a code snippet that shows how the response should be defined with MinVal:

>>> # Define the minimum of velocity
>>> minVel = MinVal(function = "VZ({},{})".format(p.cm.id,ref.id))