<< Chapter < Page | Chapter >> Page > |
The base of the superscript is the large block, involving summation sign. The base is built upon summation sign with “over” and “under” limits implemented by “munderover” element. We write “munderover” basic code lines, using macro to replace the “base” of superscript i.e. “x” in the basic format reproduced by macro in the above step.
<m:math display="block">
<m:mo> ( </m:mo>
<m:msup>
<m:munderover>
<m:mo> ∫ </m:mo>
<m:mi>x</m:mi>
<m:mi>y</m:mi>
</m:munderover>
<m:mn> 2 </m:mn>
</m:msup>
</m:math>
We replace integer symbol with summation symbol “∑” and change the limits as required. Note that we need to bunch the underscript with “mrow” tags to work as one of the argument of the “msup” element.
<m:math display="block">
<m:mo> ( </m:mo>
<m:msup>
<m:munderover>
<m:mo>∑</m:mo>
<m:mrow>
<m:mi> k </m:mi>
<m:mo> = </m:mo>
<m:mn> 1</m:mn>
</m:mrow>
<m:mn>n</m:mn>
</m:munderover>
<m:mn> 2 </m:mn>
</m:msup>
</m:math>
Now, we add codes for and , which can be implemented with “msub” element. We produce two sets of “msub” codes with macro and place them just after</m:munderover>. Finally, we also insert a “mo” line to encode for closing parenthesis. Putting these code lines ahead of superscript element line<m:mi>2</m:mi>is important as everything in totality is raised to the power “2”. For this reason, everything other than superscript element line is required to be bunched together with a pair of “mrow” tags as shown here :
<m:math display="block">
<m:mo> ( </m:mo>
<m:msup>
<m:mrow>
<m:munderover>
<m:mo>∑</m:mo>
<m:mrow>
<m:mi> k </m:mi>
<m:mo> = </m:mo>
<m:mn> 1</m:mn>
</m:mrow>
<m:mn>n</m:mn>
</m:munderover>
<m:msub>
<m:mi> a </m:mi>
<m:mi> k </m:mi>
</m:msub>
<m:msub>
<m:mi> b </m:mi>
<m:mi> k </m:mi>
</m:msub>
<m:mo> ) </m:mo>
</m:mrow>
<m:mn> 2 </m:mn>
</m:msup>
</m:math>
This completes the coding for the first left hand side block of the “Cauchy-Schwarz” inequality. At this stage, the display in the browser looks like :
Now coding for two other large block is easy. We need to replicate the above code block twice and do the modification as required. Finally three blocks are joined together with the help of an “inequality” operator "≤". The display, now, looks like :
We observe that the parenthesis of the first term has not grown to the expected height to cover the highest term. Moreover, the parentheses are unequal in size. To achieve the equality in size and proper coverage, we enclose all expressions involving parenthses within a pair of “mrow” tags and a “mstyle” pairs of tages to display “true”. The complete code and display is illustrated in the example below :
<m:math display="block">
<m:mstyle displaystyle='true'>
<m:mrow>
<m:msup>
<m:mrow>
<m:mo> ( </m:mo>
<m:munderover>
<m:mo>∑</m:mo>
<m:mrow>
<m:mi> k </m:mi>
<m:mo> = </m:mo>
<m:mn> 1</m:mn>
</m:mrow>
<m:mn>n</m:mn>
</m:munderover>
<m:msub>
<m:mi> a </m:mi>
<m:mi> k </m:mi>
</m:msub>
<m:msub>
<m:mi> b </m:mi>
<m:mi> k </m:mi>
</m:msub>
<m:mo> ) </m:mo>
</m:mrow>
<m:mn> 2 </m:mn>
</m:msup>
<m:mo> ≤ </m:mo>
<m:mrow>
<m:mo> ( </m:mo>
<m:munderover>
<m:mo>∑</m:mo>
<m:mrow>
<m:mi> k </m:mi>
<m:mo> = </m:mo>
<m:mn> 1</m:mn>
</m:mrow>
<m:mn>n</m:mn>
</m:munderover>
<m:msup>
<m:mrow>
<m:msub>
<m:mi> a </m:mi>
<m:mi> k </m:mi>
</m:msub>
</m:mrow>
<m:mn> 2 </m:mn>
</m:msup>
<m:mo> ) </m:mo>
</m:mrow>
<m:mrow>
<m:mo> ( </m:mo>
<m:munderover>
<m:mo>∑</m:mo>
<m:mrow>
<m:mi> k </m:mi>
<m:mo> = </m:mo>
<m:mn> 1</m:mn>
</m:mrow>
<m:mn>n</m:mn>
</m:munderover>
<m:msup>
<m:mrow>
<m:msub>
<m:mi> b </m:mi>
<m:mi> k </m:mi>
</m:msub>
</m:mrow>
<m:mn> 2 </m:mn>
</m:msup>
<m:mo> ) </m:mo>
</m:mrow>
</m:mrow>
</m:mstyle>
</m:math>
Save the file after editing as “test.xml”. The display looks like :
Notification Switch
Would you like to follow the 'A primer in mathml' conversation and receive update notifications?