- From: Jimmy Cerra <jimbofc@yahoo.com>
- Date: Thu, 25 Apr 2002 23:03:38 -0400
- To: "'Kamlesh Pandey, Noida'" <kamleshp@noida.hcltech.com>, <www-math@w3.org>
Here's my try at it: --- Since both versions look the same, then they have the same presentation markup: <?xml version="1.0"?> <math> <mrow> <mi>x</mi> <mo>=</mo> <mi>y</mi> </mrow> </math> However, you really want to distinguish the two versions. To do this, you need to add the semantics element: <?xml version="1.0"?> <math> <semantics> <mrow> <mi>x</mi> <mo>=</mo> <mi>y</mi> </mrow> <annotation-xml encoding="MathML-Content"> </annotation> </semantics> </math> --- A.) Now, I'm going to do the second one, where: > x=y ( Is x = y, which would return true or false) Well, the MathML spec says (in section 4.4.4.1): > The eq element is the relational operator 'equals'. > The eq element takes the definitionURL and encoding attributes, > which can be used to override the default semantics. > The equals element is an n-ary relation (see Section 4.2.3.2). > Example > <apply> > <eq/> > <ci> a </ci> > <ci> b </ci> > </apply> > If this were tested at a = 5.5 and b = 6 it would yield the truth > value false. Thus, the correct MathML-Content markup would simply be the above with a and b replaced with x and y, respectively. This means that the full MathML encoding will become: <?xml version="1.0"?> <math> <semantics> <mrow> <mi>x</mi> <mo>=</mo> <mi>y</mi> </mrow> <annotation-xml encoding="MathML-Content"> <apply> <eq/> <ci>x</ci> <ci>y</ci> </apply> </annotation> </semantics> </math> --- B.) Now I'm going to try doing the first equation, where you said: > x=y (meaning x is equal to y, which would assign value > of y to x upon evaluation) Here you could use the declare element to assign one variable to be the second. Again, according to the specs (section 4.4.2.8): > declare takes one or two children. The first child, which is mandatory, > is the object affected by the declaration. This is usually a ci element > providing the identifier that is being declared as in: > <declare type="vector"> <ci> V </ci> </declare> > The second child, which is optional, is a constructor initializing the > variable: > <declare type="vector"> > <ci> V </ci> > <vector> > <cn> 1 </cn><cn> 2 </cn><cn> 3 </cn> > </vector> > </declare> In the above example, the MathML-Content is specifying that V is the vector <1,2,3>. An interesting thing about this element is that there is no default rendering. Thus, in this case, the semantics element is needed to display the assignment. Here is the first equation you wanted: <?xml version="1.0"?> <math> <semantics> <mrow> <mi>x</mi> <mo>=</mo> <mi>y</mi> </mrow> <annotation-xml encoding="MathML-Content"> <declare type="real"> <ci>x</ci> <ci>y</ci> </declare> </annotation> </semantics> </math> C.) Here is your entire example in MathML. This is both the first and second put together (along with your words for fun): <?xml version="1.0"?> <math display="block"> <mrow> <mtext>
For example
</mtext> <semantics> <mrow> <mi>x</mi> <mo>=</mo> <mi>y</mi> </mrow> <annotation-xml encoding="MathML-Content"> <apply> <eq/> <ci>x</ci> <ci>y</ci> </apply> </annotation> </semantics> <mtext>  (meaning x is equal to y, which would assign value of y to x upon evaluation)</mtext> <mtext>
Vs.
</mtext> <semantics> <mrow> <mi>x</mi> <mo>=</mo> <mi>y</mi> </mrow> <annotation-xml encoding="MathML-Content"> <apply> <eq/> <ci>x</ci> <ci>y</ci> </apply> </annotation> </semantics> <mtext>  ( Is x = y, which would return true or false)</mtext> </mrow> </math> ^Can Anyone Back me up? --- Jimmy Cerra P.S. I'm writing this anyway, even though I just got an e-mail from the list (from Tim Bagot) who answered this for me. Oh, well. I'll send it anyway, since this shows you how to markup the content and presentation at the same time; although, you probably already know how to do that. I guess I'll just post it to cost the W3 money, then. ;-) -----Original Message----- From: www-math-request@w3.org [mailto:www-math-request@w3.org] On Behalf Of Kamlesh Pandey, Noida Sent: Wednesday, April 24, 2002 1:34 PM To: www-math@w3.org Subject: Assignment Vs conditions Hi How do I represent in MathML two different concepts namely assignment of one variable to other and checking equality of one variable to other. For example x=y (meaning x is equal to y, which would assign value of y to x upon evaluation) Vs. x=y ( Is x = y, which would return true or false) Can anyone give mathML syntax for both these cases? Regards Kamlesh
Received on Thursday, 25 April 2002 23:03:48 UTC