Re: Mathematica's facilities with lyx...

2002-05-06 Thread Dekel Tsur

On Mon, May 06, 2002 at 08:41:02PM +0200, geof wrote:
> Hello,
> 
> I'm new on this mailing list but I'm using lyx for a long time now.
> I have some questions about the lyx-server and how to use it. 
> My idea is to use the lyx-server to access the Mathematica's (from Wolfram) 
> equation manipulation facilities. For example, pasting equation from 
> Mathematica to lyx or using Mathematica commands like "Simplify", "Factor" 
> directly on lyx formulas. 
> So, where can find the list with explanations of the lyx's commands. In fact, 
> for the first step, I'd like be able to pipe out formula selection.
> Thank you

LyX 1.2.0 already contains basic support for communicating with maple (and
octave).
Support for Mathematica or other CAS can be added rather simply.



Re: Mathematica's facilities with lyx...

2002-05-06 Thread Andre Poenitz

On Mon, May 06, 2002 at 08:41:02PM +0200, geof wrote:
> I'm new on this mailing list but I'm using lyx for a long time now.
> I have some questions about the lyx-server and how to use it. 
> My idea is to use the lyx-server to access the Mathematica's (from Wolfram) 
> equation manipulation facilities. For example, pasting equation from 
> Mathematica to lyx or using Mathematica commands like "Simplify", "Factor" 
> directly on lyx formulas. 

Things like that work (rudimentarily) already for Maple and Octave in
1.2.0. The missing Mathematica support results mainly from me not being
able to get Mma up and running on my Linux box. I have a licenced copy in
reach and it looks as though it contains a Windows and Solaris version on
the CDs but failed to install it on Linux (can't remember what went
wrong exactly).

> So, where can find the list with explanations of the lyx's commands. In
> fact, for the first step, I'd like be able to pipe out formula selection.

Have a look at src/mathed/math_extern.[Ch] and the 'maplize' and 'octavize'
families of functions of MathInset. Adding a new CAS is straightforward.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)



Re: Mathematica's facilities with lyx...

2002-05-07 Thread Dekel Tsur

On Tue, May 07, 2002 at 09:03:29AM +0200, Andre Poenitz wrote:
> On Mon, May 06, 2002 at 08:41:02PM +0200, geof wrote:
> > I'm new on this mailing list but I'm using lyx for a long time now.
> > I have some questions about the lyx-server and how to use it. 
> > My idea is to use the lyx-server to access the Mathematica's (from Wolfram) 
> > equation manipulation facilities. For example, pasting equation from 
> > Mathematica to lyx or using Mathematica commands like "Simplify", "Factor" 
> > directly on lyx formulas. 
> 
> Things like that work (rudimentarily) already for Maple and Octave in
> 1.2.0. The missing Mathematica support results mainly from me not being
> able to get Mma up and running on my Linux box. I have a licenced copy in
> reach and it looks as though it contains a Windows and Solaris version on
> the CDs but failed to install it on Linux (can't remember what went
> wrong exactly).

How about adding support to Maxima, which is GPL (unlike Maple/Mathematica) ?
Another free CAS is MuPAD, but it is not open source.



Re: Mathematica's facilities with lyx...

2002-06-05 Thread geof

On Tuesday 07 May 2002 09:03, Andre Poenitz wrote:
> On Mon, May 06, 2002 at 08:41:02PM +0200, geof wrote:
> > I'm new on this mailing list but I'm using lyx for a long time now.
> > I have some questions about the lyx-server and how to use it.
> > My idea is to use the lyx-server to access the Mathematica's (from
> > Wolfram) equation manipulation facilities. For example, pasting equation
> > from Mathematica to lyx or using Mathematica commands like "Simplify",
> > "Factor" directly on lyx formulas.
>
> Things like that work (rudimentarily) already for Maple and Octave in
> 1.2.0. 

Yes, but how it work? And what exactly can be done?
I'm interested to add mathematica support but I'd like have more information 
about what has been already done. I had a look at the files 
src/mathed/math_extern.[Ch] but as I don't know what I'm looking for, it 
doesn't realy help.

> > So, where can find the list with explanations of the lyx's commands. In
> > fact, for the first step, I'd like be able to pipe out formula selection.
>
> Have a look at src/mathed/math_extern.[Ch] and the 'maplize' and 'octavize'
> families of functions of MathInset. Adding a new CAS is straightforward.
>
> Andre'

