The Programming Content Dictionary, provides a mechanism to exchange programs, functions and procedures between OpenMath (OM) complaint applications. All the principles of OpenMath communications apply. This Content Dictionary (CD) defines the most common programming constructs, and allows the encoding of most scientific computation programs. For those who prefer, a BNF grammar version of the programming CD is available.
We will use as an example, the computation of a Moving Parabolic approximation.
The input for this computation is a vector x of dimension
We will compute a parabolic approximation (polynomial approximation
of degree 2) for each consecutive set of m points ending at
That is, for each position i
x[i-j] ~ a0[i] + a1[i]*j + a2[i]*j^2
for j between 0 and m-1.
The following graph
shows an example of two such approximations from a set of
We will call this procedure MovingParabApprox and we will code it in OpenMath. A maple session is used to compute the crucial equations and to optimize this code. This function can be converted to C or to Maple.
To test this function we write a Main program. This is also written in OpenMath. This program can be converted to C or to Maple. The output of both programs is, fortunately, identical. The code for Maple can also be executed symbolically, this provides some level of program verification.