The Order of Partial Differentiation¶
For a sufficiently smooth function, mixed partial derivatives commute. We illustrate Clairaut's theorem with
$$ f(x,y,z)=\frac{x^5y^3}{z}, $$
differentiating once with respect to each variable in several orders.
Define the function¶
The explicit type annotation makes the symbolic domain clear to the Egison kernel.
declare symbol x, y, z : MathValue
def f (x : MathValue) (y : MathValue) (z : MathValue) : MathValue :=
x^5 * y^3 / z
f x y z
A first mixed derivative¶
Differentiating in the order $x$, then $y$, then $z$ should give
$$ \partial_z\partial_y\partial_x f =-\frac{15x^4y^2}{z^2}. $$
∂/∂ (∂/∂ (∂/∂ (f x y z) x) y) z
Permuting the order¶
We repeat the calculation with $z,y,x$ and $y,z,x$. Equality of all three outputs is the computational form of Clairaut's theorem on the region $z\ne0$.
∂/∂ (∂/∂ (∂/∂ (f x y z) z) y) x
∂/∂ (∂/∂ (∂/∂ (f x y z) y) z) x
Every order produces the same rational expression. The example also shows that Egison keeps the variables of differentiation explicit instead of encoding the order in auxiliary function names.