<< Chapter < Page Chapter >> Page >

Illustration

To illustrate different aspects of MathML encoding and logical sequence in which code lines are written, we undertake to write MathML codes for an equation given here : x = [ 32000 ( 1 - 5 100 ) ( 1 + 10 100 ) ( 1 + 25 2 100 ) ]

Step 1 : Observe the content of the equation from left to right. Identify terms requiring expansion in vertical directions. In the given equation, there are three such terms. It is evident that “mfrac” element suits the requirement in hand. The last of three “mfrac” based expression, matter of fact, would require nested use of “mfrac” element.

Step 2 : Start from the left and write or insert basic construct of “mi” element (line 2).

1: <m:math display="block"> 2: <m:mi> x </m:mi> </m:math>

Step 3 : Copy “mi” element construct (line 2) and paste on the following line (line 3). Change “i” to “o” in order to change the initial and final tags to “mo” tags and change “x” by “=” so that code looks like :

1: <m:math display="block"> 2: <m:mi> x </m:mi> 3: <m:mo> = </m:mo> </m:math>

Step 4 : In this step, using the technique of Step 2, add following 5 lines at the end (4 to 8):

1: <m:math display="block"> 2: <m:mi> x </m:mi> 3: <m:mo> = </m:mo> 4: <m:mi> x </m:mi> 5: <m:mi> x </m:mi> 6: <m:mi> x </m:mi> 7: <m:mi> x </m:mi> 8: <m:mi> x </m:mi> </m:math>

Use appropriate token elements with identifiers, operators and numbers by modifying the newly added lines :

1: <m:math display="block"> 2: <m:mi> x </m:mi> 3: <m:mo> = </m:mo> 4: <m:mo> [ </m:mo> 5: <m:mn> 3200 </m:mn> 6: <m:mo> ( </m:mo> 7: <m:mn> 1 </m:mn> 8: <m:mo> - </m:mo> </m:math>

What you have coded till now : x = [ 3200 ( 1 -

What is to be coded ultimately : x = [ 32000 ( 1 - 5 100 ) ( 1 + 10 100 ) ( 1 + 25 2 100 ) ]

Step 4 : In this step, we shall handle the vertical term with “mfrac” element. Insert the basic block of “mfrac” element or type at the end (9 to 12) as shown :

1: <m:math display="block"> 2: <m:mi> x </m:mi> 3: <m:mo> = </m:mo> 4: <m:mo> [ </m:mo> 5: <m:mn> 3200 </m:mn> 6: <m:mo> ( </m:mo> 7: <m:mi> 1 </m:mi> 8: <m:mo> - </m:mo> 9: <m:mfrac> 10: <m:mn> a </m:mn> 11: <m:mn> b </m:mn> 12: </m:mfrac> </m:math>

Step 5 : Change the value of “mfrac” element’s argument as given in the equation. Copy line 6 twice and modifying the same to put a closing and opening parentheses (13 and 14). Further, add lines 15 and 16 by copying and modifying lines 7 and 8 :

1: <m:math display="block"> 2: <m:mi> x </m:mi> 3: <m:mo> = </m:mo> 4: <m:mo> [ </m:mo> 5: <m:mn> 3200 </m:mn> 6: <m:mo> ( </m:mo> 7: <m:mn> 1 </m:mn> 8: <m:mo> - </m:mo> 9: <m:mfrac> 10: <m:mn> 5 </m:mn> 11: <m:mn> 100 </m:mn> 12: </m:mfrac> 13: <m:mo> ) </m:mo> 14: <m:mo> ( </m:mo> 15: <m:mn> 1 </m:mn> 16: <m:mo> + </m:mo> </m:math>

Get the best College algebra course in your pocket!





Source:  OpenStax, A primer in mathml. OpenStax CNX. Apr 19, 2006 Download for free at http://cnx.org/content/col10345/1.16
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A primer in mathml' conversation and receive update notifications?

Ask