translate a Maple expression into a MathML expression - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Web Features : MathML : MathML Package : MathML/ExportContent

MathML[Export] - translate a Maple expression into a MathML expression

MathML[ExportContent] - translate a Maple expression into a content-only MathML expression

MathML[ExportPresentation] - translate a Maple expression into a presentation-only MathML expression

Calling Sequence

Export( expr )

ExportContent( expr )

ExportPresentation( expr )

Parameters

expr

-

any Maple expression that can be represented in MathML

Description

• 

Exporting a Maple expression as MathML produces a representation of the expression as MathML-encoded text. This text is produced in the form of a Maple string which may then be printed or otherwise processed further.

• 

Three forms of exported MathML-encoded text are supported by the MathML package:

1. 

Parallel MathML encoding where both explicit presentation markup and explicit content markup for an expression are represented in a pair of tree data structures,

2. 

Content-only MathML encoding, and

3. 

Presentation-only MathML encoding.

• 

Maple expressions are exported as MathML-encoded text by using either of the routines Export (to produce a parallel MathML encoding) and ExportContent (to produce a content-only MathML encoding). To support legacy browsers that do not understand content annotations, a third routine ExportPresentation is provided that removes the Maple and content annotations from the expression produced by Export.

  

Each of these routines accepts a single Maple expression as an argument. If the translation from Maple to MathML is possible, the MathML-encoded textual representation of the Maple expression is returned as a string. Otherwise, an error is returned.

• 

The precise structure of the parallel MathML encoding is a tree-like data structure that consists of three parts.

4. 

The main branch consists of a presentation-only MathML encoding for use by rendering software.

5. 

The second part is an XML annotation that consists of a content-only MathML encoding for use by computational applications.

6. 

Finally, a textual annotation that consists of the Maple syntax for the input expression is attached for use by Maple itself, should it encounter its own output.

• 

The structure of the content-only MathML encoding consists of only the second part of the parallel encoding. The content-only MathML format is used in communication with computational applications that require semantically accurate representations. This form can be generated both quickly and accurately, so a separate routine ExportContent was provided for producing this encoding.

• 

The structure of the presentation-only MathML encoding consists of the first branch of the parallel encoding. It operates by generating a full parallel encoding, and then eliding the semantic annotations. Thus, unlike ExportContent, the procedure ExportPresentation is not more efficient than Export.

• 

You can use the routine XMLTools[Print] to format the display of the strings returned by MathML[Export], MathML[ExportContent], and MathML[ExportPresentation].

• 

This function is part of the MathML package, and so it can be used in the form Export(..) only after executing the command with(MathML). However, it can always be accessed through the long form of the command by using the form MathML[Export](..).

Examples

MathML[Export]a+2b

<math xmlns='http://www.w3.org/1998/Math/MathML'><semantics><mrow xref='id5'><mi xref='id1'>a</mi><mo>+</mo><mrow xref='id4'><mn xref='id2'>2</mn><mo>&InvisibleTimes;</mo><mi xref='id3'>b</mi></mrow></mrow><annotation-xml encoding='MathML-Content'><apply id='id5'><plus/><ci id='id1'>a</ci><apply id='id4'><times/><cn id='id2' type='integer'>2</cn><ci id='id3'>b</ci></apply></apply></annotation-xml><annotation encoding='Maple'>a+2*b</annotation></semantics></math>

(1)

XMLTools&lsqb;Print&rsqb;

<math xmlns='http://www.w3.org/1998/Math/MathML'>
  <semantics>
    <mrow xref='id5'>
      <mi xref='id1'>a</mi>
      <mo>+</mo>
      <mrow xref='id4'>
        <mn xref='id2'>2</mn>
        <mo>&InvisibleTimes;</mo>
        <mi xref='id3'>b</mi>
      </mrow>
    </mrow>
    <annotation-xml encoding='MathML-Content'>
      <apply id='id5'>
        <plus/>
        <ci id='id1'>a</ci>
        <apply id='id4'>
          <times/>
          <cn id='id2' type='integer'>2</cn>
          <ci id='id3'>b</ci>
        </apply>
      </apply>
    </annotation-xml>
    <annotation encoding='Maple'>a+2*b</annotation>
  </semantics>
</math>

MathML&lsqb;Import&rsqb;

a&plus;2b

(2)

MathML&lsqb;ExportPresentation&rsqb;a&plus;2b

<math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>a</mi><mo>+</mo><mrow><mn>2</mn><mo>&InvisibleTimes;</mo><mi>b</mi></mrow></mrow></math>

(3)

MathML&lsqb;Import&rsqb;

