Symbolic Differentiation of Multivariable Functions to Arbitrary Order
Abstract
Thermodynamic properties, like pressure, volume and temperature can be calculated as partial derivatives of energy functions. Obtaining analytic partial derivatives can be tedious work. Computer algebra systems can be used instead. Taking the gradient of a multi-variable scalar function yields a vector, taking the gradient again yields a matrix, if higher order derivatives are desired, they would have to be organized in higher-dimensional algebraic structures. Support for these kinds of objects is limited in existing computer algebra systems.The concept of a multidimensional algebraic object (MDO) is introduced: An MDO may have any number of dimensions. A scalar having zero dimensions, a vector one dimension and a matrix two dimensions. A lightweight computer algebra system has been implemented in Ruby. It enables the construction of mathematical expressions using MDOs as variables. These expressions can be both evaluated as functions and differentiated to return new MDO expressions.The MDO code has been used to produce a phase diagram for a natural gas system modelled by the Redlich Kwong equation of state. To solve the implicit phase equilibrium equations, Newton's method was used: The objective function and Jacobian were evaluated as analytic functions derived by the MDO software - no numerical differentiation took place. The software provides explicit analytic derivatives to arbitrary order. Evaluation of high order derivatives, however, is time-consuming.