[MAXIMA] Extending functionality
thilts33 at telus.net
Fri Aug 4 15:16:42 CDT 2006
Last year I installed Win32 Maxima which came with a TCL shell console.
I used both TCL and Maxima in console mode but did nothing that involved
one directly with the other. At that time I only knew that they could be
integrated in some fashion and I would have to learn TCL first. Although
I have not done so, it seems that Maxima functions can be called from a
TCL program but I still don't know how.
To do so would require some kind of calling process -- maybe like perl
calls bash commands? In this regard, has Maxima been provisioned so
that one can evoke a specific function using some syntax like "maxima
arg1 arg2, etc."? If so, this would be treated by TCL as a command.
It's been a while but I think TCL lends itself to using functions from
other languages. But I've seen no such examples. I have a book full of
TCL documentation but every example seemed to employ TCL built in
commands, functions, etc. The book says: "TCL is designed to be a glue
that assembles software building blocks into applications." TCL is also
an interpreter where the basic mechanisms are ALL related to strings and
string substitutions. The idea conveyed is that TCL itself does not
understand these commands and building blockw. TCL casts everything
into the mold of a command (even it's programming elements) and it is up
to the command to interpret it's arguements. TCL also has built in
commands, math functions, arithmetic operators, etc.so obviously for
this built in stuff there is one or more associated interpreters (the
manner built ins like "exec" or "eval" operate to do their function is
not explained). In Perl for example the Bash functions having these same
names are turned over to the Bash Shell (high level programming
environment) to process the commands and the results are returned to the
Perl programming environment. What has me confused is "it is up to the
command to interpret it's arguments". TCL itself does not interpret the
command (with the noted exceptions of built ins). For example, Perl
commands would have to be handled (interpreted) by a Perl programming
installation environment. For the Apache web server to handle Perl
scripts it has to create a Perl installation process (if CGI) which is
used to process the Perl script. Likewise, for TCL to handle Maxima
commands TCL would have to create a Maxima programming environment which
would be used to process the Maxima script. In both cases the location
on the machine running Apache or TCL would have to be also known or the
programming environments could not be located. So, the book is telling
me that the TCL interpreter should be able to contain a built in or an
external function which it treats as a command within a TCL coded
program. In addition, it seems to be also saying that the function can
be taken from a source external to TCL -- such as Maxima. And the
process to do this seems to involve establishing an interpreter (which
would be installation of the Maxima programming environment) within TCL
just for this purpose. In other words, it sounds like TCL takes a
"string" which it treates as a command by passing that string to the
appropriate programming environment (like bash, etc.) which recognizes
and facilitates that command being processed and the results being
returned to the TCL programming environment.
So I am looking for some clarification on this subject. And if I have
understood this subject correctly I am looking for a good example of TCL
evoking several Maxima programming and math functions.
Please correct me anywhere where I have missed the correct understanding.
Assuming that what I said above is mostly correct then I would like to
ask the question, can Maxima call other programs, for example some
external math (or data acquisition, etc.) package or package function?
Or would it have to be compiled into Maxima? Or both?
I realize that is Maxima is coded in Lisp and also that Maxima contains
programming elements as part of it's content such as control structures
and other programming syntax. I also understand that by using an
external editor one can set out a program constructed using Maxima
programming, arithmetic, and other functions and run this file in batch
mode. Also, I think it might be possible to invoke from interactive
mode such a file for execution but I am not clear on this. I think I did
that on Maple. I do know that both the interactive and batch mode
both allow for input and output.
In addition, apparently Lisp and Maxima can be used together in some
kind of integrated fashion but I am not clear on the implementation.
For example, can one simply set up a Lisp program and then imbed
certain Maxima programming, arithmetic, and other functions and vice
versa? I think some program languages have a kind of dynamic linking
compiled into them that provides for a process of embedding certain
kinds of external modules. But that is done so that the application
being compiled contains those external (and compatible) modules. That's
not what I am asking. I am asking if it is possible to set up a program
built by Lisp (which has different syntax than Maxima) and drop into
certain Lisp constructs pre made Maxima code?
Answers to these questions would be very much appreciated.
Thanks, Ted Hilts
More information about the Maxima