Skip to content

Commit

Permalink
Support for Maxima 5.40.0 candidate. (For further testing).
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwinc committed Nov 26, 2017
1 parent 50eef6d commit a834296
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 49 deletions.
6 changes: 0 additions & 6 deletions doc/en/CAS/Optimising_Maxima.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ This is the default lisp used by most of the binary distributions, and therefore
~~~~
load("<path>/maximalocal.mac");
load("<path>/stackmaxima.mac");
load(stats);
load(distrib);
load(descriptive);
:lisp (si::save-system "/path/to/moodledata/stack/maxima-optimised")
quit();
~~~~
Expand All @@ -69,9 +66,6 @@ This is the default lisp used by most of the binary distributions, and therefore
~~~~
load("<path>/maximalocal.mac");
load("<path>/stackmaxima.mac");
load(stats);
load(distrib);
load(descriptive);
:lisp (ext:saveinitmem "/path/to/moodledata/stack/maxima-optimised.mem" :init-function #'user::run)
quit();
~~~~
Expand Down
68 changes: 34 additions & 34 deletions doc/en/Installation/Maxima.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Compiling Maxima from source.

You are strongly advised to read the installation instructions for the various components you need.!

As of 21st Dec 2015 the following has been used to compile Maxima from source.

### You will need the following, and GNU autotools

sudo apt-get install texinfo

### Download and compile SBCL (lisp)

cd /home/sangwinc/src
wget http://downloads.sourceforge.net/project/sbcl/sbcl/1.3.1/sbcl-1.3.1-source.tar.bz2
tar -xf sbcl-1.3.1-source.tar.bz2
cd sbcl-1.3.1/
./make-config.sh
./make.sh

sudo ./install.sh

### Download and compile Maxima

cd /home/sangwinc/src
wget http://kent.dl.sourceforge.net/project/maxima/Maxima-source/5.36.1-source/maxima-5.36.1.tar.gz
tar -zxf maxima-5.36.1.tar.gz
cd maxima-5.36.1/

./configure --with-sbcl

make
sudo make install


# Compiling Maxima from source.

You are strongly advised to read the installation instructions for the various components you need.!

As of 21st Dec 2015 the following has been used to compile Maxima from source.

### You will need the following, and GNU autotools

sudo apt-get install texinfo

### Download and compile SBCL (lisp)

cd /home/sangwinc/src
wget http://downloads.sourceforge.net/project/sbcl/sbcl/1.3.1/sbcl-1.3.1-source.tar.bz2
tar -xf sbcl-1.3.1-source.tar.bz2
cd sbcl-1.3.1/
./make-config.sh
./make.sh

sudo ./install.sh

### Download and compile Maxima

cd /home/sangwinc/src
wget http://kent.dl.sourceforge.net/project/maxima/Maxima-source/5.36.1-source/maxima-5.36.1.tar.gz
tar -zxf maxima-5.36.1.tar.gz
cd maxima-5.36.1/

./configure --with-sbcl

make
sudo make install


4 changes: 2 additions & 2 deletions doc/en/Installation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ STACK is being used live at a number of institutions, including the University o

## 2. Install GNUPlot and Maxima

Ensure GNUPlot and [Maxima](http://maxima.sourceforge.net) are installed on your server. Currently Maxima 5.34.1 to 5.36.1 then 5.38.0 to 5.39.0 are supported. Please avoid versions 5.37.x which are known to have a minor bug which affects STACK. STACK has been used with Maxima 5.25.1 to 5.36.1, but these older versions are not being actively tested. Please contact the developers to request support for other versions.
Ensure GNUPlot and [Maxima](http://maxima.sourceforge.net) are installed on your server. Currently Maxima 5.34.1 to 5.36.1 then 5.38.0 to 5.41.1 are supported. Please avoid versions 5.37.x which are known to have a minor bug which affects STACK. STACK has been used with Maxima 5.25.1 to 5.36.1, but these older versions are not being actively tested. Please contact the developers to request support for other versions.

We currently recommend that you use Maxima 5.38.1.

Please note

* Please avoid versions 5.37.x which are known to have a minor bug which affects STACK. There appear to be some important changes in Maxima we are working to accommodate in STACK. In particular with `simp:false`, \(s^(-1)\) is transformed into \(1/s\). This apparently minor change makes it impossible to distinguish between the two forms. This causes all sorts of problems. Do not use Maxim 5.37.1 to 5.37.3.
* Please avoid versions 5.37.x which are known to have a minor bug which affects STACK. In particular with `simp:false`, \(s^(-1)\) is transformed into \(1/s\). This apparently minor change makes it impossible to distinguish between the two forms. This causes all sorts of problems. Do not use Maxim 5.37.1 to 5.37.3.
* From version 5.35.1 on Windows, Maxima is very slow in starting, and there is no optimization mechanism.
* Older versions of Maxima: in particular, Maxima 5.23.2 has some differences which result in \(1/\sqrt{x} \neq \sqrt{1/x}\), and similar problems. This means that we have an inconsistency between questions between versions of maxima. Of course, we can argue about which values of \(x\) make \(1/\sqrt{x} = \sqrt{1/x}\), but currently the unit tests and assumption is that these expressions should be considered to be algebraically equivalent! So, older versions of Maxima are not supported for a reason. Please test thoroughly if you try to use an older version, and expect some errors in the mathematical parts of the code.
* If you install more than one version of Maxima then you will need to tell STACK which version to use. Otherwise just use the "default" option.
Expand Down
1 change: 1 addition & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
'5.35.1.2' => '3.35.1.2', '5.36.0' => '5.36.0', '5.36.1' => '5.36.1',
'5.37.3' => '5.37.3', // Recently compiled GCL version for Windows is much faster.
'5.38.0' => '5.38.0', '5.38.1' => '5.38.1', '5.39.0' => '5.39.0',
'5.40.0' => '5.40.0', '5.41.0' => '5.41.0',
'default' => 'default')));

