=Paper= {{Paper |id=None |storemode=property |title=Implementation of dynamic algebra in Epsilonwriter |pdfUrl=https://ceur-ws.org/Vol-1010/paper-20.pdf |volume=Vol-1010 |dblpUrl=https://dblp.org/rec/conf/mkm/Nicaud13 }} ==Implementation of dynamic algebra in Epsilonwriter== https://ceur-ws.org/Vol-1010/paper-20.pdf
                     Implementation of Dynamic Algebra in Epsilonwriter
                                                  Jean-François Nicaud, Christophe Viudez
                                             Aristod, 217 rue de Paris, 91120 Palaiseau, France
                                            jeanfrancois.nicaud@laposte.net – cviudez@free.fr
                                                       http://www.epsilonwriter.com


         Abstract
         Dynamic Algebra is “doing algebraic calculations on a computer by direct manipulation”. We have
         implemented Dynamic Algebra in the Epsilonwriter application. For that purpose, a “Theory of
         Movements in Formulas” (TMF) has been elaborated. It describes, in a precise context, how we can
         move a sub-expression in a formula with preservation of equivalence. It has been implemented in
         Epsilonwriter for the Pedagogical Dynamic Algebra mode. Dynamic Algebra in Epsilonwriter has
         other modes with more complex actions of different classes: equivalent drag & drop internal to a
         formula, external drag & drop, on click calculations and rewriting rule application. This makes
         Epsilonwriter a very powerful and flexible calculation tool for step by step calculations; and a tool
         able to provide explanations. Epsilonwriter contains different options to control the possible
         movements and the feedback on them. It has been developed to help students learn formula
         structure and transformations, and to help every user produce step by step explained calculations.

        1. Introduction
This idea of Dynamic Algebra (Nicaud & Mercat 2012) as doing algebraic calculations through direct
manipulation, similarly to Dynamic Geometry as transforming figure representations through direct
manipulation, is about twenty years old. But the previous attempted prototypes of Dynamic Algebra systems
have not been successful. They implemented equivalent drag & drop which consists in moving a sub-
expression from a location of a formula to another one in order to have an equivalent formula. Of course, this
is possible for some locations, not for all. Tables 1 and 2 show examples of equivalent drag & drop.

                                         Initial formula               Transformed formula




        Table 1. Examples of basic equivalent drag & drop. The moved sub-expression is red. Here, the moved
                 sub-expression is almost unchanged (it just gets a minus sign in the second example).

                     Displayed on the screen                                                 Gesture to get the next line
(          )(        )           (              )                                is dragged in front of (     )

    (        )(          )           (              ) Factoring HCF:         (          ) is dragged in front of the expression

(            )( (            )           ) Factorizing                           is dragged into (      )

(            )(                      )     Expansion                              is dragged over
(            )(          ) Adding like terms                                     is dragged in front of the expression
    (           )(       ) Factorizing


Table 2. Examples of algebraic calculations made with equivalent drag & drop as performed by
Epsilonwriter for one of the modes and display options. The left column contains the part performed by the
system and displayed on the screen, i.e., the calculated expressions and the explanations; the right column
describes the gesture made by the user to get the next line. Here, it is not “basic” drag & drop, the moved
sub-expression is not “almost unchanged” (it sometimes provides a HCF, it sometimes disappears).
                                                                         1
Previous prototypes of Dynamic Algebra systems performed the equivalent drag & drop like in table 1 and 2,
but without explanation. In our opinion, they have had no success because:
 - The transformations were well done in expected situations, but it was difficult to obtain what you really
     wanted. The initial expression was instantly transformed, so there was some kind of control loss.
 - No explanations were provided about the transformation done.
 - The field of application was rather limited.

We have implemented Dynamic Algebra in Epsilonwriter (Nicaud & Viudez 2009). In designing and
implementing Dynamic Algebra, we aimed at facilitating the treatment of formulas on computers, especially
ease the production of step by step calculations driven by transformation rules and requested by gestures.
Our two main goals are: (1) helping students to learn formula structure and transformations; (2) helping
every user to produce step by step explained calculations.

Beside the equivalent drag & drop we have introduced above, which is internal drag & drop (all happens in a
single formula) the other classes of actions of Dynamic Algebra in Epsilonwriter are:
(1) External drag & drop as dropping a formula on another formula. A typical example is applying a
                                                                   (    )
substitution, e.g., dropping {            on         to get         (    )
 (2) On click calculation, e.g., selecting and applying a Ctrl+Click on (          )       (      ) in order to
add like terms and get (         )
(3) Rewriting rules, e.g., applying             to             to get

For designing the equivalent drag & drop of basic elements as introduced in table 1, we have developed the
Theory of Movements in Formulas (TFM) which defines a correspondence between mathematical properties
of a formula and gestures which are allowed on it in the framework of basic movements. This theory is
presented in section 2. Section 3 describes its implementation in Epsilonwriter and section 4 the internal drag
& drop beyond TMF. Section 5 is devoted to external drag & drop and on click calculations, and section 6 to
rewriting rules.

This paper describes dynamic elements on a static paper like support. Demos can be seen at
http://www.epsilonwriter.com/en/top10demos/ to have a better view of the dynamic aspects.


    2. The Theory of Movements in Formulas (TMF)
The Theory of Movements in Formulas (TMF) (Nicaud, 2013) is based on the possibility to move sub-
expressions in formulas respecting the equivalence between the starting formula and the transformed
formula. The question to which TMF replies is the following:

          When can we move a sub-expression from here to there, getting an equivalent expression?

As we are talking about algebraic expressions, a sub-expression is not just something which is ‘put there’ in
a formula. It is attached to the rest of the formula by means of an operator (+, –, …). This gives to the sub-
expression a status with regard to its parent sub-expression. For instance, in the expression                 ,2
has a multiplier status in                      (multiplier of       ), 3 has an adder status in
        (adder of ), 5 has a divisor status in (divisor of ).
TMF identifies three different statuses: adder, multiplier and divisor (no status is attached to the subtraction,
      is seen as the sum of and– ), and considers the movements of a sub-expression u through operators
(+ –     / and relations) which preserve equivalence. The internal question is more precisely the following:

Is it possible to move from here to there, being unchanged or changed to               , the rest of the formula
being unchanged except possibly the orientation of an inequality?

For instance, in the equation         , the sub-expression can be considered as an adder in the left-hand
side (being viewed as         ); it can be moved to the right-hand side, keeping adder status and being
                                                       2
changed to     , coming to               . It can also be considered as a multiplier (being viewed as             ) and
be moved to the right-hand side, remaining unchanged and getting the divisor status, obtaining                .
TMF is based on three classes of movements which can be described as follows:
(1) Moving at the same level, e.g., application of the commutative law;
(2) Entering into an expression, e.g., in       can enter into the numerator as a multiplier, providing       ;
(3) Exiting an expression, e.g.,       in    can exit the numerator as a multiplier, providing   .
Elementary movements can be combined, e.g.,                  in           can move to get                . This is a
combination: (1)     exits           as multiplier, (2)   moves to the right as divisor of       ; (3)    enters the
denominator of as multiplier of 3 .
TMF also considers movements of minus sign taking into account that a minus sign can be viewed as a
multiplier –1. For example, a minus sign can exit the numerator of getting because the multiplier
                             (   )
can exit the numerator of             getting (   )

For the fundamental operators + × / and relations, within the considered status and classes of movements,
TMF identifies 74 cases and 56 of them produce correct transformations, which corresponds to 76% (Nicaud,
2013). This high rate lead us to think that ‘gestures’ which correspond to the movements of TMF can be
considered as meaningful objects of algebraic manipulations.

This result can be considered as a part of the explanation of mathematics education observations (Kieran,
2007; Wittmann et al., 2013) which highlight that students (in particular students doing correct calculations)
use gestures: ‘gestures and ambiguous speech of moving are the only algebra used at that moment’.


    3. Implementation of TMF in Epsilonwriter
Epsilonwriter is a multi-document “text and math” editor. It provides a smooth editing, an easy
communication and publishing of math and science contents (Nicaud & Viudez 2009), see figure 1.




           Figure 1. The Epsilonwriter window with the “Home” panel and examples of formulas.

From its beginning, Epsilonwriter contains a structural drag & drop of formulas which proposes several ways
to drop a sub-expression u, i.e., several operators (+ – …) to attach u to the formula at the drop position.

                                                            3
Dynamic Algebra in Epsilonwriter is a rich system with several options. The Pedagogical Dynamic Algebra
mode implements the TMF. The equivalent drops of the TMF are added to the structural drops, see figure 2.




Figure 2. The working expression is on the top left of the figure. 4 has been selected and dragged to the
right. As the mouse is just before 3, a cursor is displayed on that location and seven drop options are
displayed in a popup (the green ones correspond to equivalent drag & drop of Dynamic Algebra). If the user
keeps on dragging, the popup is replaced by another one or disappears. Note that Dynamic Algebra items of
the popup contain both the result of the action and an explanation.

The presentation on the screen of the application of a drop depends on display options. With Explain
calculations on the same line (the line of the result), the first proposition of figure 2 produces:

                   Addition to both sides of

With the option Explain Dynamic Algebra in a table the result is:

                               Addition to both sides of


With the option Describe the dynamic algebra gesture, result is:

                               Gesture: Additive move to the other side, changing sign
                               Explanation: Addition to both sides of


It is possible to display neither explanations nor gesture descriptions. It is also possible to have the initial
formula replaced by the result instead of having the result below.

TMF contains correct and incorrect movements. In the Pedagogical Dynamic Algebra mode, the user can get
the indication of the absence of a TMF correct movement, see figure 3.




Figure 3. An incorrect attempt of movement according to TMF. To go to the right of 5, the sub-expression 3
has to exit from    which is possible with the multiplier status. Then it has to exit from           which is not
possible with its multiplier status; so the popup displays a message to notify there is no basic exit.

    4. Internal drag & drop beyond TMF
The Pedagogical Dynamic Algebra intends to help students to understand the structure of formulas and the
possible basic movements. The other modes (light, medium, strong) of Dynamic Algebra in Epsilonwriter
contain additional possibilities in order to allow more calculations produced with gestures. The main ones
are described in table 3. For these modes, there is no indication of impossible movements. The display
options are identical to the Pedagogical Dynamic Algebra ones.



                                                       4
                           Description                                                             Example

Factorizing by exiting a sub-expression from a sum                                     (               )

Factorizing a HCF by exiting a integer from a sum                                      (                   )

Expanding by entering a factor in a sum                            (           )

Expanding by entering an exponent in a sum                     (           )

Entering an exponent in an opposite or a product               (       )                   (       )

Entering an exponent in a fraction or a power                  (       )                       (       )

Additive exit from a numerator

Additive entry into a numerator
                                                               (       )                                       (   )
Addition of like terms                                                             (               )

Simplification in a fraction of like factors and minus signs

Simplification in a fraction with HCF

Completing the square by dropping        on                                        (               )

Decomposition of an equation             by dropping the
                                                                   (           )                               √       √
exponent 2 on the other side of =

Table 3. Main actions of internal drag & drop beyond TMF. The moved sub-expression is red. A blue sub-
expression indicates a sub-expression on which the moved sub-expression is dropped.


    5. External drag & drop and on click calculations

        5.1. External drag & drop

External drag & drop means dragging an expression and dropping it on another one, the two expressions
being separated, i.e., not being part of a same formula. For example, expression a is followed by a text
followed by expression b. In this case, pointing is different from internal drag & drop as there is no
destination cursor position but an entire expression as destination. So, during the drag, when the mouse
cursor is over the operator of the destination expression, the expression background is blue, indicating the
drop is possible. See figure 4.




Figure 4. On the left, {             has been selected, it appears with a yellow background. A drag has been
done and the mouse is over a + sign, thus the expression 3x+y+1 is selected (+ is its main operator) and
appears with a blue background. The substitution is proposed (not visible in the figure). By releasing the
mouse button at this time, the expression on the right is obtained.

Another kind of external drag & drop is the drop of a numerical expression a on an equality or inequality. In
this case, Epsilonwriter proposes an operation on both sides of the equality or the inequality among: add,
                                                       5
subtract, multiply and divide. The last two operations are only proposed for an inequality when a is constant
and not null.

Finally there is the drag & drop of an equality (or inequality) on another equality (or inequality) to add or
subtract side by side when the result of the operation is implied by the two equalities or inequalities.

            5.2. On click calculations

On click calculations mainly allows performing numerical calculations, additions of like terms and
multiplications of like factors. The domain of numerical calculations is chosen by the user with the options
menu. Currently, it may be the integer, decimal or rational numbers.

Two gestures allow performing a calculation click. The first one consists in selecting an expression or a sub-
expression and of doing a Ctrl+Click on it. Examples:
Selection of               and Ctrl+Click, result (calculation over the rational numbers).
Selection of (               )   (      ) and Ctrl+Click, result (      ) (addition of like terms).
Selection of (             )(     ) and Ctrl+Click, result (     ) (multiplication of like factors).

The second one consists of doing a Ctrl+Click on an operator to ask for calculating the expression of which
this operator is the main operator.
Example: In (         ) Ctrl+Click on +, the result is  (calculation over the rational numbers of       ).


            5.3. Solving quadratic and cubic equations

Epsilonwriter helps to solve quadratic and cubic equations thanks to Dynamic Algebra. First, it displays a
solving schema, see figure 5.



                                                                                                         (       √       )
{                                                                                   √
----------------------------------
                                                                                                 (                           )

                    √                   √                                                            (       √       )
        √                    √
                                                                                √
                  { }
                                                                                             (                                   )
----------------------------------
                                                                                                     (       √       )
                                                                                √

                                                                   {                         (                                   )
{
                               {            }                              {             }

Figure 5: Starting to solve a cubic equation with Epsilonwriter. The user selects the equation and makes a
Ctrl+Click on it. Epsilonwriter displays the above solving schema with Cardan’s formulas.

Then, Dynamic Algebra facilitates the calculations. In the case of the equation of figure 5, the user can
continue as follows. (1) drop {                     over                       getting                       ; (2) selection and
Ctrl+Click on the right hand side of this, getting                     ; (3) suppression of the useless schemas                      and
                                                           √               √
        ; (4) drop of                over       √              √               and drop of {         over the result providing


                                                                       6
             √             √                                                                 √         √
      √           √            ; (5) drop of this formula over   { } providing      {√           √             }.


All forms of cubic equations are handled. For                             , with        Epsilonwriter
suggests to divide both sides by a. For                           , with       it suggests a change of
variable             to make the degree 2 term disappear. Of course, quadratic equations are also handled.


       5.4. The calculation panel of Epsilonwriter

Dynamic Algebra in Epsilonwriter has several modes and options which are chosen using the calculation
panel, see figure 6. The Dynamic algebra mode allows choosing which movements are allowed and are
automatically calculated. Dynamic algebra: Pedagogical suits for basic learning goals and allows only the
basic movements of the TMF (it also provides the “no movement” messages). Other modes of Dynamic
Algebra progressively increases the number of movements allowed. The display options offer flexibility in
the display of explanations and allow choosing if the gestures are described or not.




Figure 6: Calculation user interface of Epsilonwriter. It contains: (1) the “numerical domain” menu (on the
left), and the “mode” menu (in the middle) to set the Dynamic Algebra behavior; (2) the options menu (on
the left) and two checkboxes to set the Dynamic Algebra feedback; (3) buttons to perform exact calculations,
approached calculations, to transform decimals into fraction and reverse and to duplicate a formula.

 All these modes and options can fit different use cases from didactical ones with clear steps and
explanations on gestures, to calculations of expert with fast expression change as soon as the mouse is
released. Preview of the result in the popup is a key feature: it gives a feedback to check that what will be
done is relevant with the user’s intent. Moreover on complex expressions, it gives a preview of what will be
the result and so can help in strategic decisions during the calculation.


    6. Rewriting
A rewriting rule is a formula like          which means a is (or can be) rewritten as b. Rewriting is a
fundamental sub-domain of computer science and is used in various contexts such as mathematical formula
processing, natural language processing… In algebra, we use them when we apply identities. Thus
            (       )(      ) is a rewriting rule for factorizing. The reverse rule is a rewriting rule for
expanding. In this notation, a and b are matching variables as they are used to be matched with any sub-
expression. For example,            matches the expression ( )        for the substitution                 .

Rewriting in Epsilonwriter is at its very beginning. It is implemented with the Find/Replace panel: Left part
of the rule is written in the “Find” field whereas the right one in the “Replace with” field.
                                                        7
Matching variables currently have to be indicated with a special operator that circles them, e.g., in
(the copy and paste mechanism replaces in Word the circle by a rectangle). In this example is a matching
variable that can match anything whereas b is a fixed letter that can only match . Table 4 shows examples
of rewritings made with Epsilonwriter.

Searched form      Rewritten form     Matched form         Rewriting obtained
                                               √                          √       √
  (        )                           (           )   (   )     (    )       (       )


                                                           (     )(           )


      (        )                           (       )


Table 4. Rewriting made with the search panel and the buttons “Find”, “Replace”, “Replace/Find”.

In the future, rewriting will be improved in Epsilonwriter. It will be possible to use the classical notation
       , to have sets of rules, to drop a rule or a set of rules on a formula.

      7. Conclusion
With dynamic algebra, Epsilonwriter bring virtual gestures to concrete UI movements and so add smooth
automatic calculations to formula editing. From a general point of view, we think that this will improve
significantly formula editing, especially because there is no wall between editing and calculating, no need for
a distinct UI and because the user can control precisely what the result will be. In terms of education, we
believe it can provide important assistance in the writing of reasoning by teachers and students, but it can
also promote the learning of algebra in helping students to know the correct actions and their justifications.

Epsilonwriter provides a rich dynamic algebra implementation and we will add new functions for square
roots, trigonometry and exponentials. Epsilonwriter is also more than a dynamic algebra dedicated software,
it is a very powerful document editor with lots of publishing and communication functions, like multi-
document editing, rich import and export possibilities. It also offers a chat and online multiuser shared
documents.

We hope that a growing community will use Epsilonwriter and join us to participate in the diffusion and the
evolution of Dynamic Algebra.

      8. References
Kieran, C. (2006). Research on the learning and teaching of algebra. In A. Gutiérrez & P. Boero (Eds.),
Handbook of research on the psychology of mathematics education (pp. 11-50). Rotterdam: Sense.
Nicaud, J.F. (2013). La théorie des mouvements dans les formules. http://epsilonwriter.com/TMF
Nicaud J.F., Mercat C. (2012). Algèbre dynamique, glisser-déposer par équivalence. Actes des Journées
mathématiques de l'Institut Français de l'Éducation (ENS de Lyon).
Nicaud J.F., Viudez, C. (2009). Epsilonwriter: implementing new ideas for typing text and math. In
Proceedings of The MathUI workshop 2009. Grand Bend, Ontario, Canada.
Wittmann, M.C., Flood, M.C., Black, K.E. (2013). Algebraic manipulation as motion within a landscape.
Educational Studies in Mathematics vol 82(2), pp 169–181.




                                                       8