Import - Maple Help

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

 $a b + c$

 can be validly and reasonably interpreted either as $a\left(b+c\right)$ (a function call) or as $a\left(b+c\right)$ (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

 > $\mathrm{MathML}\left[\mathrm{Export}\right]\left(a+2b\right)$
 ${"a+2⁢ba2ba+2*b\left[/itex\right]"}$ (1)
 > $\mathrm{MathML}\left[\mathrm{Import}\right]\left(\right)$
 ${a}{+}{2}{}{b}$ (2)
 > $\mathrm{MathML}\left[\mathrm{ExportContent}\right]\left(\mathrm{Int}\left(\mathrm{sin}\left(x\right)-\mathrm{cos}\left(x\right),x=0..\frac{\mathrm{\pi }}{2}\right)\right)$
 ${"x012xx\left[/itex\right]"}$ (3)
 > $\mathrm{MathML}\left[\mathrm{ImportContent}\right]\left(\right)$
 ${{\int }}_{{0}}^{\frac{{\mathrm{\pi }}}{{2}}}\left({\mathrm{sin}}{}\left({x}\right){-}{\mathrm{cos}}{}\left({x}\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (4)
 > $\mathrm{ode}≔\mathrm{diff}\left(y\left(x\right),x\right)-{y\left(x\right)}^{2}+y\left(x\right)\mathrm{sin}\left(x\right)-\mathrm{cos}\left(x\right)$
 ${\mathrm{ode}}{≔}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){-}{{y}{}\left({x}\right)}^{{2}}{+}{y}{}\left({x}\right){}{\mathrm{sin}}{}\left({x}\right){-}{\mathrm{cos}}{}\left({x}\right)$ (5)
 > $\mathrm{MathML}\left[\mathrm{ExportContent}\right]\left(\mathrm{ode}\right)$
 ${"xyxyx2yxxx\left[/itex\right]"}$ (6)
 > $\mathrm{MathML}\left[\mathrm{ImportContent}\right]\left(\right)$
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){-}{{y}{}\left({x}\right)}^{{2}}{+}{y}{}\left({x}\right){}{\mathrm{sin}}{}\left({x}\right){-}{\mathrm{cos}}{}\left({x}\right)$ (7)
 > $\mathrm{mml}≔\mathrm{MathML}\left[\mathrm{Export}\right]\left(\mathrm{ode}\right):$
 > $\mathrm{MathML}\left[\mathrm{Import}\right]\left(\mathrm{mml}\right)$
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){-}{{y}{}\left({x}\right)}^{{2}}{+}{y}{}\left({x}\right){}{\mathrm{sin}}{}\left({x}\right){-}{\mathrm{cos}}{}\left({x}\right)$ (8)
 > $\mathrm{mml}≔\mathrm{MathML}\left[\mathrm{ExportPresentation}\right]\left(\mathrm{ode}\right)$
 ${\mathrm{mml}}{≔}{"ⅆⅆxy⁡x-y⁡x2+y⁡x⁢sin⁡x-cos⁡x\left[/itex\right]"}$ (9)
 > $\mathrm{MathML}\left[\mathrm{ImportModified}\right]\left(\mathrm{mml}\right)$
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){-}{{y}{}\left({x}\right)}^{{2}}{+}{y}{}\left({x}\right){}{\mathrm{sin}}{}\left({x}\right){-}{\mathrm{cos}}{}\left({x}\right)$ (10)