aboutsummaryrefslogtreecommitdiff
path: root/src/input/exprpoly.input.pamphlet
blob: 08016c71c2b30523ff18125399496e7af9a239d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input exprpoly.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1994.
@
<<*>>=
<<license>>
-- This file test coercing objects of type Expression to various
-- polynomial types and back.

)clear all

-- Start with a simple expression involving variables

a := sin(i)*x**2 - y*x*sin(j)

-- Coerce it to various multivariate polynomial types

a :: DMP([x,y], EXPR INT)
leadingCoefficient %

a :: HDMP([x,y], EXPR INT)
a :: MPOLY([x,y], EXPR INT)
a :: MPOLY([y,x], EXPR INT)

-- Coerce it back to type Expression

% :: EXPR INT
a - %

-- Coerce the expression to various univariate polynomial types

a :: UP(x, EXPR INT)
a :: UP(y, EXPR INT)
a :: UP(y, UP(x, EXPR INT))

-- Coerce it back to type Expression

% :: EXPR INT
a - %

-- We needn't have had such a complicated expression. The following is
-- really just a multivariate polynomial.

b : EXPR INT := (x - 2*y + 3*z)**3

b :: DMP([x,y,z], Integer)
b :: HDMP([y,x,z], Integer)
b - (% :: EXPR INT)
b :: MPOLY([z,y,x], Integer)

b :: UP(y, HDMP([x,z], Integer))
b - (% :: EXPR INT)
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}