% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\LinearOrdinaryDifferentialOperatorOneXmpTitle}{LinearOrdinaryDifferentialOperator1}
\newcommand{\LinearOrdinaryDifferentialOperatorOneXmpNumber}{9.50}
%
% =====================================================================
\begin{page}{LinearOrdinaryDifferentialOperatorOneXmpPage}{9.50 LinearOrdinaryDifferentialOperator1}
% =====================================================================
\beginscroll

%
%
%
%
%



\spadtype{LinearOrdinaryDifferentialOperator1(A)} is the domain of linear
%-% \HDindex{operator!linear ordinary differential}{LinearOrdinaryDifferentialOperatorOneXmpPage}{9.50}{LinearOrdinaryDifferentialOperator1}
ordinary differential operators with coefficients in the differential ring
\spad{A}.
%This includes the cases of operators which are polynomials in \spad{D}
%acting upon scalar or vector expressions of a single variable.
%The coefficients of the operator polynomials can be integers, rational
%functions, matrices or elements of other domains.
\showBlurb{LinearOrdinaryDifferentialOperator1}

\beginmenu
    \menudownlink{{9.50.1. Differential Operators with Rational Function Coefficients}}{ugxLinearOrdinaryDifferentialOperatorOneRatPage}
\endmenu
\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugxLinearOrdinaryDifferentialOperatorOneRatTitle}{Differential Operators with Rational Function Coefficients}
\newcommand{\ugxLinearOrdinaryDifferentialOperatorOneRatNumber}{9.50.1.}
%
% =====================================================================
\begin{page}{ugxLinearOrdinaryDifferentialOperatorOneRatPage}{9.50.1. Differential Operators with Rational Function Coefficients}
% =====================================================================
\beginscroll

This example shows differential operators with rational function
coefficients.  In this case operator multiplication is non-commutative and,
since the coefficients form a field, an operator division algorithm exists.

\xtc{
We begin by defining \spad{RFZ} to be the rational functions in
\spad{x} with integer coefficients and \spad{Dx} to be the differential
operator for \spad{d/dx}.
}{
\spadpaste{RFZ := Fraction UnivariatePolynomial('x, Integer) \bound{RFZ0}}
}
\xtc{
}{
\spadpaste{x : RFZ := 'x \free{RFZ0}\bound{RFZ}}
}
\xtc{
}{
\spadpaste{Dx : LODO1 RFZ := D()\bound{Dx}\free{RFZ}}
}
\xtc{
Operators are created using the usual arithmetic operations.
}{
\spadpaste{b : LODO1 RFZ := 3*x^2*Dx^2 + 2*Dx + 1/x  \free{Dx}\bound{b}}
}
\xtc{
}{
\spadpaste{a : LODO1 RFZ := b*(5*x*Dx + 7)             \free{b Dx}\bound{a}}
}
\xtc{
Operator multiplication corresponds to functional composition.
}{
\spadpaste{p := x^2 + 1/x^2 \bound{p}\free{RFZ}}
}
\xtc{
Since operator coefficients depend on \spad{x}, the multiplication is
not commutative.
}{
\spadpaste{(a*b - b*a) p \free{a b p}}
}

When the coefficients of operator polynomials come from a field, as in this
case, it is possible to define operator division.
Division on the left and division on the right yield different results when
the multiplication is non-commutative.

The results of \spadfunFrom{leftDivide}{LinearOrdinaryDifferentialOperator1} and
\spadfunFrom{rightDivide}{LinearOrdinaryDifferentialOperator1} are
quotient-remainder pairs satisfying: \newline
%
\spad{leftDivide(a,b) = [q, r]} such that  \spad{a = b*q + r} \newline
\spad{rightDivide(a,b) = [q, r]} such that  \spad{a = q*b + r} \newline
%
\xtc{
In both cases, the \spadfunFrom{degree}{LinearOrdinaryDifferentialOperator1}
of the remainder, \spad{r}, is less than
the degree of \spad{b}.
}{
\spadpaste{ld := leftDivide(a,b) \bound{ld}\free{a b}}
}
\xtc{
}{
\spadpaste{a = b * ld.quotient + ld.remainder \free{a b ld}}
}
\xtc{
The operations of left and right division
are so-called because the quotient is obtained by dividing
\spad{a} on that side by \spad{b}.
}{
\spadpaste{rd := rightDivide(a,b) \bound{rd}\free{a b}}
}
\xtc{
}{
\spadpaste{a = rd.quotient * b + rd.remainder \free{a b rd}}
}

\xtc{
Operations \spadfunFrom{rightQuotient}{LinearOrdinaryDifferentialOperator1}
and \spadfunFrom{rightRemainder}{LinearOrdinaryDifferentialOperator1}
are available if only one of the quotient or remainder are of
interest to you.
This is the quotient from right division.
}{
\spadpaste{rightQuotient(a,b) \free{a b}}
}
\xtc{
This is the remainder from right division.
The corresponding ``left'' functions
\spadfunFrom{leftQuotient}{LinearOrdinaryDifferentialOperator1} and
\spadfunFrom{leftRemainder}{LinearOrdinaryDifferentialOperator1}
are also available.
}{
\spadpaste{rightRemainder(a,b) \free{a b}}
}

\xtc{
For exact division, the operations
\spadfunFrom{leftExactQuotient}{LinearOrdinaryDifferentialOperator1} and
\spadfunFrom{rightExactQuotient}{LinearOrdinaryDifferentialOperator1} are supplied.
These return the quotient but only if the remainder is zero.
The call \spad{rightExactQuotient(a,b)} would yield an error.
}{
\spadpaste{leftExactQuotient(a,b) \free{a b}}
}

\xtc{
The division operations allow the computation of left and right greatest
common divisors (\spadfunFrom{leftGcd}{LinearOrdinaryDifferentialOperator1} and
\spadfunFrom{rightGcd}{LinearOrdinaryDifferentialOperator1}) via remainder
sequences, and consequently the computation of left and right least common
multiples (\spadfunFrom{rightLcm}{LinearOrdinaryDifferentialOperator1} and
\spadfunFrom{leftLcm}{LinearOrdinaryDifferentialOperator1}).
}{
\spadpaste{e := leftGcd(a,b) \bound{e}\free{a b}}
}
\xtc{
Note that a greatest common divisor doesn't necessarily divide \spad{a} and
%-% \HDindex{greatest common divisor}{ugxLinearOrdinaryDifferentialOperatorOneRatPage}{9.50.1.}{Differential Operators with Rational Function Coefficients}
\spad{b} on both sides.
Here the left greatest common divisor does not divide \spad{a} on the right.
}{
\spadpaste{leftRemainder(a, e) \free{a e}}
}
\xtc{
}{
\spadpaste{rightRemainder(a, e) \free{a e}}
}

\xtc{
Similarly, a least common multiple
%-% \HDindex{least common multiple}{ugxLinearOrdinaryDifferentialOperatorOneRatPage}{9.50.1.}{Differential Operators with Rational Function Coefficients}
is not necessarily divisible from both sides.
}{
\spadpaste{f := rightLcm(a,b) \bound{f}\free{a b}}
}
\xtc{
}{
\spadpaste{rightRemainder(f, b) \free{f b}}
}
\xtc{
}{
\spadpaste{leftRemainder(f, b) \free{f b}}
}
\endscroll
\autobuttons
\end{page}
%
