## 'smooth()'smooth() |

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Indicate smoothness of expression

smooth(p, expr)

If p>=0 **smooth**(p, expr) returns expr and states
that expr is p times continuously differentiable, i.e.: expr
is continuous in all real variables appearing in the expression
and all partial derivatives with respect to all appearing real
variables **exist** and are continuous up to order p.

The only allowed types for expr in smooth are: real expressions, arrays of allowed expressions, and records containing only components of allowed expressions.

The noEvent operator implies that real elementary expressions are taken
literally instead of generating crossing functions. The smooth operator
should be used instead of noEvent, in order to avoid events for efficiency
reasons. A tool is free to not generate events for expressions inside smooth.
However, smooth does not guarantee that no events will be generated, and thus
it can be necessary to use noEvent inside smooth. *[Note that smooth does
not guarantee a smooth output if any of the occurring variables change
discontinuously.]*

Real x, y, z;equationx =iftime<1then2elsetime-2; z = smooth(0,iftime<0then0elsetime); y = smooth(1, noEvent(ifx<0then0elsesqrt(x)*x)); // noEvent is necessary.