I used Maple V5 back in 92 to write some functions to solve some problems using Groebner basis. Since then I have used Maple for simple calculations and therefore my programming skills are long-forgotten. Most of the functions I wrote and used at that time no longer work and I am trying to go back and update them to the Maple Version I currently have, that is, Maple 18.
Questions:
a) Is there an automatic tool to update old Maple functions?
b) Commands such as vars := [x.(1 .. n)]
used to work but not anymore. The ideia was to create a list with x1,x2,.. xn. I know that seq(x[i], i = 1 .. 5)
would create a list with x_1,x_2, ... but it is not exactly the same.
c) Tips and suggestions how to smooth out the process of updating are most welcome.
Thanks
Ed
There were some changes to the language between Maple V Release 5 and Maple 6, and the replacement of .
with ||
was one of those.
Maple 6 (and 7 if I recall) shipped with an additional binary updtsrc
which could act on Maple source files and make the text replacements. For example, if I start with a plaintext file var.mpl
containing just this,
vars := [x.(1 .. n)];
and then apply the shell command updtsrc var.mpl
I get this output,
`.` has been replaced by `||`; see ?||
vars := [x||(1 .. n)];
I did that on Ubuntu 14.04.4 LTS Linux, using the (redhat) updtsrc
binary downloaded from the HTTP link for Linux on this page.
If your Maple V sources are in a .mws worksheet file then you might have to export the input to a plaintext file.
I haven't tried in (on a plaintext file, in a DOS window, or Powershell) on MS-Windows (though the zip file from that page did unpack to a updtsrc.exe
file).
So if you have a great deal of old codes containing language incompatibilities between Maple V and Maple 6 then you could try this route to automate the conversion.
There have been some commands deprecated betwen Maple 6 and Maple 18 (eg, lowercase vector
) but few further language changes (backwards incompatibilities).
I suggest that you read the help pages in your Maple 18 for the language updates. In particular I suggest you look at the help pages for these help topics (entering these in the Help Brower's Search bar):
updtsrc
updates,Maple6,compatibility
As for you second example involving vector
, it is true that vector
has been deprecated and superceded by the Vector
command.
But even in MapleV R5 you should not really have been using op(f)
on vector f
. More correct would have been eval(f)
or evalm(f)
. Eg,
f:=vector([-x1^2,x2*u]);
[ 2 ]
f := [-x1 , x2 u]
var:=u;
var := u
subs(var=cat(var,0), eval(f));
[ 2 ]
[-x1 , x2 u0]
Now, suppose you instead use Vector
in the above. In that case using op(f)
in that subs
call will produce the error you cited, because unlike vector
the Vector
beast does not have last-name-eval.
f:=Vector([-x1^2,x2*u]);
[ 2]
f := [-x1 ]
[ ]
[x2 u]
var:=u;
var := u
subs(var=cat(var,0), op(f));
Error, invalid input: subs received 2, which is not valid for
its 2nd argument
You could still use eval(f)
here, but in fact it is not necessary.
subs(var=cat(var,0), eval(f));
[ 2 ]
[-x1 ]
[ ]
[x2 u0]
subs(var=cat(var,0), f);
[ 2 ]
[-x1 ]
[ ]
[x2 u0]
Lastly, try to download and install the point-release Maple 18.02 rather than stick with Maple 18.00. You can find that here.