[MAXIMA] Extending functionality



Robert

Thank you for you informed answer. You are very analytical and organized 
in your thinking so I will try my best to clarify my actual purpose by 
providing you sufficient relevant information.

You are correct in saying that I have not made my objective clear. 
Sorry.  I only realized that  when I caught the nature of your response.

Initially (1) I simply want to be able to code in TCL and make it 
possible to evoke from TCL Maxima programming and mathematical functions.  

Also, (2) I would like to code in Maxima and make it possible to evoke 
TCL functionality. But (2) is not as important to me as is (1).  

(3s)  Essentially, I want to code from a TCL IDE  (which I suppose would 
be the TCL console)  executing TCL files which evoke Maxima programming 
files and Maxima mathematical functions.  I am interested in both 
execution fromTCL  files (batch) and TCL  interactive.

(3b )However, I read in an article where the author claimed to run 
either or both (I'm not sure now) TCL and Maxima from an editor.  This 
apparently gave him the abiltity to both edit and run programs in this 
editor environment which he compared to the Maple live spread sheet 
where one could both code, edit, execute as well as remember prior 
actions, etc.  

(4) That got me really excited. I said to myself, I should be able to 
run an editor (like Emacs)  within the TCL console or batch file and 
within that editor set up TCL evoking  Maxima functionality.  So my 
objective widened from simply using TCL to Maxima interaction to that 
interaction involving an editor.  

(5) is the crux of the issue I was trying to get help on.

(5) But my basic problem with all of this is understanding how to set up 
TCL to provide a data channel between itself and some other environment 
like Maxima or Maxima (hopefully in combination with an editor like 
EMACS ).   That is, HOW (what are the TCL language elements and language 
sytax that enables these channels).  And what conduct does that evoke on 
the Maxima end of things.  In other words I need to know how to code in 
TCL the interfacing process.  Not the actual evoked Maxima control and 
mathematical functions and programs but rather the code that enables the 
transfer process between TCL and Maxima engines which I call Programming 
Environments.

DETAILS: But life got complicated as soon as I asked my self  HOW TCL 
actually evokes Maxima functionality.  I have read the information 
available on Maxima and TCL (obviously not all of it for I seemed to 
miss some information).   In the process of discovery I discovered there 
were a number of seemingly differen't ways to interface TCL and Maxima 
and one article indicated that socket interaction was generally the way 
to go and another indicated that a text based TK widget was one way to 
go (which did not involve sockets) and another indicated that one could 
build a "proc" and actually provided one.  Some examples were given that 
had assumptions in that they lacked sufficient detail for me to 
understand the actual interfacing between TCL and/or PHP.  I got the 
notion that much of this was still in the exploratory stage.  But then I 
discovered an interesting article about audio signal processing that 
involved PHP or TCL (don't remember now)  interfacing with Maxima.  In 
all of this the actual interfacing seemed vague -- maybe because I am 
still getting used to the TCL and Maxima functions and their useage. The 
TCL handbook does not specifically address interfacing TCL to Maxima, in 
fact the author of the TCL book had never heard of Maxima until I 
contacted him about a year ago.

Basically I was looking for solid or reliable way or ways of programming 
in TCL as super structure code that evoked Maxima functionality. And I 
was excited about this editor environment acting as an IDE.  What I had 
missed in my surfing through the documentation, wikis, tutorials and 
other documents was HOW (in terms of TCL language syntax and functions 
involved) TCL evoked the desired Maxima function. or Maxima batch file 
(containing a Maxima program which could serve as an evoked function). 
 I did come to understand that TCL had to first evoke the Maxima engine 
(you guys call it engine and I call it the programming environment). 
 However, it seemed that before TCL could do this evoking it first had 
to be set up using some built in functions (for that purpose) and/or 
control syntax which apparently enabled data to move between TCL and 
Maxima "engines" or what I call the respective Programming Environments. 
 After that is done (this mysterious set up) then one simply imbeds the 
Maxima syntax embedded within the TCL coding. This seemed to be what 
some of the examples were saying. "Now just pop in the Maxima control 
and functional code".  Or is the set up functionality repeated for every 
time a Maxima function is evoked.  It seemed lke the former was the 
case.  Both sides of this data path (TCL and Maxima sides) utilize a 
process that is socket centric in character.  That does not tell me how 
to code the transfer. But knowing this I still don't know how to code 
sytactically using language elements and make this mysterious set up to 
enable that data exchange between the two programming environments. 
 That is what I missed, it's probably in something I read but I missed 
it somehow.

Maybe I should have hacked around but that takes a lot of time and my 
internet connection is very slow which makes hacking very slow.  Hope 
you can help me on this.

BTW:

I have not told you everything.  Once I get all this together and 
understand the syntax and language elements and how they facilitate the 
interfacing between TCL and Maxima I want to integrate this scenario 
into TI  89 Titanium.  TI (Texas Instruments) has provided a development 
 IDE (with Motorola 68000 modified C and assembler) having a simulated 
(virtual) calculator for both the TI  89 as well as the TI 92.  I think 
if I can get my act together I ought to be able to independently operate 
the TI IDE so it talks to the TCL programming environemnt (interactive 
with the Maxima programming environment) and vise versa by means of 
serial communications. In otherwords I can use their virtual (they say 
simulated) calculator to talk to my TCL IDE.  I can do this because the 
TI IDE  has an OS  (68000 based) and I can created (using C produced 
assebler) packages called APPS  or FLASH packages and make that 
calculator do anything I want.  This means I can bypass the proprietary 
transfer protocal designed to LOAD the TI IDE developed APPS and FLASH 
modules and deploy my transfer protocal  into the TI real Calculator or 
virtual Calulator or another computer.  Neat eh?

Right now though my objects is first (1) above down to (5).

I'm pretty sure my problem is somewhat elementary now that I have 
clarified things for you.

Thanks again and I am looking forward to your reply.

Ted Hilts

I need to understand what I would be doing.  As I said I am not yet 
competant enough with TCL or Maxima  to recognize certain function's 
behavior or the character of that behavior. So I probably missed what 
would have been obvious to someone such as yourself.  

Robert Dodier wrote:

> Ted,
>
> About calling other programs from Maxima and vv,
> that is possible but somewhat problematic. Be that as it may,
> several GUI's have been created as separate programs.
> See http://maxima.sourceforge.net/relatedprojects.shtml for a list.
> In every case (so far as I know) the GUI front end talks to
> Maxima via a socket. The difficult part of that approach is that
> it is hard to know when Maxima has completed a computation
> or if it is waiting for more input. There is an assumption in the
> Maxima code that there is always someone sitting at the
> console. I am considering ways to weaken that assumption
> but the problem is nontrivial.
>
> Aside from working with sockets, there is also the possibility
> of using a function call interface. It is trivial to call Lisp
> functions from Maxima -- if myprogram.lisp contains
> a function FOO then load("myprogram.lisp"); ?foo();
> is enough. myprogram.lisp can also call Maxima functions.
> There is more about Lisp & Maxima in the reference manual.
> See "Lisp and Maxima" at
> http://maxima.sourceforge.net/docs/manual/en/maxima.html .
> ? lisp at the interactive prompt should find the same text.
>
> Calling C or Fortran is theoretically possible but more work,
> as it would require using a so-called foreign function
> interface for Lisp. There is not yet a FFI which works for
> all Lisp implementations, although there seems to be
> at least one active project for that. Fortran functions can
> be translated into Lisp via f2cl, see:
> http://clocc.cvs.sourceforge.net/clocc/clocc/src/f2cl
>
> Maybe you can tell us more about what you want to do,
> then we could give some more specific advice.
>
> All the best,
> Robert Dodier
>