Math typesetting for inputs in the notebook

88 views
Skip to first unread message

Yukun

unread,
Mar 18, 2012, 2:46:28 AM3/18/12
to sage-...@googlegroups.com
Hi all,

I'm a 1st year CS student interested in doing a GSoC project this summer. I played around with the Sage notebook, and I think it would be convenient if math typesetting is available for input (like in mathematica), as it'll make it much easier to input long and complicated functions. To implement this, I'm thinking of introducing a typesetting toolbox into the the notebook UI. It'll probably be more of a change in the front-end; when evaluating expressions with typesetting, they'll first be converted back to the current input form.

Yukun

Dima Pasechnik

unread,
Mar 18, 2012, 4:41:11 AM3/18/12
to sage-...@googlegroups.com
For most people in this group, "math typesetting" means TeX/LaTeX typesetting. It is a de fact standard among mathematicians. Then, math notation is typically much less verbose than code in programming language. E.g. the integral sign might mean different things, depending on context.
Then, it normally helps to split long and complicated functions into short and easy ones. From my experience with Mathematica, the feature you describe would be useful for entering indices of vectors, sums, etc, but not much more than that.

Johan Grönqvist

unread,
Mar 18, 2012, 6:07:06 AM3/18/12
to sage-...@googlegroups.com
2012-03-18 07:46, Yukun skrev:
> I played around with the Sage notebook, and I think it would be
> convenient if math typesetting is available for input (like in
> mathematica), as it'll make it much easier to input long and complicated
> functions.

I will not take part in the GSOC discussion, so this message should in
no way be read as an opinion on what might be a reasonable GSOC project
scope. As a sage-user I can see the usefulness of mathematica-style
input in three ways (from my perspective):

1) Color coded hints: Something along the lines of having function
arguments in one color (or style), symbolic variables in a second color
(or style), most things in a third color (or style) and finally
undefined names in a fourth color/style (good for spotting typos).

2) Readability of large expressions involving, e.g., fractions and lots
of parentheses.

3) Using tensor notation in a comfortable way. Tensor usage in
Mathematica can be accomplished with both upper and lower indices and it
is possible to use pattern-matching on upper and lower indices
separately in replacement-rules.

A fourth input-help would be syntax highlighting of python (and possible
other) code, but according to some mailing list, that was considered and
discarded for performance reasons.

It sounds like you are primarily targeting number 2, is that a correct
reading?

Regards

Johan

William Stein

unread,
Mar 18, 2012, 9:37:31 AM3/18/12
to sage-...@googlegroups.com

See http://trac.sagemath.org/sage_trac/ticket/9585

>
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Yukun

unread,
Mar 18, 2012, 4:11:34 PM3/18/12
to sage-...@googlegroups.com
That's a correct reading, I'll be primarily be targeting the 2nd point about improving the readability of large expressions, and I believe math typesetting will also make such inputs easier. Your first point about color coding arguments is also something that I could work on.

Yukun

unread,
Mar 18, 2012, 4:14:13 PM3/18/12
to sage-...@googlegroups.com

That ticket pretty much covers what I want to implement; do you think that is suitable for a GSoC project?

Jason Grout

unread,
Mar 19, 2012, 6:39:37 PM3/19/12
to sage-devel, sage...@googlegroups.com, Davide P. Cervone
On 3/18/12 4:14 PM, Yukun wrote:
> That ticket pretty much covers what I want to implement; do you
> think that is suitable for a GSoC project?

My guess is that a good javascript equation editor would be a good
project. I'd suggest asking Davide Cervone if he would mentor the
project. As the ticket points out, Davide wrote Mathjax keeping in mind
the things needed for an equation editor. Davide had a student that
worked on an equation editor at one point.

