% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\LinearOrdinaryDifferentialOperatorTwoXmpTitle}{LinearOrdinaryDifferentialOperator2}
\newcommand{\LinearOrdinaryDifferentialOperatorTwoXmpNumber}{9.51}
%
% =====================================================================
\begin{page}{LinearOrdinaryDifferentialOperatorTwoXmpPage}{9.51 LinearOrdinaryDifferentialOperator2}
% =====================================================================
\beginscroll

%
%
%
%
%



\spadtype{LinearOrdinaryDifferentialOperator2(A, M)} is the domain of linear
%-% \HDindex{operator!linear ordinary differential}{LinearOrdinaryDifferentialOperatorTwoXmpPage}{9.51}{LinearOrdinaryDifferentialOperator2}
ordinary differential operators with coefficients in the differential ring
\spad{A} and operating on \spad{M}, an \spad{A}-module.
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{LinearOrdinaryDifferentialOperator2}

\beginmenu
    \menudownlink{{9.51.1. Differential Operators with Constant Coefficients}}{ugxLinearOrdinaryDifferentialOperatorTwoConstPage}
    \menudownlink{{9.51.2. Differential Operators with Matrix Coefficients Operating on Vectors}}{ugxLinearOrdinaryDifferentialOperatorTwoMatrixPage}
\endmenu
\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugxLinearOrdinaryDifferentialOperatorTwoConstTitle}{Differential Operators with Constant Coefficients}
\newcommand{\ugxLinearOrdinaryDifferentialOperatorTwoConstNumber}{9.51.1.}
%
% =====================================================================
\begin{page}{ugxLinearOrdinaryDifferentialOperatorTwoConstPage}{9.51.1. Differential Operators with Constant Coefficients}
% =====================================================================
\beginscroll

This example shows differential operators with rational
number coefficients operating on univariate polynomials.

\xtc{
We begin by making type assignments so we can conveniently refer
to univariate polynomials in \spad{x} over the rationals.
}{
\spadpaste{Q  := Fraction Integer \bound{Q}}
}
\xtc{
}{
\spadpaste{PQ := UnivariatePolynomial('x, Q) \free{Q}\bound{PQ0}}
}
\xtc{
}{
\spadpaste{x: PQ := 'x \free{PQ0}\bound{x}}
}
\xtc{
Now we assign \spad{Dx} to be the differential operator
\spadfunFrom{D}{LinearOrdinaryDifferentialOperator2}
corresponding to \spad{d/dx}.
}{
\spadpaste{Dx: LODO2(Q, PQ) := D() \free{Q PQ0}\bound{Dx}}
}
\xtc{
New operators are created as polynomials in \spad{D()}.
}{
\spadpaste{a := Dx  + 1 \bound{a}\free{Dx}}
}
\xtc{
}{
\spadpaste{b := a + 1/2*Dx^2 - 1/2 \bound{b}\free{Dx}}
}
\xtc{
To apply the operator \spad{a} to the value \spad{p} the usual function
call syntax is used.
}{
\spadpaste{p := 4*x^2 + 2/3 \free{x}\bound{p}}
}
\xtc{
}{
\spadpaste{a p \free{a p}}
}
\xtc{
Operator multiplication is defined by the identity \spad{(a*b) p = a(b(p))}
}{
\spadpaste{(a * b) p = a b p \free{a b p}}
}
\xtc{
Exponentiation follows from multiplication.
}{
\spadpaste{c := (1/9)*b*(a + b)^2 \free{a b}\bound{c}}
}
\xtc{
Finally, note that operator expressions may be applied directly.
}{
\spadpaste{(a^2 - 3/4*b + c) (p + 1) \free{a b c p}}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugxLinearOrdinaryDifferentialOperatorTwoMatrixTitle}{Differential Operators with Matrix Coefficients Operating on Vectors}
\newcommand{\ugxLinearOrdinaryDifferentialOperatorTwoMatrixNumber}{9.51.2.}
%
% =====================================================================
\begin{page}{ugxLinearOrdinaryDifferentialOperatorTwoMatrixPage}{9.51.2. Differential Operators with Matrix Coefficients Operating on Vectors}
% =====================================================================
\beginscroll

This is another example of linear ordinary differential
operators with non-commutative multiplication.
Unlike the rational function case, the differential ring of
square matrices (of a given dimension) with univariate
polynomial entries does not form a field.
Thus the number of operations available is more limited.

\xtc{
In this section, the operators have three by three
matrix coefficients with polynomial entries.
}{
\spadpaste{PZ   := UnivariatePolynomial(x,Integer)\bound{PZ0}}
}
\xtc{
}{
\spadpaste{x:PZ := 'x \free{PZ0}\bound{PZ}}
}
\xtc{
}{
\spadpaste{Mat  := SquareMatrix(3,PZ)\free{PZ}\bound{Mat}}
}
\xtc{
The operators act on the vectors considered as a \spad{Mat}-module.
}{
\spadpaste{Vect := DPMM(3, PZ, Mat, PZ);\free{PZ,Mat}\bound{Vect}}
}
\xtc{
}{
\spadpaste{Modo := LODO2(Mat, Vect);\free{Mat Vect}\bound{Modo}}
}
\xtc{
The matrix \spad{m} is used as a coefficient and the vectors \spad{p}
and \spad{q} are operated upon.
}{
\spadpaste{m:Mat := matrix [[x^2,1,0],[1,x^4,0],[0,0,4*x^2]]\free{Mat}\bound{m}}
}
\xtc{
}{
\spadpaste{p:Vect := directProduct [3*x^2+1,2*x,7*x^3+2*x]\free{Vect}\bound{p}}
}
\xtc{
}{
\spadpaste{q: Vect := m * p\free{m p Vect}\bound{q}}
}
\xtc{
Now form a few operators.
}{
\spadpaste{Dx : Modo := D()\bound{Dx}\free{Modo}}
}
\xtc{
}{
\spadpaste{a : Modo := Dx  + m\bound{a}\free{m Dx}}
}
\xtc{
}{
\spadpaste{b : Modo := m*Dx  + 1\bound{b}\free{m Dx}}
}
\xtc{
}{
\spadpaste{c := a*b \bound{c}\free{a b}}
}
\xtc{
These operators can be applied to vector values.
}{
\spadpaste{a p \free{p a}}
}
\xtc{
}{
\spadpaste{b p \free{p b}}
}
\xtc{
}{
\spadpaste{(a + b + c) (p + q) \free{a b c p q}}
}
\endscroll
\autobuttons
\end{page}
%
