| 1 |
|
| 2 |
|
| 3 |
\section{Bergman under Reduce} \label{reduce} |
| 4 |
|
| 5 |
|
| 6 |
\subsection{Working in the Reduce syntax} |
| 7 |
|
| 8 |
Starting {\bf bergman} you are in the algebraic mode of Reduce |
| 9 |
\index{Reduce mode}. |
| 10 |
It means that |
| 11 |
you have the possibility to work in the Reduce syntax, and someone |
| 12 |
can prefer it because the notation is more closed to usual algebraic mode |
| 13 |
and to most of Algol--like programming languages. |
| 14 |
|
| 15 |
There are several important syntactical differences. |
| 16 |
|
| 17 |
For example, you can use infix operators in algebraic formulae and write $a+b$ instead of {\it (plus a b)} in Lisp. |
| 18 |
You can done also the assignment in prefix form: |
| 19 |
the usual command |
| 20 |
$$x:=2+3;$$ |
| 21 |
produces the expected assignment 5 to a variable x. |
| 22 |
|
| 23 |
You can check the result, for example, by |
| 24 |
|
| 25 |
if $x =5$ then print (x); |
| 26 |
|
| 27 |
There are also {\it while} and {\it repeat} statements, {\it for} and {\it for each} loops and so on. See for details Anthony C.Hearn "Reduce User's Manual", |
| 28 |
here we use only some examples from this manual. |
| 29 |
|
| 30 |
|
| 31 |
Note that all the |
| 32 |
commands are finished by a semicolon. |
| 33 |
|
| 34 |
The important |
| 35 |
difference is that empty parenthesis are necessary in every |
| 36 |
call of a procedure without arguments, for example, to call the |
| 37 |
procedure \index{simple} {\bf simple} it is necessary to write {\bf |
| 38 |
simple();} . |
| 39 |
If you write {\bf simple;} (without parenthesis) the |
| 40 |
following message will occurred: |
| 41 |
|
| 42 |
***** `simple' is an unbound ID |
| 43 |
|
| 44 |
|
| 45 |
Being in the Reduce mode one has the full access to Lisp |
| 46 |
\index{symbolic mode} symbolic |
| 47 |
calculations switching the mode to the symbolic one by means of |
| 48 |
{\bf symbolic;} or {\bf lisp;} |
| 49 |
|
| 50 |
To return to the \index{algebraic mode} algebraic mode it is necessary to type {\bf algebraic;} |
| 51 |
|
| 52 |
To check the current mode one types {\bf eval\underline{ }mode;} . |
| 53 |
The current mode will be printed as {\bf ALGEBRAIC} or {\bf SYMBOLIC}. |
| 54 |
|
| 55 |
One can prefixes the relevant expression by the appropriate mode. For example, |
| 56 |
if the current mode is {\bf algebraic}, then the commands |
| 57 |
|
| 58 |
\begin{verbatim} |
| 59 |
symbolic car '(a); |
| 60 |
x+y; |
| 61 |
\end{verbatim} |
| 62 |
|
| 63 |
will cause the first expression to be evaluated and printed in symbolic mode |
| 64 |
and the second in algebraic mode. |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
Now let us check a {\bf bergman} session in the Reduce mode. |
| 69 |
|
| 70 |
|
| 71 |
\begin{verbatim} |
| 72 |
> bergman |
| 73 |
4: simple(); |
| 74 |
Now input in-variables and ideal generators |
| 75 |
in algebraic form, thus: |
| 76 |
vars v1, ..., vn; |
| 77 |
r1, ..., rm; |
| 78 |
where v1, ..., vn are the variables, |
| 79 |
and r1, ..., rm the generators. |
| 80 |
algebraic form (comm.) input> vars x,y; x^2-y^2,x*y; |
| 81 |
% 2 |
| 82 |
x*y, |
| 83 |
x^2-y^2, |
| 84 |
|
| 85 |
% 3 |
| 86 |
y^3, |
| 87 |
|
| 88 |
Done |
| 89 |
- All is OK (I hope). Now you may (e. g.): |
| 90 |
- kill bergman with (QUIT); or |
| 91 |
- interrupt bergman with ^Z; or |
| 92 |
- clear the memory with (CLEARIDEAL), |
| 93 |
and run a new (SIMPLE). |
| 94 |
|
| 95 |
nil |
| 96 |
|
| 97 |
5: quit; |
| 98 |
|
| 99 |
Quitting |
| 100 |
|
| 101 |
\end{verbatim} |
| 102 |
|
| 103 |
Note that {\bf quit;} is with the semicolon too. |
| 104 |
|
| 105 |
To switch from the Reduce mode to the Lisp one the user can use the familiar |
| 106 |
command {\bf end;} |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
\subsection{Parametric coefficients} |
| 111 |
|
| 112 |
One of the advantages in using Reduce mode is the possibility to use |
| 113 |
arbitrary coefficients that allows Reduce. For example, it is possible |
| 114 |
to use \index{parametric coefficients} parametric coefficients and to work with the generic rings. |
| 115 |
The idea is that you allow coefficients and operations be taken from |
| 116 |
Reduce, |
| 117 |
but the main procedures for Gr\"{o}bner bases calculations are the |
| 118 |
same. |
| 119 |
|
| 120 |
|
| 121 |
Let us check one example. Suppose that we need a Gr\"{o}bner basis |
| 122 |
for a generic ring |
| 123 |
$$A=<x,y\, |\, x^2-a*y^2,x*y>,$$ |
| 124 |
where $a$ is a parameter (it means that we work over the field of |
| 125 |
fractions $K(a)$). |
| 126 |
|
| 127 |
The session begins with switching to symbolic mode. |
| 128 |
The input variables are setted up and the coefficients handling |
| 129 |
procedure \index{setreducesfcoeffs} {\bf setreducesfcoeffs()} is called. After that |
| 130 |
we switch to algebraic mode and start Gr\"{o}bner basis |
| 131 |
calculations. |
| 132 |
|
| 133 |
%------------------------------------- |
| 134 |
\begin{verbatim} |
| 135 |
|
| 136 |
> bergman |
| 137 |
|
| 138 |
7: symbolic; |
| 139 |
|
| 140 |
nil |
| 141 |
|
| 142 |
8: setreducesfcoeffs(); |
| 143 |
|
| 144 |
nil |
| 145 |
|
| 146 |
9: setiovars '(x,y); |
| 147 |
|
| 148 |
nil |
| 149 |
|
| 150 |
10: algebraic; |
| 151 |
|
| 152 |
11: lpol:= {x^2-a*y^2,x*y}; |
| 153 |
|
| 154 |
2 2 |
| 155 |
lpol := { - a*y + x ,x*y} |
| 156 |
|
| 157 |
12: bmgroebner lpol; |
| 158 |
|
| 159 |
2 2 3 |
| 160 |
{x*y, - a*y + x ,a*y } |
| 161 |
|
| 162 |
13: bye; |
| 163 |
|
| 164 |
\end{verbatim} |
| 165 |
|
| 166 |
|
| 167 |
Note, that all mode--changers (including {\bf setiovars}) must be |
| 168 |
run symbolically. |
| 169 |
Then {\bf bmgroebner} \index{bmgroebner} may be called {\it from algebraic mode}, with a list of |
| 170 |
polynomials as (single) argument. Each polynomial should be homogeneous, |
| 171 |
and {\it only} contain input variables listed in {\bf setiovars}. |
| 172 |
If all is well, {\bf bmgroebner} |
| 173 |
returns a reduced groebner basis (as a list of polynomials). |
| 174 |
|
| 175 |
Right now, only integer or standard form coefficients are permitted. |
| 176 |
|
| 177 |
Important! Only commutative version is available: the noncommutative |
| 178 |
version can be called, but right now produces wrong results. |