On June 17, 2005 9:04 AM C. Frangos wrote: > (1) Is there a short way of declaring all variables in an > axiom function to be local ? > > In Matlab this is automatically the case and global variables > have to be specifically declared. > > In axiom it seems that its the opposite, creating the > possibility of errors. Is this a design error in an > otherwise very advanced language ?
When you say "axiom function" I suppose you mean defining functions in the Axiom interpreter. The Axiom interpreter is really intended primarily for online interactive use. If you are converting a lot of Matlab code I think you would be much better advised to write Axiom library packages and/or new domains. > (2) In Matlab I have a main function (in an m-file) calling > another function, which in turn calls another function etc. > Its not clear from the axiom book how to implement this. > Does one have to use )read fun1.input, )read fun2.input, > ...etc, and then fun1(); ? No. )read only instructions the interpret to get it's input from a file instead of from the console. Calling functions in Axiom is done the same way as in most other high level languages except that Axiom's programming language (library compiler) permits simple overloading of function names based on types. So for example a function named 'average' may do quite different things if is applied to matrix compared to a list etc. > Any papers, reports or tutorials on the details of axiom > programming involving multiple functions defined in separate > files, calling each other, etc as described above would be > helpful. I highly recommend reading the Chapter 11 Packages in the Axiom Book. > (3) Is there a setting in axiom to avoid having to use > underscore _, to insert blank lines between program > lines in files defining functions ? This seems awkward > and error prone. This is an artifact of trying to use the Axiom interpreter environment for programming. _ is not required in .input files read by )read nor is is used in Axiom library programming. > (4) I am using the Matlab symbolic toolbox (Maple engine). Its > not clear from the axiom book how to typecast a unit matrix > (integer or float) to type expression or variable in order > to add it to another matrix containing expressions in the > variable/symbol x, for example: A:= I + matrixins; I am not sure what you mean, but this works for me for example 1> A:=matrix [[x,y],[z,w]] 2> A+1 See http://page.axiom-developer.org/zope/mathaction/SandboxMatrix > (5) System commands like )read, etc don't seem to work within > functions ? It is not clear to me why you want to do this. > (6) Is there an axiom equivalent to Matlab's pause command ? I don't think so. Probably a call to a simple lisp function could do this. > (7) I tried using a list to return multiple variables from a > function. However, this turns out to be of type any. These > variables can be displayed but not used in operations any > further. This means that you have to remember the types of > each variable in the list. Then, manually in the calling > function extract and explicitly typecast each variable in > the returned list. Is there an easier way of doing this ?? Axiom remembers the actual type. Try this 1> f() = [x,"x",1] 2> f().1 + 1 3> concat(f().2,"y") 4> f().3 + 1 > (8) Does the current axiom distribution with working graphics > have to be recompiled on my older suse linux 7.2 machine > (first one took about 12 hours) or can I somehow copy the > directory of the latest axiom via ethernet from my newer > suse linux 9.2 machine ? You might have problems with incompatible versions of system librarys if you try to copy Axiom compiled on a newer version of suse to an older one. You might be able to just do cvs update ./configure (set variables) make on your old system. In principle this *might* not require a complete rebuild of Axiom. Regards, Bill Page. _______________________________________________ Axiom-math mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/axiom-math
