Up | Next | Prev | PrevTail | Tail |
The operator DF is used to represent partial differentiation with respect to one or more variables. It is used with the syntax:
The first argument is the expression to be differentiated. The remaining arguments specify the differentiation variables and the number of times they are applied.
The number NUM may be omitted if it is 1. For example,
df(y,x) | = ∂y∕∂x |
df(y,x,2) | = ∂2y∕∂x2 |
df(y,x1,2,x2,x3,2) | = ∂5y∕∂x12 ∂x2∂x32. |
The evaluation of df(y,x) proceeds as follows: first, the values of Y and X are found. Let us assume that X has no assigned value, so its value is X. Each term or other part of the value of Y that contains the variable X is differentiated by the standard rules. If Z is another variable, not X itself, then its derivative with respect to X is taken to be 0, unless Z has previously been declared to DEPEND on X, in which case the derivative is reported as the symbol df(z,x).
Consider df(u,x,y,z). If non of x,y,z are equal to u then the order of differentiation is commuted into a canonical form, unless the switch NOCOMMUTEDF is turned on (default is off). if at least one of x,y,z is equal to u then the order of differentiation is not commuted and the derivative is not simplified to zero, unless the switch COMMUTEDF is turned on. It is off by default.
If COMMUTEDF is off and the switch SIMPNONCOMDF is on then simplify as follows:
provided U depends only on the one variable X. This simplification removes the non-commutative aspect of the derivative.
If the switch EXPANDDF is turned on then REDUCE uses the chain rule to expand symbolic derivatives of indirectly dependent variables provided the result is unambiguous, i.e. provided there is no direct dependence. It is off by default. Thus, for example, given
whereas after
DF(F,X) does not expand at all (since the result would be ambiguous and the algorithm would loop).
Turning on the switch ALLOWDFINT allows "differentiation under the integral sign", i.e.
if this results in a simplification. If the switch DFINT is also turned on then this happens regardless of whether the result simplifies. Both switches are off by default.
The LET statement can be used to introduce rules for differentiation of user-defined operators. Its general form is
FOR ALL ⟨var1⟩,…,⟨varn⟩ |
LET DF(⟨operator⟩⟨varlist⟩,⟨vari⟩)=⟨expression⟩ |
where
⟨varlist⟩ ::= (⟨var1⟩,…,⟨varn⟩),
and ⟨var1⟩,…,⟨varn⟩ are the dummy variable arguments of ⟨operator⟩.
An analogous form applies to infix operators.
Examples:
(This is how the tan differentiation rule appears in the REDUCE source.)
Notice that all dummy arguments of the relevant operator must be declared arbitrary by the FOR ALL command, and that rules may be supplied for operators with any number of arguments. If no differentiation rule appears for an argument in an operator, the differentiation routines will return as result an expression in terms of DF. For example, if the rule for the differentiation with respect to the second argument of F is not supplied, the evaluation of df(f(x,z),z) would leave this expression unchanged. (No DEPEND declaration is needed here, since f(x,z) obviously “depends on” Z.)
Once such a rule has been defined for a given operator, any future differentiation rules for that operator must be defined with the same number of arguments for that operator, otherwise we get the error message
Up | Next | Prev | PrevTail | Front |