Davide: Sage has been accepted as a mentoring organization for the
Google Summer of Code program. A student asked about doing a Google
Summer of Code project implementing a javascript equation editor [1],
like http://www.math.union.edu/~dpvc/talks/2006-12-08.IMA/editor.html
(at least, that's what I think the student is talking about). Can you
give us an idea of how much work it would be, and what level of
experience is necessary to do such a thing over a summer? Also, would
you possibly be willing to mentor such a project in the summer if a
well-qualified student applied?

Thanks,

Jason

[1]
http://groups.google.com/group/sage-devel/browse_thread/thread/318f154094736177#

Davide P. Cervone

unread,
Mar 20, 2012, 5:02:35 PM3/20/12
to Jason Grout, sage-devel, sage...@googlegroups.com
Jason:

As you know, I have done a lot of thinking about interactive math
editors, and when I estimate how long it would take me to write what I
consider a descent editor, it is on the order of a month and a half to
two months of full-time work. You would need someone with experience
in object-oriented programming, and cross-browser javascript coding
(particularly familiar with event handling). As you know, I had a
student work on this in the past, and we spend a full year on it and
still didn't have a finished product. I do not know the student who
has proposed the project, so I can't tell you if he or she can
accomplish the task, but my experience is that this is not a summer
project for most students. Having an almost-but-not-quite-finished,
or worse yet, a buggy editor will be worse than having none at all.
This is also something that will need support into the future
(especially as new versions of browsers come out, since this is
closely tied to one of the more touchy aspects of javascript -- event
handling), so I am a bit concerned about the code being written and
then slowly degrading over time. As for mentoring the project, I'm
afraid that I am already booked up this summer and could not in good
conscience take on advising a student on a project of this magnitude.

I know that none of that is what you wanted to hear, but that is my
opinion. On the other hand, it is still something I would be
interested in working on. If you have some cash to throw at it, we
should talk. :-)

Davide

Yukun

unread,
Mar 22, 2012, 10:07:25 PM3/22/12
to sage-...@googlegroups.com, Jason Grout, sage...@googlegroups.com
In terms of my coding experience, I know Python and Java, but I haven't had any experience with javascript yet. From what you've said, I guess this project won't be suitable for me.

rjf

unread,
Mar 23, 2012, 1:06:45 AM3/23/12
to sage-devel

I assume the idea is to use selecting from menus/palettes, since that
is the
alternative to keyboard input in Mathematica.

I know of no evidence that this makes it easier (or faster) to input
long and
complicated expressions. Do you?

Studying how to use the mathinput panel (free, in windows) as a
handwriting front-end to
Sage could be done, though I think handwriting, suffers from "demo"
syndrome. Easy
to build a demo, impossible to deploy for real. Or to use spoken
input, which is, I think
more promising.

RJF


kcrisman

unread,
Mar 23, 2012, 8:51:36 AM3/23/12
to sage-devel


On Mar 23, 1:06 am, rjf <fate...@gmail.com> wrote:
>  I assume the idea is to use selecting from menus/palettes, since that
> is the
> alternative to keyboard input in Mathematica.
>
> I know of no evidence that this makes it easier (or faster) to input
> long and
> complicated expressions. Do you?

Maple made a big point of something similar a few years back with the
addition of lots of contextualized stuff. My sense from a lot of
student interaction on this is that palettes make it easier to get
started, because one is already familiar with the visual form of the
formulas, as opposed to the somewhat steep LaTeX (or other) learning
curve. My feedback has also been that once people realize that LaTeX
is not really that hard, they totally abandon things like the MS
Equation Editor. But you have to have the need/desire to actually do
enough formulas to make that worthwhile. I don't see why having an
optional palette in the notebook would be a problem, from that
standpoint. Whether it would be really effective is a separate
question.

> Studying how to use the mathinput panel (free, in windows) as a
> handwriting front-end to
> Sage could be done, though I think handwriting, suffers from "demo"
> syndrome.  Easy
> to build a demo, impossible to deploy for real.  Or to use spoken
> input, which is, I think
> more promising.

Probably, and it would be cool. Does anyone know what e.g. Dragon
does for equations, if anything? Can Siri handle formula input? Just
wondering.

Jonathan

unread,
Mar 24, 2012, 9:39:53 PM3/24/12
to sage-...@googlegroups.com
I agree that having a palette or menu (I think palette is better) entry is a good way to lower the entry barrier.  I think the goal should be to have entry of common expressions (derivatives, integrals, matrices, fractions, exponents and square roots top my list) available from the palette. They should be translated by the Javascript into normal Sage functions.  Once users get used to the pythonic function syntax, I doubt they will make much use of the palette, except for generating typeset expressions.

Jonathan

Dima Pasechnik

unread,
Mar 25, 2012, 1:52:34 AM3/25/12
to sage-...@googlegroups.com
On 2012-03-25, Jonathan <gu...@uwosh.edu> wrote:
> ------=_Part_1580_10983212.1332639593822
> Content-Type: text/plain; charset=ISO-8859-1

this probably should be an extension to tinymce, the js editor now used
to input tekst cells.

>
> Jonathan
>

P Purkayastha

unread,
Mar 25, 2012, 4:39:22 AM3/25/12
to sage-...@googlegroups.com
something like this? 
 

>
> Jonathan
>

Reply all
Reply to author
Forward
0 new messages