Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce nthRoot #3494

Merged
merged 3 commits into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions chapters/operatorsandexpressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ \subsection{Numeric Functions and Conversion Functions}\label{numeric-functions-
{\lstinline!abs($v$)!} & Absolute value (event-free) & \Cref{modelica:abs} \\
{\lstinline!sign($v$)!} & Sign of argument (event-free) & \Cref{modelica:sign} \\
{\lstinline!sqrt($v$)!} & Square root & \Cref{modelica:sqrt} \\
{\lstinline!nthRoot($v$, $n$)!} & $n$th root & \Cref{modelica:nthRoot} \\
{\lstinline!Integer($e$)!} & Conversion from enumeration to {\lstinline!Integer!} & \Cref{modelica:integer-of-enumeration} \\
{\lstinline!EnumTypeName($i$)!} & Conversion from {\lstinline!Integer!} to enumeration & \Cref{modelica:enumeration-of-integer} \\
{\lstinline!String($\ldots$)!} & Conversion to {\lstinline!String!} & \Cref{modelica:to-String} \\
Expand Down Expand Up @@ -466,8 +467,19 @@ \subsection{Numeric Functions and Conversion Functions}\label{numeric-functions-
sqrt($v$)
\end{lstlisting}\end{synopsis}
\begin{semantics}
Square root of $v$ if $v \geq 0$, otherwise an error occurs.
Argument $v$ needs to be an \lstinline!Integer! or \lstinline!Real! expression.
Square root of $v$, equivalent to \lstinline!nthRoot(v, 2)!.
\end{semantics}
\end{functiondefinition}

\begin{functiondefinition}[nthRoot]
\begin{synopsis}\begin{lstlisting}
nthRoot($v$, $n$)
\end{lstlisting}\end{synopsis}
\begin{semantics}
$n$th root of $v$, where $v$ shall be a \lstinline!Real! expression, and $n > 0$ shall be an \lstinline!Integer! expression.
The result $y$ is a real root of the equation $y^{n} = v$.
If $n$ is even, $v$ must be non-negative and $y$ shall be the non-negative root.
(If $n$ is odd, there is no constraint on $v$ and $y$ will have the same sign as $v$.)
\end{semantics}
\end{functiondefinition}

Expand Down