% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\OrderlyDifferentialPolynomialXmpTitle}{OrderlyDifferentialPolynomial}
\newcommand{\OrderlyDifferentialPolynomialXmpNumber}{9.64}
%
% =====================================================================
\begin{page}{OrderlyDifferentialPolynomialXmpPage}{9.64 OrderlyDifferentialPolynomial}
% =====================================================================
\beginscroll

%
%
%
%
%



Many systems of differential equations may be transformed to equivalent
%-% \HDindex{differential equation}{OrderlyDifferentialPolynomialXmpPage}{9.64}{OrderlyDifferentialPolynomial}
systems of ordinary differential equations where the equations are
%-% \HDindex{equation!differential}{OrderlyDifferentialPolynomialXmpPage}{9.64}{OrderlyDifferentialPolynomial}
expressed polynomially in terms of the unknown functions.
%-% \HDindex{polynomial!differential polynomial}{OrderlyDifferentialPolynomialXmpPage}{9.64}{OrderlyDifferentialPolynomial}
In \Language{}, the domain constructors
\spadtype{OrderlyDifferentialPolynomial}
%-% \HDindex{differential polynomial}{OrderlyDifferentialPolynomialXmpPage}{9.64}{OrderlyDifferentialPolynomial}
(abbreviated \spadtype{ODPOL}) and
\spadtype{SequentialDifferentialPolynomial} (abbreviation
\spadtype{SDPOL}) implement two domains of ordinary differential
polynomials over any differential ring.
In the simplest case, this differential ring is usually either the ring of
integers, or the field of rational numbers.
However, \Language{} can handle ordinary differential polynomials over a
field of rational functions in a single indeterminate.
%-% \HDexptypeindex{OrderlyDifferentialPolynomial}{OrderlyDifferentialPolynomialXmpPage}{9.64}{OrderlyDifferentialPolynomial}
%-% \HDexptypeindex{SequentialDifferentialPolynomial}{OrderlyDifferentialPolynomialXmpPage}{9.64}{OrderlyDifferentialPolynomial}

The two domains \spadtype{ODPOL} and \spadtype{SDPOL} are almost
identical, the only difference being the choice of a different ranking,
which is an ordering of the derivatives of the indeterminates.
The first domain uses an orderly ranking, that is, derivatives of higher
order are ranked higher, and derivatives of the same order are ranked
alphabetically.
The second domain uses a sequential ranking, where derivatives are ordered
first alphabetically by the differential indeterminates, and then by
order.
A more general domain constructor,
\spadtype{DifferentialSparseMultivariatePolynomial} (abbreviation
\spadtype{DSMP}) allows both a user-provided list of differential
indeterminates as well as a user-defined ranking.
We shall illustrate \spadtype{ODPOL(FRAC INT)}, which constructs a domain
of ordinary differential polynomials in an arbitrary number of
differential indeterminates with rational numbers as coefficients.
\xtc{
}{
\spadpaste{dpol:= ODPOL(FRAC INT) \bound{dpol}}
}

