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.

Thanks,
Charles.

--- 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

[http://cnx.org/content/m9008/latest/]

recommends next code

	  <m:math>
	    <m:apply>
	      <m:minus/>
	      <m:ci>x</m:ci>
	    </m:apply>
	  </m:math>

to representing the negative of a variable, and recommends

<m:math><m:cn>-1</m:cn></m:math>

for the negative of a number.

Whereas the next MathML tutorial

[http://www.pragma-ade.com/general/manuals/mmlprime.pdf]

says

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

<math>
<apply> <minus/>
<cn> 37 </cn>
</apply>
</math>
</blockquote>

What is the difference if any between both encodings?

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


Juan R.

Center for CANONICAL |SCIENCE)



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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 February 2010 06:12:58 GMT