- From: Robert Miner <RobertM@dessci.com>
- Date: Tue, 24 Apr 2001 10:14:56 -0500
- To: habelg@micro-intel.com
- CC: www-math@w3.org

Hi. Several folks have asked about handling units in MathML off the list. Here is a digest of some of the subsequent messages under a new subject line. --Robert ---------------------------------------- Date: Thu, 8 Feb 2001 12:36:00 -0600 From: Robert Miner <RobertM@dessci.com> > I am working on a business exchange XML DTD. Herefor I need to handel units. > I looked for units in the MathML Dokumentation, but could not find an > answer. > > May I can asked you : > > What's the best way to handle physical units in MathML ? As you discovered, MathML doesn't have any specific markup for units. Surprisingly, I don't think anyone has asked us about this before, though it does seem pretty obvious. I am forwarding your inquiry to the working group, but here are some thoughts. In presentation markup, it seems most natural to me to encode units as text, since from a certain point of view, they are informative comments about the preceding number, and also, that is most likely to produce the desired rendering: <mn>2</mn><mtext>cm</mtext> <mn>2</mn><mtext>m/dl</mtext> It would also work to include them directly in the <mn> element <mn>2 cm</mn> <mn>2 m/dl</mn> but this seems to be slightly agains the spirit of the <mn> element to me. In content markup, the situation is a little harder, since we need to encode the meaning of the units instead of just producing the proper rendering. One good possibility would be to use the 'type' attribute on the <cn> element: <cn type="cm">2</cn> This fits in quite well with the spirit of both the <cn> element and the 'type' attribute. However, this has the drawback that although the set of values permitted by the DTD for the 'type' attribute is open-ended, since units aren't pre-defined values, renderers won't generally know how to handle this. Perhaps in your application, this won't matter. In many situations, content MathML is transformed to presentation MathML using XSL for display, so it would just be up to your stylesheet to make sense of this use of the 'type' attibute. The other alternative, which I think I favor, would be to use a <csymbol> element to define units: <cn>2</cn><csymbol definitionURL="...">cm</csymbol> This seems to be cleaner to me, and has the advantage that the default rendering would at least be intelligible. Hope this helps. ---------------------------------------- From: "Stan Devitt" <jsdevitt@stratumtek.com> Date: Thu, 8 Feb 2001 14:27:29 -0500 A more conventional approach to units and one that builds on the existing MathML content infrastructure is to to use csymbols. A dictionary defining csymbols for standard units would be a natural follow on to MathML 2.0 This is so that the algebra of unit conversions and combinations, etc. all works out correctly for free. Notice that a product such as <apply><times/> <apply><times/><cn>2</cn> <csymbol definitionURL="units>cm</csymbol></apply> <apply><times/><cn>2</cn> <csymbol definitionURL="units>cm</csymbol></apply> </apply> has the right dimensionality of cm^2. and unit conversions follow naturally from equations such as <apply><equals/> <csymbol definitionURL="units">m</csymbol> <apply><times/> <cn>100</cn> <csymbol definitionURL="units">cm</csymbol> </apply> </apply> Unit conversion is then simply the systematic application of such identities to achieve a new normal form for the algebraic expression. This would be really ugly as an algebra of types. In a math application that focusses heavily on units, it may be appropriate to write all expressions in a normal form in which the units are clearly factored out, in which case you might write all expressions as: <apply> <csymbol definitionURL="...">UnitBasedExpression</csymbol> (numeric/algebraic expression for factor idenpendent of units) (units expresssion using same units csymbol dictionary as introduced above ) </apply> and then insisting that your applications that handle such expressions know how to display and/or simplify this unit specific "data structure.". Stan ---------------------------------------------- From the person originally asking the question Date: Fri, 9 Feb 2001 09:28:38 +0100 my solution : I divided my calculation completely into : - Formula : without any constants, only with variables <ni>,e.g. F = m * a - List of variables with units in MathML Style, using units as varibles, e.g. [m] = 1 * m I think, the best idea is the division of formula and varibles and in a second step varibles and numbers with units. ------------------------------------------------------------------ Robert Miner RobertM@dessci.com MathML 2.0 Specification Co-editor 651-223-2883 Design Science, Inc. "How Science Communicates" www.dessci.com ------------------------------------------------------------------

Received on Tuesday, 24 April 2001 11:15:06 UTC