Version 0 of Bwise blocks using exec maxima

Updated 2004-10-21 19:45:30

TV

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:


 source unixconsole.tcl
 source bwiseprocs0343.tcl

 bwise
 update

 wm geom . 636x350+9+4

 # comment out when no more need..
 welcome

 package require Img
 procs_window
 update
 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.

http://82.168.209.239/Wiki/linuxmaxima1.jpg