Sei sulla pagina 1di 2

MSOR Connections Vol 7 No 4 November 2007 – January 2008

DragMath – a Java applet for


inputting mathematics
Chris Sangwin
School of Mathematics, University of Birmingham, c.j.sangwin@bham.ac.uk

Traditional written This provided the motivation for the DragMath project [3]:
mathematical notation takes http://web.mat.bham.ac.uk/C.J.Sangwin/dragmath/
advantage of a rich set of special
DragMath is a Java applet which is an “equation editor”
symbols, together with their relative
through which the user builds up mathematical
size and position on a two dimensional
expressions in a traditional two dimensional way by
page. The utility of this is obvious, as many
dragging and dropping appropriate components into the
have commented. “Examples of the power of a
desired position. A simple parser is included so that parts
well contrived notation to condense into small
of an expression can also be typed. The applet can also be
space, a meaning which would in ordinary
started with an initial expression which is parsed in this
language require several lines or even pages,
way. This parsing is not so easy: mathematical notation
can hardly have escaped the notice of most
contains some ambiguities, such as the classic example of
of my readers” ([1], p 330). This quotation
deciding whether “x(t+1)” is multiplication or function
points to the communicative power of a
application. Details of this, and other problems, are
good notation, but in addition to this, few
discussed in [2].
practitioners of mathematics would dispute
the ability of a well-designed notation to Once the user is happy, the expression can be exported in
aid calculation and thought. Regardless of a correctly formed syntax. DragMath can export in LaTeX,
what we might think about these printed presentation MathML, Maple syntax and Maxima syntax.
and written conventions they have been The results are either copied to the clipboard ready to be
embedded, probably irreversibly in the short pasted elsewhere or JavaScript obtains the output from
term at least, by usage. People who need the applet for use in a web-based application. DragMath
to enter a mathematical expression into a has been designed so that it is relatively easy to create a
computer naturally often expect the interface
to correspond with these conventions.
“format file” which contains details of the way in which an
One solution to this problem is to require
expression should be exported. This would allow a user
the use of a strict, unambiguous syntax. A
to modify existing formats to fit their preferences and
surprising variety of direct algebraic syntax
needs, or to create a new format entirely. The applet does
choices have been made in mainstream
not need to be recompiled to use new output format files.
computer algebra systems even at the
Expressions can be saved and re-loaded in DragMaths’s
very elementary level (e.g. [2]). These
own format.
differences may appear to be trivial to the
expert but to those with less experience Although mathematics is less dependent on language
they can be very problematic. Whatever the than many things, the applet loads a language file which
benefits or drawbacks of a non-standard, makes it possible to translate DragMath into other
especially precise syntax, such a syntax has languages. Most of the features of DragMath can be
definite disadvantages if students taking activated using the JavaScript interface to make it as
tests, or carrying out online assessments, easy as possible to include DragMath within a webpage.
are required to use it. Where the syntax Indeed, DragMath has been incorporated into the Moodle
uses conventions different from those text editor in this way.
underlying standard notation, the risk is that DragMath originated as a final year computer
students’ answers will be graded ‘incorrect’ science project by Alex Billingsley at the University of
for purely syntactical reasons, leading to Birmingham. This project demonstrates how, with a little
students failing, as it were, on a technicality. extra work, a final year project can provide something of
My experience is that students find this real value to the wider community. The applet and source
especially annoying and de-motivating, to code have been released under the open source General
say nothing of how the assessment itself Public Licence (GPL) and so it can be freely used and
may be distorted by this effect. Hence, for modified by others.
some applications a “drag and drop” equation
editor can be very helpful.
34 DragMath – a Java applet for inputting mathematics – Chris Sangwin
MSOR Connections Vol 7 No 4 November 2007 – January 2008

References
1. Babbage, C.: 1827, On the influence of signs
in mathematical reasoning, Transactions of the
Cambridge Philosophical Society II, 325–377.
2. Sangwin, C.J. and Ramsden, P.: 2007 Linear
syntax for communicating elementary
mathematics. Journal of Symbolic Computation,
42(9), 902-934.
3. DragMath project website:
Fig 1 – Example of DragMath in action
http://www.dragmath.bham.ac.uk/
[Accessed 21 Sep 2007].

DragMath – a Java applet for inputting mathematics – Chris Sangwin 35

Potrebbero piacerti anche