detools::derList2Tree
--
minimal tree with a given list of derivatives as leavesdetools::derList2Tree
(derl)
takes a list
of derivatives (more precisely, their multi indices) and determines a
minimal tree of derivatives such that the given derivatives are the
leaves.
detools::derList2Tree(derl)
derl |
- | list of multi indices: a list of lists of nonnegative integer. |
a list structure representing the spanning tree. Each leaf is
represented by an integer denoting its position in the list
derl
. A node consists of a multi index saying by what
derivative the node can be reached and of a subtree with the same
structure.
detools::derList2Tree
is an auxiliary procedure that
is used, for example, by some methods in domains in
Cat::DifferentialFunction
. It is useful, if several
derivatives of the same function must be computed. The determined tree
describes a way to compute all required derivatives with a minimal
number of differentiations.Assume we are given a function F(x,y,z) and we need the following three derivatives of it: diff(F,x,y,y,z,z,z), diff(F,x,x,y,y,z,z,z,z), diff(F,x,y,z,z,z,z). What is the most efficient way to compute them?
>> detools::derList2Tree([[1, 2, 3], [2, 2, 4], [1, 1, 4]])
[[1, 1, 3], [[[0, 1, 0], 1], [[0, 0, 1], 3, [1, 1, 0], 2]]]
This result can be interpreted as follows. First compute G=diff(F,x,y,z,z,z). Then the first required derivative is given by diff(G,y), the third one by H=diff(G,z) and the second one by diff(H,x,y).