Provide your details below to request scholarly review comments.
×
Verified Request System ®
Order Article Reprints
Please fill in the form below to order high-quality article reprints.
×
Scholarly Reprints Division ®
− Abstract
Composite derivative calculations arise in many applications in computational science and engineering. Since 1857 the gold standard for computing composite derivatives is the celebrated formula of Faà Di Bruno. The equation is an identity for generalizing the chain rule of calculus to higher dimensions. It is very complicated. Each sub calculation must satisfy two integer constraint equations. An alternative problem formulation, proposed in 1861 by George Scott, is analytically very simple: nevertheless, the requirement for computing hand-generated complex derivatives while enforcing a boundary condition, has limited its application. Symbolic methods are also available, but computationally expensive to embed in application software. This paper combines the best features of symbolic processing and Scott’s formulation. The symbolic preprocessor computes (1) derivatives, and (2) enforces the derivative boundary condition appearing in Scott’s method. For n requested composite derivatives; the preprocessor generates a lower triangular nxn array that is embedded in the application software for computing the numerical composite derivatives. Unless the number of requested composite work derivatives increases, the preprocessor is only called one time. The symbolic preprocessor easily scales for handling ten’s to hundred’s of composite derivatives. A numerical example is provided, where 1..5 composite derivatives are computed.
− Explore Digital Article Text
# I. INTRODUCTION
Composite function calculations arise in all areas of scientific and engineering computing. Low-order applications present no technical problems for manually derived calculations. High-order applications, however, rapidly become cumbersome to manage the bookkeeping involved. Alternatively, symbolic tools are available, such as Maple, Mathematica, Octave (used herein) and others, for generating arbitrary order derivative calculations. Unfortunately, run-time penalties make it impractical to embed a algebraic symbolic program within an application program. Since 1857 the work of Faa Di Bruno [1],[2],[3] has served as the gold standard for computing composite derivatives. This work combines the power of symbolic computing with the simple elegance of George Scott's 1861 formulation [4]. For five requested composite derivative calculations, the symbolic software generates a $5 \times 5$ lower triangular array, that is embedded in the application software for computing numerical derivative values. A numerical example is provided to demonstrate the effectiveness of the proposed algorithm.
# 1.1 Faa Di Bruno Formulation
Since 1857 scalar composite function calculations have been theoretically handled by invoking the celebrated work of Faà Di Bruno [1],[2],[3]. His formula for computing the $n$th derivative of the function $u = F\big(G(x)\big)$ is given by
$$
\frac {d ^ {n}}{d x ^ {n}} F (G (x)) = \sum \frac {n !}{b_{1}! b_{2}! \dots b_{n}!} F ^ {(k)} (G (x)) \left(\frac {G ^ {\prime}}{1}\right) ^ {b _ {1}} \left(\frac {G ^ {\prime \prime}}{1·2}\right) ^ {b _ {2}} \left(\frac {G ^ {\prime \prime}}{1·2·3}\right) ^ {b _ {3}} \dots \left(\frac {G ^ {(n)}}{1·2 \dots n}\right) ^ {b _ {n}}
$$
where the summation process is subject to the following integer constraint conditions
$$
b _ {1} + b _ {2} + b _ {3} + \dots + b _ {n} = k
$$
$$
b _ {1} + 2 b _ {2} + 3 b _ {3} + \dots + n b _ {n} = n
$$
No additional derivative calculations are required. Not surprisingly the calculation represents a daunting bookkeeping challenge.
# 1.2 Scott's Composite Derivative Formulation
In 1861 George Scott [4] proposed the following alternative composite function derivative formulation
$$
\frac {d ^ {n}}{d x^{n}} F (G (x)) = \sum_ {k = 1} ^ {n} \frac {F ^ {(k)} (G (x))}{k !} \left\{\frac {d ^ {n}}{d x^{n}} G ^ {k} (x) \right\} \Bigg | _ {G = 0} \tag {1}
$$
which is analytically much simpler than Faà Di Bruno's identity. Unfortunately, the requirement for generating hand-derived derivatives for $\left.\frac{d^n}{dx^n} G^k(x)\right|_{G=0}$ , where $n$ denotes the $n$th derivative and $k$ denotes derivative summation index, has limited its broader application in the computational research community.
# II. NUMERIC-SYMBOLIC COMPOSITE DERIVATIVE FORMULATION
This paper presents a composite derivative algorithm that combines: (1) the simplicity of Scott's formulation [4], and, (2) the power of algebraic symbolic manipulation. Only two function routines are required (see Figure 1 and Appendix A). Symbolic function derivatives are computed for a generic $G(x)$ function. The use of a generic function (see Figure 1), eliminates the need for embedding a symbolic program in the application software. The algorithm consists of two parts. First, a symbolic preprocessor (see Figure 1) computes the derivatives for $\left.\frac{d^n}{dx^n} G^k(x)\right|_{G=0}$ and enforces a $G = 0$ boundary condition on each derivative. The derivative calculations become very complicated as the requested number of composite derivatives increase. Nevertheless, after the boundary condition $G = 0$ is enforced, the elements of the output derivative array are very simple. The symbolically generated derivative array consists of a lower triangular $n \times n$ array; which is copied into the application software for numerical derivative calculations. The elements of the array consist of components of the vector array $\{V_1, V_2, \ldots, V_n\}$ , where $V_i$ denotes $\frac{d^i}{dx^i} G$ . The array is only recomputed if the number of requested derivative increases.
Second, the application program embeds the computational function routine appearing in Figure 1, for numerically computing the composite derivatives. An elegantly simple double summation algorithm generates the numerical results for the composite derivatives.
For $nd = five$ requested composite derivatives, the symbolic preprocessor, presented in Appendix A, generates the following $dGdx$ lower triangular $nd \times nd$ array:
$$
dGdx = \left[ \begin{array}{c c c c} V _ {1} & & & \\ V _ {2} & 2 V _ {1} ^ {2} & & \\ V _ {3} & 6 V _ {1} V _ {2} & 6 V _ {1} ^ {3} & \\ V _ {4} & 8 V _ {1} V _ {3} + 6 V _ {2} ^ {2} & 36 V _ {1} ^ {2} V _ {2} & 24 V _ {1} ^ {4} \\ V _ {5} & 10 V _ {1} V _ {4} + 20 V _ {2} V _ {3} & 60 V _ {1} ^ {2} V _ {3} + 90 V _ {1} V _ {2} ^ {2} & 240 V _ {1} ^ {3} V _ {2} & 120 V _ {1} ^ {5} \end{array} \right] \tag{2}
$$
where $\left. V_i = \frac{d^i G}{dx^i} \right|_{G=0}$ . The $dGdx$ array of Eq. 2 enables 1 through 5 composite derivatives to be evaluated. Elements of the array are nonlinear, for example, the element $dGdx(4,2) = 8V_1V_3 + 6V_2^2$ . During the preprocessing operations, the following change of variables eliminates potential problems with processing the nonlinear terms:
$$
\left\{G ^ {\prime} \quad G ^ {n} \quad G ^ {m} \quad G ^ {(4)} \quad G ^ {(5)} \right\} = \left\{V _ {1} \quad V _ {2} \quad V _ {3} \quad V _ {4} \quad V _ {5} \right\}
$$
The change of variables substitution starts with the highest order derivative and continues until the lowest order derivative variable has been replaced (see Appendix A).
An additional benefit of this approach is that for applications only requiring three composite derivatives, one only uses the sub portion of the array dGdx(1:3,1:3) for all numerical derivative calculations.
# III. COMPOSITE DERIVATIVE CALCULATIONS
Taking the symbolically generated $dGdx$ array of Eq. 2 as input for the application software; composite derivatives are computed with following function routine:
Function Composite $=$ Derivative(nd,x,DF,DG,Rfac)
%% This function computes composite derivatives for nd derivatives.
%% The Maximum number of derivatives is five(5), otherwise the %% symbolic preprocessor is recomputed to generate a new $dGdx$ array.
%% INPUT:
%% nd number of composite derivatives requested
%% x evaluation point for the composite derivative
$$
\begin{array}{l}\left. \right.\left.\left.\left.\left.\left. DF = \left\{F ^ {\prime} F ^ {\prime \prime} F ^ {\prime \prime \prime} F ^ {(4)} F ^ {(5)} \right\}\right|_{G = x} \right.\right.\right.\right.\end{array}
$$
$$
\left. \begin{array}{l} \end{array} \right. \quad DG = \left\{G ^ {\prime} \quad G ^ {\prime \prime} \quad G ^ {\prime \prime \prime} \quad G ^ {(4)} \quad G ^ {(5)} \right\} \Big | _ {G (x)}
$$
where $x$ denotes the evaluation point for the derivatives
%% DF, DG are user supplied nd x 1 arrays of derivatives numerically
%% evaluated at the application points
%% $Rfac =$ reciprocal factorial array nd x 1
%% OUTPUT:
%% Composite denotes the nd x 1 array of requested composite derivatives
%%
%% Copyright(2025) James D. Turner, All Rights Reserved
%%
$$
V _ {1} = DG (1); V _ {2} = DG (2); V _ {3} = DG (3); V _ {4} = DG (4); V _ {5} = DG (5);
$$
%% Introduce Current $\mathrm{G(x)}$ Derivative values in the following $dGdx$ array
%% dGdx is copied from the symbolic preprocessor of Appendix A
$dGdx(1, 1) = V_1, dGdx(2, 1) = V_2, dGdx(3, 1) = V_3, dGdx(4, 1) = V_4, dGdx(5, 1) = V_5$
$dGdx\left(2,2\right) = 2V_{1}^{2}$
$dGdx\left(3,2\right) = 6V_{1}V_{2}$
$dGdx\left(4,2\right) = 8V_{1}V_{3} + 6V_{2}^{2}$
$dGdx\left(5,2\right) = 10V_{1}V_{4} + 20V_{2}V_{3}$
$dGdx\left(3,3\right) = 6V_{1}^{3}$
$dGdx(4,3) = 36V_1^2 V_2$
$dGdx\left(5,3\right) = 60V_{1}^{2}V_{3} + 90V_{1}V_{2}^{2}$
$dGdx(4, 4) = 24V_{1}^{4}$
$dGdx(5,4) = 240V_1^3 V_2$
$dGdx\left(5, 5\right) = 120V_{1}^{5}$
%% Begin Main Derivative Summation Loop
for $n = 1$ :nd %% Number of requested composite derivatives
[ \mathrm{s} = 0; \quad \% \text{initialize each derivative summation} ]
for $k = 1:n$ Number of summation terms for each derivative
s = s + DF(k)*dGdx(n,k)*Rfac(k);
endfor %% Sum current Derivative Series Expansion
Composite(n) = s; %% Save nth value of the composite derivative
endfor %% double summation algorithm
endfunction
Figure 1: Numerical Composite Derivative Function Routine
This double summation algorithm is extremely simple when compared with Faà di Bruno's formulation [1],[2],[3].
# IV. NUMERICAL APPLICATION
This Section presents a numerical composite derivative example, where $f^{(5)}$ composite derivatives are requested. The assumed composite derivative function is given by:
$$
\frac {d ^ {n}}{d x ^ {n}} F (G (x)) = \left. \tan (\cosh (x)) \right| _ {x = 0.5} \tag {3}
$$
There are two numerical evaluation points for the function appearing in Eq. (3). Namely,
Evalpt = 0.5 for G(Evalpt), and $\mathrm{FEvalpt} = \cosh (\mathrm{Evalpt})$
The user is assumed to have provided numerical values for the following analytic derivative arrays for $F$ and $G$ :
$$
D F = \left\{F ^ {\prime} \quad F ^ {\prime \prime} \quad F ^ {\prime \prime \prime} \quad F ^ {(4)} \quad F ^ {(5)} \right\} \Big | _ {\cosh (x)} \tag {4}
$$
$$
D G = \left\{G ^ {\prime} \quad G ^ {\prime \prime} \quad G ^ {\prime \prime \prime} \quad G ^ {(4)} \quad G ^ {(5)} \right\} | _ {x} \tag {5}
$$
These numerical arrays are processed in the double summation algorithm presented in Figure 1. Assuming that the evaluation point for the composite derivative is $x = 0.5$ , the above derivative arrays have the following truncated numerical values
$$
D F = \left[ \begin{array}{l l l l l} 3.5495e+00 & 1.1335e+01 & 6.1395e+01 & 4.3746e+02 & 3.9112e+03 \end{array} \right]
$$
DG = \left[ \begin{array}{lllll} 1.5e-01 & 1.01e+00 & 1.5e-01 & 1.01e+00 & 1.5e-01 \end{array} \right]
Using the double summation algorithm presented in Figure 1, the five requested composite derivatives are given by:
# V. CONCLUSION
This work links (1) the power of symbolic processing for computing derivative values for $\frac{d^n}{dx^n} G^k(x)\bigg|_{G=0}$ and the simplicity of Scott's algorithm presented in Eq. (1). Numerical composite derivative calculations are performed using the elegantly simple double summation algorithm presented in Figure 1. Up to five composite derivatives are handled by the algorithm. If more composite derivatives are required; the symbolic preprocessor of Appendix A is recomputed to generate an updated derivative array for $dGdx$ . The symbolic preprocessor performs derivative calculations and enforces a boundary condition on each derivative. The output of the symbolic preprocessor consists of a lower triangular $5\times 5$ matrix. The elements $dGdx$ functionally depend on the nonlinear derivatives of generic function $G(x)$ . The derivative array $dGdx$ is embedded in function routine presented in Figure 1 for computing the numerical composite derivatives. Assuming that the upper limit for the requested number of composite derivatives does not change; the preprocessor is only executed one time. The algorithm scales for tens to hundreds of composite derivatives. A numerical example is presented that demonstrates the effectiveness of the proposed methodology.
# APPENDIX A
Symbolic Constrained Derivative Preprocessor
```latex
$\frac{d^n}{dx^n} G^k (x)$
```
$dx = \int_{G = 0}^{x} dx$ The use of a generic function $G(x)$ eliminates the need for embedding a symbolic manipulation tool in the application software. The generation of symbolic derivatives is straightforward. Enforcing the $G = 0$ boundary condition of the derivative expressions requires an indirect approach to avoid a potential loss of nonlinear terms. This is handled by introducing a change of variables to eliminate the explicit derivative expressions in the symbolic derivative results. The calculation is started by eliminating the highest derivatives first. The calculation generates a lower triangular array $dGdx$ , that is inserted in the application software as the function routine appearing in Figure 1. This array is computed only one time, and is only recomputed if the number of requested composite derivative increases.
function $dgk =$ Sym_dGdk_preprocessor ( nd )
%% Symbolic PreProcessor for composite derivatives
$\% \%$ Math Model: $\mathrm{phi} = \mathrm{f(g(x))}$ , $\mathrm{x} =$ evaluation point
%% INPUT: nd number of implicit derivatives required on output
$\% \%$ INPUT: nd Number of implicit derivatives required
%% OUTPUT: dgk nxn lower triangular array of derivatives @ G = 0
$\% \%$ Copyright (2025) James D. Turner All rights reserved
syms G(x); $\% \%$ Declare variables to be symbolic
syms k;
$\%$ Create change of variables array to eliminate analytic derivs:
symbols = sym( zeros(1, nd)); % Preallocate symbolic array
for $\mathrm{i} = 1:\mathrm{nd}$
symbols(i) $=$ sym(sprintf('v%d',i));
% Create symbols = {v1, v2, ..., vn}
end $\% \% = >$ (G' = V1, G'' = V2, ..., G(n) = Vn)
old $=$ sym (zeros(nd,1));
new = sym( zeros(nd, 1)); %% allocate memory for derivative transformations
for $\mathrm{i} = 1:\mathrm{nd}$
old(i,1) = diff(G(x), x, i); %% Load G derivatives
new(i,1) = symbols(i); %% Load {v1, v2, ..., vn}
endfor $\% \%$ Store derivative transformation equations
oldr = old(end:-1:1);
newr = new( end:-1:1 ); %% Reverse order of derivative & V arrays
$\mathrm{dgk} = \mathrm{sym}(\text{zeros(nd, nd)})$ ; $\% \%$ allocate array for enforcing G = o BC
%%= = = = = = = = = = = = = = = = = = =
%% Symbolic Preprocessor Loop
%%=--------
for $\mathrm{n} = 1 : \mathrm{{nd}}$
for $\mathrm{k} = 1 : \mathrm{n}$ %% summation terms for each derivative
```latex
$\mathrm{deriv} = \mathrm{diff}(\mathrm{G}(\mathrm{x})^{\wedge}\mathrm{k},\mathrm{x},\mathrm{n});$ $\% \%$ compute nth derivative (vary complicated) ans $=$ expand( deriv); $\% \%$ ans $= \{\mathrm{G}^{\wedge}(\mathrm{n})^{*}\mathrm{fo} + \mathrm{G}^{\wedge}(\mathrm{n - 1})^{*}\mathrm{f1} + \ldots +\mathrm{fn}\}$ ans $=$ subs( ans, oldr, newr); $\% \%$ change of variables for higher derivatives G_BC $=$ subs( ans, G(x), o); $\% \%$ enforce G = o Boundary Condition dgk(n, k) $= [\mathrm{G\_BC}]$ . $\% \%$ save nk th element of constrained derivative array endfor
endfor
endfunction
```
Generating HTML Viewer...
− Conflict of Interest
The authors declare no conflict of interest.
− Ethical Approval
Not applicable
− Data Availability
The datasets used in this study are openly available at [repository link] and the source code is available on GitHub at [GitHub link].