Partial differentiation of algebraic expressions with respect to the current coordinates can be computed with the pdf() function. This function allows the user to attach an index (representing derivative indices) to an expression. Nothing is evaluated until the function call is involved in an indexed assignment, where the indices must obey the usual rules of indexed algebra, and are regarded as covariant tensor indices. For example,
#: pdf(sin(t)*r, [a,b]);
(sin(t) r)
|a b
The pdf() function has been superseded by the REDUCE
df() operator as described below.
The partial derivative of an expression can be obtained with the df() operator directly and using the coordinate vector created by coords() (the default name for this vector is x):
#: df (sin(t)*r, x[a],x[b]);
2
d sin(t) d sin(t) d r d sin(t) d r
------------- r + ---------- ------- + ---------- -------
a b a b b a
d x d x d x d x d x d x
2
d r
+ ------------- sin(t)
a b
d x d x
In this situation the contravariant index of x will be
regarded as covariant, so that the index structure of this expression
has two covariant indices. The indexed object used as the
indeterminate to the df() operator must be a coordinate vector,
otherwise an error message will appear (possibly several times, due to
the way in which the modifications to the REDUCE source code were
accomplished). See §7.3 for more information about the
appearance of the output of this expression.
If the index of the coordinate vector is fixed, the partial derivative will be immediately evaluated. If the expression does not depend on any of the coordinates, 0 will be returned. Such is not the case with the pdf() function, which will only imediately evaluate if the entire derivative index if fixed, and which does not check in advance for dependencies. The pdf() function may be removed from REDTEN in future versions.