W3C home > Mailing lists > Public > www-math@w3.org > May 2006

Re: How do I encode negative numbers in content MathML?

From: Charles Lyons <maths@mathsonly.com>
Date: Thu, 18 May 2006 13:47:20 -0700
Message-Id: <20060518134720.406BCB98@resin06.mta.everyone.net>
To: <juanrgonzaleza@canonicalscience.com>
Cc: <www-math@w3.org>

When I was working on a content MathML processor, it made sense to require that only the <minus /> be permitted, and that all numbers be positive. This meant that such things as -(-1) could easily be simplified by recognising the presence of two <minus /> elements (which could then simply be removed from the DOM and disregarded). Of course, an input parser can easily work with <cn>-1</cn> be recognising the - sign and turning it into <minus /> then <cn>1</cn> internally.

We had the same problem with complex numbers using the <cn> and <sep /> elements, and eventually decided just to use integers/decimals in <cn> and use <imaginaryi /> and <plus /> where necessary. This was more flexible in the long run and allowed for pure imaginary numbers with no parsing problems... I dislike using <sep /> anyway as its semantics depend on the type of number being parsed and aren't 'obvious' from the outset.

But in terms of writing documents, it is unimportant which form you take; any good parser should be able to cope with both, regardless of what internal model it uses.


--- juanrgonzaleza@canonicalscience.com wrote:

From: <juanrgonzaleza@canonicalscience.com>
To: <www-math@w3.org>
Subject: How do I encode negative numbers in content MathML?
Date: Tue, 16 May 2006 05:36:22 -0700 (PDT)

The chapter 4 of MathML 2.0 specification is far from precise at this point.

Moreover, the tutorial


recommends next code


to representing the negative of a variable, and recommends


for the negative of a number.

Whereas the next MathML tutorial



Although <cn>-37</cn> is valid, using minus is sometimes more clear.

<apply> <minus/>
<cn> 37 </cn>

What is the difference if any between both encodings?

What may be preferred? (I personally prefer unary usage of <minus/>)

Juan R.


http://www.easypost.com Anti-Virus & Anti-Spam Web Mail thats hotter than hot
Received on Thursday, 18 May 2006 20:47:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:27:37 UTC