a&plus;2b

(4)

MathML&lsqb;ExportContent&rsqb;&int;0&pi;2sinxcosx&DifferentialD;x

<math xmlns='http://www.w3.org/1998/Math/MathML'><apply id='id13'><int/><bvar><ci id='id5'>x</ci></bvar><lowlimit><cn id='id1' type='integer'>0</cn></lowlimit><uplimit><apply id='id4'><times/><cn id='id2' type='rational'>1<sep/>2</cn><pi id='id3'/></apply></uplimit><apply id='id12'><minus/><apply id='id8'><sin id='id6'/><ci id='id7'>x</ci></apply><apply id='id11'><cos id='id9'/><ci id='id10'>x</ci></apply></apply></apply></math>

(5)

XMLTools&lsqb;Print&rsqb;

<math xmlns='http://www.w3.org/1998/Math/MathML'>
  <apply id='id13'>
    <int/>
    <bvar>
      <ci id='id5'>x</ci>
    </bvar>
    <lowlimit>
      <cn id='id1' type='integer'>0</cn>
    </lowlimit>
    <uplimit>
      <apply id='id4'>
        <times/>
        <cn id='id2' type='rational'>
          1
          <sep/>
          2
        </cn>
        <pi id='id3'/>
      </apply>
    </uplimit>
    <apply id='id12'>
      <minus/>
      <apply id='id8'>
        <sin id='id6'/>
        <ci id='id7'>x</ci>
      </apply>
      <apply id='id11'>
        <cos id='id9'/>
        <ci id='id10'>x</ci>
      </apply>
    </apply>
  </apply>
</math>

MathML&lsqb;ImportContent&rsqb;

&int;012&pi;sinxcosx&DifferentialD;x

(6)

ode:=&DifferentialD;&DifferentialD;xyxyx2&plus;yxsinxcosx

ode:=&DifferentialD;&DifferentialD;xyxyx2&plus;yxsinxcosx

(7)

MathML&lsqb;ExportContent&rsqb;ode

<math xmlns='http://www.w3.org/1998/Math/MathML'><apply id='id21'><plus/><apply id='id5'><diff/><bvar><ci id='id1'>x</ci></bvar><apply id='id4'><ci id='id2'>y</ci><ci id='id3'>x</ci></apply></apply><apply><minus/><apply id='id10'><power/><apply id='id8'><ci id='id6'>y</ci><ci id='id7'>x</ci></apply><cn id='id9' type='integer'>2</cn></apply></apply><apply id='id17'><times/><apply id='id13'><ci id='id11'>y</ci><ci id='id12'>x</ci></apply><apply id='id16'><sin id='id14'/><ci id='id15'>x</ci></apply></apply><apply><minus/><apply id='id20'><cos id='id18'/><ci id='id19'>x</ci></apply></apply></apply></math>

(8)

XMLTools&lsqb;Print&rsqb;

<math xmlns='http://www.w3.org/1998/Math/MathML'>
  <apply id='id21'>
    <plus/>
    <apply id='id5'>
      <diff/>
      <bvar>
        <ci id='id1'>x</ci>
      </bvar>
      <apply id='id4'>
        <ci id='id2'>y</ci>
        <ci id='id3'>x</ci>
      </apply>
    </apply>
    <apply>
      <minus/>
      <apply id='id10'>
        <power/>
        <apply id='id8'>
          <ci id='id6'>y</ci>
          <ci id='id7'>x</ci>
        </apply>
        <cn id='id9' type='integer'>2</cn>
      </apply>
    </apply>
    <apply id='id17'>
      <times/>
      <apply id='id13'>
        <ci id='id11'>y</ci>
        <ci id='id12'>x</ci>
      </apply>
      <apply id='id16'>
        <sin id='id14'/>
        <ci id='id15'>x</ci>
      </apply>
    </apply>
    <apply>
      <minus/>
      <apply id='id20'>
        <cos id='id18'/>
        <ci id='id19'>x</ci>
      </apply>
    </apply>
  </apply>
</math>

MathML&lsqb;ImportContent&rsqb;

&DifferentialD;&DifferentialD;xyxyx2&plus;yxsinxcosx

(9)

mml:=MathML&lsqb;Export&rsqb;ode&colon;

MathML&lsqb;Import&rsqb;mml

&DifferentialD;&DifferentialD;xyxyx2&plus;yxsinxcosx

(10)

See Also

codegen[eqn], codegen[MathML], Copy as MathML, Exporting as MathML, InertForm[ToMathML], latex, MathML, MathML[Import], MathML[ImportContent], XMLTools, XMLTools[Print]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam