Skip to content

Commit e794500

Browse files
Clarify (#3786)
* Clarify * Update chapters/functions.tex * As suggested, and remove double empty lines. Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
1 parent ae8359f commit e794500

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

chapters/functions.tex

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,16 +1483,21 @@ \subsection{Using the Derivative Annotation}\label{using-the-derivative-annotati
14831483

14841484
\subsection{Partial Derivatives of Functions}\label{partial-derivatives-of-functions}\index{partial derivative}\index{der@\robustinline{der}!partial derivative}
14851485

1486-
A class defined as:
1486+
A function class defined as follows is a partial derivative of another function:
14871487
\begin{lstlisting}[language=grammar]
14881488
IDENT "=" der "(" name "," IDENT { "," IDENT } ")" comment
14891489
\end{lstlisting}
1490-
is the partial derivative of a function, and may only be used as declarations of functions.
14911490

1492-
The semantics is that a function (and only a function) can be specified in this form, defining that it is the partial derivative of the function to the right of the equal sign (looked up in the same way as a short class definition, and the looked up name must be a function), and partially differentiated with respect to each {\lstinline!IDENT!} in order (starting from the first one).
1493-
Each {\lstinline!IDENT!} must be a scalar {\lstinline!Real!} input to the function.
1491+
In \lstinline!$f$ = der($g$, $u_{1}, \ldots$)!, the function being defined is named $f$, and the function being differentiated is $g$.
1492+
The name $g$ is looked up in the same way as a in short class definition, and the referenced class must be a function.
1493+
Each $u_{i}$ must be a scalar {\lstinline!Real!} input to the function, and corresponds mathematically to prepending $\frac{\partial}{\partial u_{i}}$ to the function call.
1494+
The $u_{i}$ are applied in increasing order of $i$ (although the partial derivatives commute for a broad class of functions).
14941495

1495-
The comment allows a user to comment the function (in the info-layer and as one-line description, and as icon).
1496+
\begin{nonnormative}
1497+
In mathematical notation, the order of partial differentiation is reversed compared to the function definition; \lstinline!der($g$, $x$, $y$)! means $\frac{\partial}{\partial y}\frac{\partial}{\partial x}g$.
1498+
\end{nonnormative}
1499+
1500+
The \lstinline[language=grammar]!comment! has the same semantics as in a short class definition, for instance allowing the function to be given a description string, as well as \lstinline!Documentation! and \lstinline!Icon! annotations.
14961501

14971502
\begin{example}
14981503
The specific enthalpy can be computed from a Gibbs-function as follows:
@@ -1511,9 +1516,9 @@ \subsection{Partial Derivatives of Functions}\label{partial-derivatives-of-funct
15111516
h := Gibbs(p, T) - T * Gibbs_T(p, T);
15121517
end specificEnthalpy;
15131518
\end{lstlisting}
1519+
Thus \lstinline!der(Gibbs, T)! corresponds to $\frac{\partial \text{\lstinline!Gibbs(p, T)!}}{\partial \text{\lstinline!T!}} = \frac{\partial}{\partial \text{\lstinline!T!}}\text{\lstinline!Gibbs!}$.
15141520
\end{example}
15151521

1516-
15171522
\subsection{Using the Inverse Annotation}\label{using-the-inverse-annotation}
15181523

15191524
If a function $f_1$ with one output formal parameter $y$ can be restricted to an informally defined domain and codomain, such that the mapping of the input formal parameter $u_{k}$ to $y$ is bijective for any fixed assignment to the other input formal parameters in the domain (see examples below), then it can be given an \fmtannotationindex{inverse} annotation to provide an explicit inverse $f_2$ to this mapping, provided that the function is only applied on this domain:

0 commit comments

Comments
 (0)