How to find out runtime version of Maxima? (confused by new format of eigenvectors() in 5.19.2)




On Wed, 16 Sep 2009, Alexander Shulgin wrote:

< On Fri, Sep 4, 2009 at 13:20, Andrej Vodopivec
< <andrej.vodopivec at gmail.com> wrote:
< > Lisp variable *autoconf-version* contains the version as a string. You
< > can then use stringproc functions to compare versions.
< >
< > (%i1) version: ?\*autoconf\-version\*;
< > (%o1) 5.19.2
< 
< Thanks, this worked! :)
< 
< I've come up with the following:
< 
< maxima_version() :=
<   map(parse_string, tokens(?\*autoconf\-version\*, 'digitcharp));
< 
< version_compare(v1, v2) := block(
<   [len1: length(v1), len2: length(v2), v, i, cmp: 0],
<   if len2 > len1 then v1: append(v1, makelist(0, i, 1, len2 - len1)),
<   if len1 > len2 then v2: append(v2, makelist(0, i, 1, len1 - len2)),
<   v: v1 - v2,
<   i: 1,
<   while i <= length(v) and cmp = 0 do
<     (cmp: v[i],
<      i: i + 1),
<   cmp);
 
I notice that stringproc has imported the lisp character comparison
functions, but only the string= function. As a result, you have written
lots of code to overcome this. Here is an alternative, 


slessp(s1,s2):=if stringp(s1) and stringp(s2) then ?string\<(s1,s2) else
error("...");

vc(v):= if stringp(v) then if slessp(?\*autoconf\-version\*,v)#false then 1 elseif
slessp(v,?\*autoconf\-version\*)#false then -1 else 0 else error("...");

The first function imports lisp's string< to maxima, and the second does
the comparison you want.

(%i15) vc("5.18.1");

(%o15) 0
(%i16) vc("5.18.0");

(%o16) -1
(%i17) vc("5.19.1");

(%o17) 1



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.