On Thu, Aug 10, 2006 at 11:20:43PM -0500, Bo Peng wrote:

> > Please find attached a patch which monotonically improves such support.
> > I tested it with octave, maxima, and mathematica.
> 
> I do not have any of them... but I will install octave and test.

I think that octave is not suitable for that, as it cannot do symbolic
computations (it cannot deal with the examples I posted earlier).
I tested my changes with it only to be sure to not break
the support for it. You can use octave for performing numerical
computations, such as evaluating the determinant of a matrix or the
product of two matrices whose elements are numbers, for example.

You can try to install maxima http://maxima.sourceforge.net/ as it
is GPL'ed and is also available for Windows. Be warned that it will
only work with the cygwin version of LyX, due to the way it is invoked.

The problem with native Windows is this line in captureOutput() in
src/mathed/math_extern.C:

      string command =  "echo '" + data + "' | " + cmd;

which for native Windows should be changed to

      string command =  "echo " + data + " | " + cmd;

i.e., the argument of echo should not be quoted at all (stupid cmd.exe).
However, I was able to use it with a stock 1.4.2 placing the following
script in the PATH:

------8<--- maxima.bat ---8<------
@echo off
sed -e "s/^'\(.*\)'/\1/" -e "s/SIMPSUM/simpsum/g" -e "s/INF/inf/g" | C:\Programm
i\Maxima\bin\maxima.bat
------8<--------8<--------8<------

Here, C:\Programmi\Maxima\bin\maxima.bat is the real script distributed
with maxima and you should take care that it is *not* in the PATH, in
order to use the wrapper maxima.bat.

For using maxima on Cygwin with LyX, you simply need to make a symlink
to the maxima script, as

$ ln -s C:/Programmi/Maxima/bin/maxima.bat /usr/local/bin/maxima

and be sure to have /usr/local/bin in the PATH (the cygwin bash can
execute .bat files).

> BTW, how difficult it is to add support for other applications like
> matlab, R, python etc?

It is quite strightforward. Simply grep for OctaveStream, or MaximaStream,
or MathematicaStream and you will understand what needs to be done.

-- 
Enrico

Reply via email to