$settings->add(new admin_setting_configtext('qtype_stack/castimeout',
Expand Down
7 changes: 5 additions & 2 deletions stack/cas/cassession.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,18 +551,21 @@ private function construct_maxima_command() {
$cascommands .= ", print(\"$i=[ error= [\"), cte(\"$label\",errcatch($label:$cmd)) ";
}

// From Maxima 5.40.0, variable names may only occur once in the local variable list in a block.
// This makes sure they only occur once.
$csnames = array();
// The session might, legitimately, attempt to redefine a Maxima global variable,
// which would throw a spurious error when the block attempts to define them as local.
if (!(array_key_exists($cleanlabel, self::$maximaglobals))) {
$csnames .= ", $cleanlabel";
$csnames[$cleanlabel] = true;
}

$i++;
}

$cass = $caspreamble;
$cass .= 'cab:block([ RANDOM_SEED';
$cass .= $csnames;
$cass .= implode(array_keys($csnames), ', ');
$cass .= '], stack_randseed(';
$cass .= $this->seed.')'.$csvars;
$cass .= ", print(\"[TimeStamp= [ $this->seed ], Locals= [ \") ";
Expand Down
2 changes: 1 addition & 1 deletion stack/maxima/inequalities.mac
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ neg_ineq_list(ex, l) := block([k],

/*******************************************************************************/
/* This block of functions removes unessary inequalities from a collection. */
ineq_rem_redundant(ex) := block([exl,exn,exg,exl,exo,exv, simp],
ineq_rem_redundant(ex) := block([exl,exn,exg,exo,exv, simp],
if atom(ex) then return(ex),
if not(safe_op(ex)="nounand" or safe_op(ex)="nounor" or safe_op(ex)="%and" or safe_op(ex)="%or" or safe_op(ex)="and") then
return(ex),
Expand Down
14 changes: 10 additions & 4 deletions stack/maxima/stacktex.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
;; Fateman's code was ported to Common Lisp by William
;; Schelter.

;; 26 Nov 2017.
;; Note, this commit in Maxmia changed (getcharn f) to (get-first-char).
;; https://sourceforge.net/p/maxima/code/ci/b27acfa194281f42ef6d2a4ef2434d8dea4705f1/

;; If you want LaTeX style quotients, first load mactex and second
;; define tex-mquotient as follows

Expand Down Expand Up @@ -257,7 +261,7 @@
(expon (caddr x)) ;; this is the exponent
(doit (and
f ; there is such a function
(member (getcharn f 1) '(#\% #\$)) ;; insist it is a % or $ function
(member (get-first-char f) '(#\% #\$)) ;; insist it is a % or $ function
(not (member 'array (cdar fx) :test #'eq)) ; fix for x[i]^2
(not (member f '(%sum %product %derivative %integrate %at $texsub
%lsum %limit $pderivop $+-) :test #'eq)) ;; what else? what a hack...
Expand Down Expand Up @@ -321,23 +325,25 @@
;; DANGER: no error checking on the type of arguments.
(defprop $floatgrind msz-floatgrind grind)
(defun msz-floatgrind (x l r)
(msz (mapcar #'(lambda (l) (getcharn l 1)) (makestring (concatenate 'string "floatgrind(" (format nil (cadr (cdr x)) (cadr x)) ",\"" (cadr (cdr x)) "\")"))) l r)
(msz (mapcar #'(lambda (l) (get-first-char l)) (makestring (concatenate 'string "floatgrind(" (format nil (cadr (cdr x)) (cadr x)) ",\"" (cadr (cdr x)) "\")"))) l r)
)

;; This function has grind (and hence "string") output the number with the following number of decimal places.
;; displaydp(number, ndps).
;; DO NOT USE: no error checking on the types of the arguments.
;;(defprop $dispdp msz-dispdp grind)
;;(defun msz-dispdp (x l r)
;; (msz (mapcar #'(lambda (l) (getcharn l 1)) (makestring (concatenate 'string "dispdp(" (format nil (concatenate 'string "~," (format nil "~d" (cadr (cdr x))) "f" ) (cadr x)) "," (format nil "~d" (cadr (cdr x))) ")" ))) l r)
;; (msz (mapcar #'(lambda (l) (get-first-char l)) (makestring (concatenate 'string "dispdp(" (format nil (concatenate 'string "~," (format nil "~d" (cadr (cdr x))) "f" ) (cadr x)) "," (format nil "~d" (cadr (cdr x))) ")" ))) l r)
;;)

;; This function has grind (and hence "string") output the number with the following number of decimal places.
;; displaydp(number, ndps).
(defprop $dispdpvalue msz-dispdpvalue grind)
(defun msz-dispdpvalue (x l r)
(msz (mapcar #'(lambda (l) (getcharn l 1)) (makestring (format nil (concatenate 'string "~," (format nil "~d" (cadr (cdr x))) "f" ) (cadr x)) )) l r)
(msz (mapcar #'(lambda (l) (get-first-char l)) (makestring (format nil (concatenate 'string "~," (format nil "~d" (cadr (cdr x))) "f" ) (cadr x)) )) l r)
)

;; Define an "arrayp" function to check if we have a Maxima array.
(defmfun $arrayp (x) (and (not (atom x)) (cond ((member 'array (car x) :test #'eq) $true) (T $false))))


0 comments on commit a834296

Please sign in to comment.