\xtc{
A differential indeterminate \spad{w} may be viewed as an infinite
sequence of algebraic indeterminates, which are the derivatives of
\spad{w}.
To facilitate referencing these, \Language{} provides the operation
\spadfunFrom{makeVariable}{OrderlyDifferentialPolynomial} to convert an
element of type \spadtype{Symbol} to a map from the natural numbers to the
differential polynomial ring.
}{
\spadpaste{w := makeVariable('w)\$dpol \free{dpol}\bound{w}}
}
\xtc{
}{
\spadpaste{z := makeVariable('z)\$dpol \free{dpol}\bound{z}}
}
\xtc{
The fifth derivative of \spad{w} can be obtained by applying the map
\spad{w} to the number \spad{5.}
Note that the order of differentiation is given as a subscript (except
when the order is 0).
}{
\spadpaste{w.5 \free{w}}
}
\xtc{
}{
\spadpaste{w 0 \free{w}}
}
\xtc{
The first five derivatives of \spad{z} can be generated by a list.
}{
\spadpaste{[z.i for i in 1..5] \free{z}}
}
\xtc{
The usual arithmetic can be used to form a differential polynomial from
the derivatives.
}{
\spadpaste{f:= w.4 - w.1 * w.1 * z.3 \free{w}\free{z}\bound{f}}
}
\xtc{
}{
\spadpaste{g:=(z.1)^3 * (z.2)^2 - w.2 \free{z}\free{w}\bound{g}}
}
\xtc{
The operation \spadfunFrom{D}{OrderlyDifferentialPolynomial}
computes the derivative of any differential polynomial.
}{
\spadpaste{D(f) \free{f}}
}
\xtc{
The same operation can compute higher derivatives, like the
fourth derivative.
}{
\spadpaste{D(f,4) \free{f}}
}
\xtc{
The operation \spadfunFrom{makeVariable}{OrderlyDifferentialPolynomial}
creates a map to facilitate referencing the derivatives of \spad{f},
similar to the map \spad{w}.
}{
\spadpaste{df:=makeVariable(f)\$dpol \free{f}\bound{df}}
}
\xtc{
The fourth derivative of f may be referenced easily.
}{
\spadpaste{df.4 \free{df}}
}
\xtc{
The operation \spadfunFrom{order}{OrderlyDifferentialPolynomial}
returns the order of a differential polynomial, or the order
in a specified differential indeterminate.
}{
\spadpaste{order(g)  \free{g}}
}
\xtc{
}{
\spadpaste{order(g, 'w)  \free{g}}
}
\xtc{
The operation
\spadfunFrom{differentialVariables}{OrderlyDifferentialPolynomial} returns
a list of differential indeterminates occurring in a differential
polynomial.
}{
\spadpaste{differentialVariables(g)  \free{g}}
}
\xtc{
The operation \spadfunFrom{degree}{OrderlyDifferentialPolynomial} returns
the degree, or the degree in the differential indeterminate specified.
}{
\spadpaste{degree(g) \free{g}}
}
\xtc{
}{
\spadpaste{degree(g, 'w)  \free{g}}
}
\xtc{
The operation \spadfunFrom{weights}{OrderlyDifferentialPolynomial} returns
a list of weights of differential monomials appearing in differential
polynomial, or a list of weights in a specified differential
indeterminate.
}{
\spadpaste{weights(g)  \free{g}}
}
\xtc{
}{
\spadpaste{weights(g,'w) \free{g}}
}
\xtc{
The operation \spadfunFrom{weight}{OrderlyDifferentialPolynomial} returns
the maximum weight of all differential monomials appearing in the
differential polynomial.
}{
\spadpaste{weight(g)  \free{g}}
}
\xtc{
A differential polynomial is {\em isobaric} if the weights of all
differential monomials appearing in it are equal.
}{
\spadpaste{isobaric?(g) \free{g}}
}
\xtc{
To substitute {\em differentially}, use
\spadfunFrom{eval}{OrderlyDifferentialPolynomial}.
Note that we must coerce \spad{'w} to \spadtype{Symbol}, since in
\spadtype{ODPOL}, differential indeterminates belong to the domain
\spadtype{Symbol}.
Compare this result to the next, which substitutes {\em algebraically} (no
substitution is done since \spad{w.0} does not appear in \spad{g}).
}{
\spadpaste{eval(g,['w::Symbol],[f]) \free{f}\free{g}}
}
\xtc{
}{
\spadpaste{eval(g,variables(w.0),[f]) \free{f}\free{g}}
}
\xtc{
Since \spadtype{OrderlyDifferentialPolynomial} belongs to
\spadtype{PolynomialCategory}, all the operations defined in the latter
category, or in packages for the latter category, are available.
}{
\spadpaste{monomials(g) \free{g}}
}
\xtc{
}{
\spadpaste{variables(g) \free{g}}
}
\xtc{
}{
\spadpaste{gcd(f,g) \free{f}\free{g}}
}
\xtc{
}{
\spadpaste{groebner([f,g]) \free{f}\free{g}}
}
\xtc{
The next three operations are essential for elimination procedures in
differential polynomial rings.
The operation \spadfunFrom{leader}{OrderlyDifferentialPolynomial} returns
the leader of a differential polynomial, which is the highest ranked
derivative of the differential indeterminates that occurs.
}{
\spadpaste{lg:=leader(g)  \free{g}\bound{lg}}
}
\xtc{
The operation \spadfunFrom{separant}{OrderlyDifferentialPolynomial} returns
the separant of a differential polynomial, which is the partial derivative
with respect to the leader.
}{
\spadpaste{sg:=separant(g)  \free{g}\bound{sg}}
}
\xtc{
The operation \spadfunFrom{initial}{OrderlyDifferentialPolynomial} returns
the initial, which is the leading coefficient when the given differential
polynomial is expressed as a polynomial in the leader.
}{
\spadpaste{ig:=initial(g)  \free{g}\bound{ig}}
}
\xtc{
Using these three operations, it is possible to reduce \spad{f} modulo the
differential ideal generated by \spad{g}.
The general scheme is to first reduce the order, then reduce the degree in
the leader.
First, eliminate \spad{z.3} using the derivative of \spad{g}.
}{
\spadpaste{g1 := D g \free{g}\bound{g1}}
}
\xtc{
Find its leader.
}{
\spadpaste{lg1:= leader g1 \free{g1}\bound{lg1}}
}
\xtc{
Differentiate \spad{f} partially with respect to this leader.
}{
\spadpaste{pdf:=D(f, lg1) \free{f}\free{lg1}\bound{pdf}}
}
\xtc{
Compute the partial remainder of \spad{f} with respect to \spad{g}.
}{
\spadpaste{prf:=sg * f- pdf * g1 \free{f}\free{sg}\free{pdf}\free{g1}\bound{prf}}
}
\xtc{
Note that high powers of \spad{lg} still appear in \spad{prf}.
Compute the leading coefficient of \spad{prf}
as a polynomial in the leader of \spad{g}.
}{
\spadpaste{lcf:=leadingCoefficient univariate(prf, lg) \free{prf}\free{lg}\bound{lcf}}
}
\xtc{
Finally, continue eliminating the high powers of \spad{lg} appearing in
\spad{prf} to obtain the (pseudo) remainder of \spad{f} modulo \spad{g}
and its derivatives.
}{
\spadpaste{ig * prf - lcf * g * lg \free{ig}\free{prf}\free{lcf}\free{g}\free{lg}}
}
\showBlurb{OrderlyDifferentialPolyomial}
\showBlurb{SequentialDifferentialPolynomial}
\endscroll
\autobuttons
\end{page}
%