geof



Re: Mathematica's facilities with lyx...

2002-06-23 Thread Andre Poenitz

On Wed, Jun 05, 2002 at 02:14:19PM +0200, geof wrote:
> > Things like that work (rudimentarily) already for Maple and Octave in
> > 1.2.0. 
> 
> Yes, but how it work? And what exactly can be done?

You write '1 + 2' in a math formula and type 'M-x math-extern maple
simplify' to get a '= 3' added. Alternately, you can mark the '1 + 2' and
it will get replaced by '3'. In general, 'M-x math-extern foo' will call
Maple's 'foo' function on the selected expressin.

> I'm interested to add mathematica support but I'd like have more
> information about what has been already done. I had a look at the files
> src/mathed/math_extern.[Ch] but as I don't know what I'm looking for, it
> doesn't realy help.

You basically have to add a function 'mathematicize' (or whatever) to every
math inset (or at least to the ones you are interested in) and there you
put code to transform the inset into Mma syntax. Usually you should be able
to copy the 'maplize' function and replace parantheses by square brackets
and things like that. Than you need to have a look add math_extern.C and
formulabase.C and hook calls to these new functions in. 

You need to call Mma in some kind of command line mode that produces
minimal output (either a result it LaTeX or an error message) and parse
this output. Just look at what the maple and octave backends do. It's not
exactly rocket science but quite a bit of work.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)



Re: Mathematica's facilities with lyx...

2002-06-24 Thread Dekel Tsur

On Mon, Jun 24, 2002 at 07:43:51AM +0200, Andre Poenitz wrote:
> You basically have to add a function 'mathematicize' (or whatever) to every
> math inset (or at least to the ones you are interested in) and there you
> put code to transform the inset into Mma syntax. Usually you should be able
> to copy the 'maplize' function and replace parantheses by square brackets
> and things like that. Than you need to have a look add math_extern.C and
> formulabase.C and hook calls to these new functions in. 

It is not very nice to have this hardcoded in the LyX sources.
can't you do it in external scripts, like the first implementation ?
Another idea would be to use text template files.
For example, an extern_maple would be something like

Insets
frac  ($0)/($1)
sqrt  sqrt($0)
...
End

Header
  readlib(latex):
  latex/csname_font := `:
  ...
End



Re: Mathematica's facilities with lyx...

2002-06-24 Thread Andre Poenitz

On Mon, Jun 24, 2002 at 03:05:59PM +0300, Dekel Tsur wrote:
> It is not very nice to have this hardcoded in the LyX sources.

I know.

> can't you do it in external scripts, like the first implementation ?

The external scripts would have to re-create the structure used within
mathed (more or less). I just got tired of re-implemting mathed a second
and third time.

> Another idea would be to use text template files.
> For example, an extern_maple would be something like
> 
> Insets
> frac  ($0)/($1)
> sqrt  sqrt($0)
> ...
> End

Have a go. But I think I'll do something like that myself some day when the
math-extern stuff has reached some critical mass that allows me to see
what is a "generic common base" and can be used as the hard-coded part, and
what is "backend specific" that could be put in such configuration files.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)



Re: Mathematica's facilities with lyx...

2002-06-25 Thread geof

On Monday 24 June 2002 14:13, Andre Poenitz wrote:
> On Mon, Jun 24, 2002 at 03:05:59PM +0300, Dekel Tsur wrote:

> > can't you do it in external scripts, like the first implementation ?
>
> The external scripts would have to re-create the structure used within
> mathed (more or less). I just got tired of re-implemting mathed a second
> and third time.
>
> > Another idea would be to use text template files.
> > For example, an extern_maple would be something like
> >
> > Insets
> > frac  ($0)/($1)
> > sqrt  sqrt($0)
> > ...
> > End
>
> Have a go. But I think I'll do something like that myself some day when the
> math-extern stuff has reached some critical mass that allows me to see
> what is a "generic common base" and can be used as the hard-coded part, and
> what is "backend specific" that could be put in such configuration files.

Ok, for the moment, I'll try to implement the mathematica stuff with the old 
fashion. I'll have time to do that this week-end. 
I suppose I have to start with the cvs version.

geof
-- 
~
   'v'mailto: gpiroux_at_mac_dot_com
  // \\   Powered by GNU/Linux-ppc
 /(   )\  http://lfs.linux-provider.net/  #112
   ^'^