MathML - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

MathML

  

Import

  

translate a MathML expression into a Maple expression

  

ImportContent

  

translate a content-only MathML expression into a Maple expression

  

ImportModified

  

translate a modified MathML expression produced by Maple's GUI into a Maple expression

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Import( mmlstring )

ImportContent( mmlstring )

ImportModified( mmlstring )

Parameters

mmlstring

-

MathML text in the form of a Maple string

Description

• 

Importing MathML produces the corresponding Maple expression from a MathML-encoded textual representation of an expression. The MathML-encoded text must be presented to Maple in the form of a Maple string.

• 

Two forms of exported MathML-encoded text are supported by the MathML package for use with the Import routines:

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

2. 

Content-only MathML encoding.

3. 

Modified-MathML MathML encoding.

• 

A MathML-encoded textual representation of an expression is imported into Maple by using one among the routines Import (to import a parallel MathML encoding), ImportContent (to import a content-only MathML encoding) and ImportModified (to import a modified MathML encoding).

  

Each of these routines accepts a Maple string containing MathML-encoded text. (The strings are assumed to be valid MathML.) If the translation from MathML to Maple is possible, the corresponding Maple expression is returned. Otherwise, an exception is raised.

• 

Importing content-only MathML by using MathML[ImportContent] is a reasonably fast and accurate operation.

• 

Presentation-only MathML, which is intended for renderers and not designed for computation tools like Maple, is highly ambiguous and frequently cannot be translated accurately. As a result, it is sometimes not possible for Maple's MathML[Import] routine to make any sense of valid presentation-only MathML. For more information, see Export as HTML or HTML with MathML.

  

Note: Heuristic preprocessing, heuristic parsing, and some simple AI techniques are used to attempt the translation from presentation MathML to Maple.  When multiple possibilities exist for a translation, a choice must be made. For example, the MathML fragment

<math>

  <mrow>

    <mi>a</mi>

    <mrow>

      <mi>b</mi>

      <mo>+</mo>

      <mi>c</mi>

    <mrow/>

  <mrow/>

</math>

  

can be validly and reasonably interpreted either as ab&plus;c (a function call) or as ab&plus;c (a product).

  

It is also possible to construct, using MathML, expressions that have no meaningful representation within Maple (such as the valid C language expression "a + ++b").

• 

Because Maple routinely deals with a much wider class of expressions than can be validly encoded in standard MathML, in some cases, Maple's graphical user interface uses a proper extension of standard presentation MathML, termed here "modified MathML". The ImportModified command allows you to import this extended form of MathML produced by Maple's GUI, and should be used for all MathML expressions that have their origin in Maple's GUI (for example, expressions returned from a worksheet embedded component). Operationally, it is identical to the Import command. However, the ImportModified command is restricted to (extended) presentation-only MathML, and does not handle parallel (mixed) MathML markup.

• 

This function is part of the MathML package, and so it can be used in the form Import(..) 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[Import](..).

Examples

MathML&lsqb;Export&rsqb;a&plus;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)

MathML&lsqb;Import&rsqb;

a&plus;2b

(2)

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>

(3)

MathML&lsqb;ImportContent&rsqb;

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

(4)

ode&DifferentialD;&DifferentialD;xyxyx2&plus;yxsinxcosx

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

(5)

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>

(6)

MathML&lsqb;ImportContent&rsqb;

&DifferentialD;&DifferentialD;xyxyx2&plus;yxsinxcosx

(7)

mmlMathML&lsqb;Export&rsqb;ode&colon;

MathML&lsqb;Import&rsqb;mml

&DifferentialD;&DifferentialD;xyxyx2&plus;yxsinxcosx

(8)

mmlMathML&lsqb;ExportPresentation&rsqb;ode

mml:=<math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mrow><mfrac><mo>&DifferentialD;</mo><mrow><mo>&DifferentialD;</mo><mi>x</mi></mrow></mfrac><mrow><mi>y</mi><mo>&ApplyFunction;</mo><mfenced><mi>x</mi></mfenced></mrow></mrow><mo>-</mo><msup><mrow><mi>y</mi><mo>&ApplyFunction;</mo><mfenced><mi>x</mi></mfenced></mrow><mn>2</mn></msup><mo>+</mo><mrow><mrow><mi>y</mi><mo>&ApplyFunction;</mo><mfenced><mi>x</mi></mfenced></mrow><mo>&InvisibleTimes;</mo><mrow><mi>sin</mi><mo>&ApplyFunction;</mo><mfenced><mi>x</mi></mfenced></mrow></mrow><mo>-</mo><mrow><mi>cos</mi><mo>&ApplyFunction;</mo><mfenced><mi>x</mi></mfenced></mrow></mrow></math>

(9)

MathML&lsqb;ImportModified&rsqb;mml

&DifferentialD;&DifferentialD;xyxyx2&plus;yxsinxcosx

(10)

See Also

codegen[eqn]

codegen[MathML]

Exporting as MathML

latex

MathML

MathML[Export]

MathML[ExportContent]

Paste MathML

XMLTools

 


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