[sage-devel] Re: LaTeX code to Sage expression?

2011-05-12 Thread Jason Grout
On 5/12/11 11:38 PM, Dan Drake wrote: If I have a Sage expression, I can do latex(foo) to get LaTeX code. Is there an inverse to that function? Frequently, I do a calculation in Sage and get something complicated. I find it easier to look at when typeset by TeX, so I call latex(), paste th

[sage-devel] Re: LaTeX code to Sage expression?

2011-05-13 Thread Jason Grout
On 5/13/11 6:00 AM, Bruno Le Floch wrote: On 5/13/11, Jason Grout wrote: On 5/12/11 11:38 PM, Dan Drake wrote: If I have a Sage expression, I can do latex(foo) to get LaTeX code. Is there an inverse to that function? Frequently, I do a calculation in Sage and get something complicated.

[sage-devel] Re: LaTeX code to Sage expression?

2011-05-14 Thread Jason Grout
On 5/14/11 7:57 AM, Bruno Le Floch wrote: Should we contact David Cervone on this? I emailed Davide and sent him the link to this thread the other day. There may be more developments from when he may have looked at it, though. Thanks, Jason -- To post to this group, send an email to sage-

[sage-devel] Re: LaTeX code to Sage expression?

2011-05-14 Thread rjf
Look at http://moralfiber.org/eylon/berkeley/cs282/ to see a paper, Parsing Mathematics Typeset in TeX that successfully parsed many many formulas from Gradshteyn and Rhyzik, a table of integrals. The result was Lisp, which presumably could be Maxima. If you have a result in Maxima, presumably Sa

[sage-devel] Re: LaTeX code to Sage expression?

2011-05-14 Thread Jason Grout
On 5/14/11 10:25 AM, rjf wrote: Look at http://moralfiber.org/eylon/berkeley/cs282/ to see a paper, Parsing Mathematics Typeset in TeX that successfully parsed many many formulas from Gradshteyn and Rhyzik, a table of integrals. The result was Lisp, which presumably could be Maxima. If you have

[sage-devel] Re: LaTeX code to Sage expression?

2011-05-14 Thread rjf
It is possible to define a a program that will take a single language and produce from it either TeX, Lisp, Sage, Mathematica, Maple, Maxima, MathML, etc. That does not solve the problem of taking some random TeX formula, not using that language of macros etc, and converting it into a CAS formula.

[sage-devel] Re: LaTeX code to Sage expression?

2011-05-16 Thread rjf
To follow up on my other posts in this thread, the code written by Eylon Caspi for a class project, to translate from TeX to (lisp) is now in http://www.cs.berkeley.edu/~fateman/papers/parsetex-public.tar There are files in this project which we used which we cannot publish because the copyright i

[sage-devel] Re: LaTeX code to Sage expression?

2011-05-16 Thread Stephen Nuchia
RJF's point is the one that has been on my mind as I try to come up to speed on this discussion. TeX formulae are written to generate some graphical effect; their algebraic structure is some combination of accident and good style, not anything that the language forces on the author. You can't exp

[sage-devel] Re: LaTeX code to Sage expression?

2011-05-16 Thread rjf
On May 16, 8:10 am, Stephen Nuchia wrote: ... > > I have a dream of being able to write math in LaTeX and have "the > system" "just know" what I'm talking about, Can you pick up any journal in any scientific discipline and read the mathematical formulas and just know what the author is talking

Re: [sage-devel] Re: LaTeX code to Sage expression?

2011-05-13 Thread Bruno Le Floch
On 5/13/11, Jason Grout wrote: > On 5/12/11 11:38 PM, Dan Drake wrote: >> If I have a Sage expression, I can do >> >> latex(foo) >> >> to get LaTeX code. Is there an inverse to that function? >> >> Frequently, I do a calculation in Sage and get something complicated. I >> find it easier to loo

Re: [sage-devel] Re: LaTeX code to Sage expression?

2011-05-13 Thread Dan Drake
On Fri, 13 May 2011 at 07:00AM -0400, Bruno Le Floch wrote: > Anyway, give me some examples, and one or two weeks, and I'll try to > produce a prototype. That's the kind of answer I was hoping for! "Give me your problem, and I'll find a solution for you." Excellent! :) Here's what I was working w

Re: [sage-devel] Re: LaTeX code to Sage expression?

2011-05-14 Thread Bruno Le Floch
@Mike: I couldn't find precise info about the cadabra TeX input, but I found odd things: "x^{2x+1}" is interpreted as "x^{2+x+1}". I may be misunderstanding something, though. @Dan: I just had to add the rule ")(" => ")*(" that I had forgotten yesterday, and here is what I get: (((x-1)*(x**(4)*(1

Re: [sage-devel] Re: LaTeX code to Sage expression?

2011-05-14 Thread Bruno Le Floch
> http://moralfiber.org/eylon/berkeley/cs282/ Thank you, this was an interesting read, which motivates me to revise my current approach slightly. I think that I need to keep more information in a first pass, in order to correctly handle subscripts and superscripts. I still don't know how to place

Re: [sage-devel] Re: LaTeX code to Sage expression?

2011-05-14 Thread daly
Since TeX is turing complete and allows macros, would it be possible to create a set of macros that are not ambiguous? For instance, an integral macro that specifies the limits and differential variable? \integrate{0}{\infty}{r}{sin(\theta)} In this case it seems to me that the latex macros would