Mathematical Formulae Related Tasks (ma)

The following tasks will be covered in this chapter:

Task ma-1: Input a formula and see it

This task describes the simple input of a polynomial within the formulæ, their preview in the web-browser, and the usage of their added value presentation

Prerequisite:

Task steps

  • open jEditOQMath and an OQMath file there, e.g. first.oqmath within the collection you now have
  • find a CMP element inside there, that is, find the place in the text right after <CMP> (maybe with a language attribute)
  • inside there, but not between two $ signs, we can now insert our expression, click to put the cursor
  • input $
  • input the formula, for example x^3+3/x^5+3x^2
  • close the math expression by inserting $ again
  • save your file (press the pen or invoke C-S)

  • click the AntFarm tab on the left

  • select collection, ActiveMath Publishing build file, press the running man, wait till it says `BUILD SUCCESSFUL
  • go to your web browser and there to your ActiveMath
  • open the book Complete Recbook
  • see the item you just enriched there
  • if you do not find it, redo the steps after doing the task cont-2

  • you can now hover with your mouse around this polynomial and let the sub-term and tooltips be shown

  • if you do not see the tooltips, you have probably been reported a reference error, that is, the symbols are not referenced explicitly enough
  • go back to jEditOQMath, find, towards the top of your file, the start of the theory element, put your cursor there right after it
  • invoke OQMath > Generate Imports, this will take a bit of time then will insert a few lines with suggested imports (and warnings for ambiguity)
  • now go back to your book page, see the polynomial with the tooltups

  • you can click on a sub-term, see the term popup and click Search for term (only using Mozilla family of browsers)

  • your item should appear as one of the results of the search, you may need to Generalize to all items, close the search tool
  • in ActiveMath book page, invoke Tools > Function Plotter
  • an applet pops-up with a graph pop-up

  • hovering back on your formula, click again to get the term-menu

  • invoke Drag term
  • a yellow box is drawn around the term, drag it into the window of the plotter applet, on the applet
  • the plotter should now display the graph of your function as well as the (reformulated) function

task ma-1: video of math input and enjoy

This video follows the task ma-1.

You can also download this video (8Mb), e.g., to provide to VLC.

Task ma-2: Create an OQMath notation for meter

This task describes the identification of an appropriate symbol and declaring its notations for input in QMath.

Prerequisite:

Task steps

  • we first need to find a symbol that satisfies our goals, a symbol that denotes meters for this we need to follow the (future) task identification-of-the-symbol which is not fully implemented, it’d be something such as

    • go in your web-browser, open the ActiveMath main menu, make sure you are logged-in as an author
    • open the search tool, enter the string id:metre (we search for items having an id containing the characters metre)
    • the first result should be a symbol with title metre (or an equivalent translated)
    • open this first result, get a little description, click the more link below
    • get the theory name, collection-name, and id-name
  • we now know that we wish to input OMS elements pointing to the symbol metre of the theory unitsmetric1_ of the collection openmath-cds (a rendering and more info can be seen in your ActiveMath, can be seen on the official demo or can be seen in the OpenMath website. Let us attach the input m when in QMath math-mode, to this symbol.

  • open, inside the oqmath directory, the file notations.qmath (this file is the center of all notations for QMath in the default collections)
  • add, at the very end of this file, the following line:

    Symbol: m SYMBOL "units_metric1:metre"

which will indicate to QMath that that letters m will be translated to<OMS cd="units_metric1" name="metre"/>. It also tells QMath that this symbol is not an operator to be applied somewhere.

  • let us type such into the item hello-world inside first.oqmath. Please open this file, find the item, then find, inside it, the closing-tag </CMP>
  • go to jEditOQMath, in the file first.oqmath
  • place the cursor just before the </CMP>
  • right before this insert the following lines:

    <br/>This is a metre: $m$

    <br/>This is two-and-a-half metres $2*m$ which is $2*x$ where $x$ is a meter.

  • save your file (press the pen or invoke C-S)

  • click the AntFarm tab on the left
  • select collection, ActiveMath Publishing build file
  • press the running man
  • wait till it says `BUILD SUCCESSFUL
  • go to your browser
  • open the book Complete Recbook
  • see your axiom there, find the last lines and see the two occurrences of m
  • please hover your mouse of the m, some occurrences show the right tooltip
  • please also note the fact that 2m shows without a dot whereas 2x does, this is an effect of the notations’ prototypes

Task ma-3: creating a symbol and writing a presentation-notation

This task describes the introduction of an angle symbol along with its input (QMath) notation as well as its presentation.

Prerequisite:

Task steps

  • let us first declare the symbol that interests us
    • use jEditOQMath, open first.oqmath and put your cursor right before </theory>
    • open, on the left, the tab Templates tree then click the Symbol template
    • we now fill the gaps (aka the template zones) for the symbol, give it the id angle
    • invoke Go to next template zone (CS-g), fill in the child-text of the CMP element which is the description of the symbol, e.g. This symbol has three arguments and returns the angle between the three points, centered at the middle point
    • invoke Go to next template zone, fill in the child-text of the commonname element, this will be the title and tooltip of this symbol, e.g. angle between three points
    • now first edit the notations.qmath file by adding the following line at the end then save notations. This will add a QMath notation for our symbol.

Symbol: angle APPLICATION 'my_first_theory:angle'

  • now we complement the presentation of this symbol, back into first.oqmath right after the </symbol> element

    • invoke CS-g again, enter the id of the symbolpresentation element, for example angle_pres
    • CS-g again, the for attribute is the target of our notations, the symbol id, i.e. angle, this will show as the underlying semantic of our presented symbol (e.g. as giving the text of the tooltip)
    • under the notation element, put two children, an OpenMath expression (or a QMath) and a MathML-p expression
    • the first template-zone is the QMath expression that is a typical notation. In our case, it would be $angle(A,B,C)$
    • the second template-zone is the MathML-expression for it. In this case, we need to enter simply a row of elements with the angle character as first, in MathML this is said as: <math><mrow><mo>∠</mo><mi>A</mi><mi>B</mi><mi>C</mi></mrow></math> (note the character between <mo> and </mo, it is the angle unicode character of number hex 2220.
    • now let us try to use this, copy and paste the following example using it after the </symbolpresentation> tag:

    <example id="angle_exp" for="angle"> <metadata><Title>Angle example</Title></metadata> <CMP> An example of angle is $angle(A,B,C)$. </CMP> </example>

  • save your file (press the pen or invoke C-S)

  • click the AntFarm tab on the left
  • select collection, ActiveMath Publishing build file
  • press the running man
  • wait till it says `BUILD SUCCESSFUL
  • go to your browser
  • open the book Complete Recbook
  • see the symbol element within the book as well as the example