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



On 9/16/09, Alexander Shulgin <alex.shulgin at gmail.com> wrote:

> maxima_version() :=
>   map(parse_string, tokens(?\*autoconf\-version\*, 'digitcharp));

Maybe this can be simplified somewhat.

split (?\*autoconf\-version\*, ".");
 => ["5","19","2"]

Note that the result of split is a list of strings.
Incidentally it's not guaranteed that each element is just
a number --- there have been (and there continue to be)
version numbers which are numbers & letters combined.

> 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);
>

A custom comparison function isn't necessary.
orderlessp does the right thing with lists.

orderlessp (["5", "19", "1"], ["5", "19", "2"]);
 => true

HTH

Robert Dodier