Updated 2013-01-28 02:24:11 by RLE


As a simpler alternative for making a socket link with the mathematical manipulation package maxima, a valid approach has proven to be to exec maxima with a stdin provided command. The windows maxima distribution appears to have no command line version, only the Tk interfaced xmaxima, for which the approach on Bwise combined with Maxima works for me, which could be improved, but is potentially fairly efficient and flexible.

On this page, I use Linux, and BWise using a recent tcl/tk version from I think Activestate. BWise regularly requires typing of commands, which is easily done with the console, just for convenience, this is my RedHat 9 startup script (using a console from console for Unix):
 source unixconsole.tcl
 source bwiseprocs0343.tcl


 wm geom . 636x350+9+4

 # comment out when no more need..

 package require Img
 wm geom .f 355x351+658+4
 #.f.fu.l conf -font {{MS Sans Serif} 10}
 #.f.ft.t conf -font {{MS Sans Serif} 12}
 console eval {.console conf -font {courier 14}}
 console eval { wm geom . 80x24+193+335 }

To execute a Maxima command, I've made this procedure, primarily for linux/unix:
 proc domaxima {m} {
    set t "display2d:false;\n$m;"
    return [string range [exec maxima << $t | tail -2  ] 4 end-6]

The pipe with tail can certainly be replaced by non-streaming tcl commands, but this appeared to work.

The variable t contains the constructed maxima commands, including setting the format to displaying results in reusable form, while the exec is given this variables' content as stdin. At EOF maxima simply quits, and all stdout data is flushed and filtered.

Basically calling this procedure will start a maxima process which evaluates the argument m and returns the single maxima result, which can also be done as part of a bwise block, of which the blockfunction could be:
   newproc {set Maxima.out [domaxima ${Maxima.in}]} Maxima

This block can now be used in normal bwise graphs, and for instance the right-click popup 'Data' menu gives access to its variables, and allows direct editing of the pin variable contents, and allows the block to be fired without further graph with the Eval button.

In the same context, I've made a script to automatically use the maxima 'fortran' command to generate function values under C control: a tcl script for function value listing based on a fortran expression.

Also, the xmaxima for linux (unix) can be given a console with the abovementioned script by editing/usr/bin/xmaxima with a text editor, and near the very end adding:
 MAXTkmaxima tkmaxima
 rename exit tkexit
 proc exit {{val "0"}} {tkmaxima exit "" $val}

 ## ADD (changing path to match your console script file):
 source /home/theo/Tcl/unixconsole.tcl

 tkmaxima install