close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

source: branches/f4grobner/ngrobner.lisp@ 1506

Last change on this file since 1506 was 1300, checked in by Marek Rychlik, 9 years ago

* empty log message *

File size: 3.6 KB
RevLine 
[1201]1;;; -*- Mode: Lisp -*-
[1]2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;;
[72]4;;; Copyright (C) 1999, 2002, 2009, 2015 Marek Rychlik <rychlik@u.arizona.edu>
[1]5;;;
6;;; This program is free software; you can redistribute it and/or modify
7;;; it under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 2 of the License, or
9;;; (at your option) any later version.
10;;;
11;;; This program is distributed in the hope that it will be useful,
12;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with this program; if not, write to the Free Software
18;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19;;;
20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21
[182]22(in-package :ngrobner)
[135]23
[1]24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25;;
26;; Global switches
27;;
[94]28;; Can be used in Maxima just fine, as they observe the
[95]29;; Maxima naming convention, i.e. all names visible at the
[96]30;; Maxima toplevel begin with a '$'.
[94]31;;
[1]32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33
[97]34(defvar $poly_monomial_order '$lex
[1]35 "This switch controls which monomial order is used in polynomial
36and Grobner basis calculations. If not set, LEX will be used")
37
[97]38(defvar $poly_coefficient_ring '$expression_ring
[1]39 "This switch indicates the coefficient ring of the polynomials
40that will be used in grobner calculations. If not set, Maxima's
41general expression ring will be used. This variable may be set
42to RING_OF_INTEGERS if desired.")
43
[97]44(defvar $poly_primary_elimination_order nil
[1]45 "Name of the default order for eliminated variables in elimination-based functions.
46If not set, LEX will be used.")
47
[97]48(defvar $poly_secondary_elimination_order nil
[1]49 "Name of the default order for kept variables in elimination-based functions.
50If not set, LEX will be used.")
51
[97]52(defvar $poly_elimination_order nil
[1]53 "Name of the default elimination order used in elimination calculations.
54If set, it overrides the settings in variables POLY_PRIMARY_ELIMINATION_ORDER
55and SECONDARY_ELIMINATION_ORDER. The user must ensure that this is a true
56elimination order valid for the number of eliminated variables.")
57
[97]58(defvar $poly_return_term_list nil
[1]59 "If set to T, all functions in this package will return each polynomial as a
60list of terms in the current monomial order rather than a Maxima general expression.")
61
62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63;;
64;; Conversion from internal to infix form
65;;
66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67
68(defun coerce-to-infix (poly-type object vars)
[635]69 "Write a polynomial, polynomial list, termlist term
[636]70in infix form, using variables VARS. Can be used to display
71an internal form polynomial more readably."
[1]72 (case poly-type
73 (:termlist
74 `(+ ,@(mapcar #'(lambda (term) (coerce-to-infix :term term vars)) object)))
75 (:polynomial
76 (coerce-to-infix :termlist (poly-termlist object) vars))
77 (:poly-list
78 `([ ,@(mapcar #'(lambda (p) (coerce-to-infix :polynomial p vars)) object)))
79 (:term
80 `(* ,(term-coeff object)
[751]81 ,@(mapcar #'(lambda (var power) `(expt ,var ,power))
[896]82 vars (coerce (term-monom object) 'list))))
[1]83 (otherwise
84 object)))
Note: See TracBrowser for help on using the repository browser.