Equation - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

DocumentTools[Layout]

 Equation
 generate XML for an Equation element

 Calling Sequence Equation( expr, opts )

Parameters

 expr - (optional) ; an expression, or sequence of expressions opts - (optional) ; one or more keyword options as described below

Options

 • executable : truefalse:=false; Specifies whether the content should be executable.
 • style : identical(TwoDimInput,TwoDimOutput):=TwoDimOutput; Specifies the formatting style for the contents of the element.
 • typesetting : identical(standard,extended); Specifies the typesetting level. By default the current value returned by interface(typesetting) is used.
 • typesetbold : truefalse:=false; Specifies whether 2D Math is typeset in bold, if typesetting=extended. If this option is not specified or typesetting is not extended then the default style is used.
 • typesetcolor : {name,string}; Specifies a color for 2D Math, if typesetting=extended. If this option is not specified or typesetting is not extended then the default style is used.
 • typesetitalic : truefalse; When true 2D Math is typeset in italic, if typesetting=extended. When false 2D Math is typeset as upright, if typesetting=extended. If this option is not specified or typesetting is not extended then the default style is used.
 • typesetsize : posint; Specifies the font size for 2D Math, if typesetting=extended. If this option is not specified or typesetting is not extended then the default style is used.

Description

 • The Equation command encodes expressions for 2D Math input or output storage within an Equation element of an XML representation of a worksheet.
 • An Equation element is returned as an XML function call.
 • The generated XML may be used with the results of additional commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document may be inserted into the current document using the InsertContent command.

Examples

 > $\mathrm{with}\left(\mathrm{DocumentTools}\right):$
 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Layout}\right):$

Executing the Equation command produces a function call.

 > $E≔\mathrm{Equation}\left(\frac{\sqrt{x}}{\mathrm{Pi}}\right)$
 ${E}{≔}{\mathrm{_XML_Equation}}{}\left({"executable"}{=}{"false"}{,}{"style"}{=}{"2D Output"}{,}{"display"}{=}{"LUkmbWZyYWNHNiQlKnByb3RlY3RlZEcvJSttb2R1bGVuYW1lR0ksVHlwZXNldHRpbmdHNiRGJSUoX3N5c2xpYkc2JC1JJm1zcXJ0RzYkRiUvRidGKDYjLUkjbWlHNiRGJS9GJ0YoNiNRIng2Ii1GMjYjUSUmcGk7Rjc="}{,}{"KiYlInhHIyIiIiIiIyUjUGlHISIi"}\right)$ (1)

By using additional commands from the Layout Constructors package a nested function call can be produced which represents an entire worksheet.

 > $\mathrm{xml}≔\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Textfield}\left(E\right)\right)\right)\right):$

That XML representation of a worksheet can be inserted directly.

 > $\mathrm{InsertContent}\left(\mathrm{xml}\right):$

$\frac{\sqrt{{x}}}{{\mathrm{\pi }}}$

The Equation constructor can accept multiple arguments, and handle them as an expression sequence.

 > $E≔\mathrm{Equation}\left(\frac{\sqrt{x}}{\mathrm{Pi}},\mathrm{GAMMA}\left(x\right),{\sum }_{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}f\left(i\right)\right):$$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Textfield}\left(E\right)\right)\right)\right)\right):$

$\frac{\sqrt{{x}}}{{\mathrm{π}}}{,}{\mathrm{Γ}}{}\left({x}\right){,}{\sum }_{{i}{=}{1}}^{{n}}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}{f}{}\left({i}\right)$

The previous examples were formatted using the default value of the style option, which is 2D Math output. The following examples illustrate 2D Math input.

Inlined typeset 2D Math expressions can be surrounded by text.

 > $\mathrm{E1}≔\mathrm{Equation}\left('\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i',\mathrm{style}=\mathrm{TwoDimInput}\right):$$\mathrm{E2}≔\mathrm{Equation}\left(\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i\right),\mathrm{style}=\mathrm{TwoDimInput},\mathrm{typesetting}=\mathrm{extended}\right):$T≔\mathrm{Textfield}\left("The sum of the first n positive integers",\mathrm{E1},"is equal to",\mathrm{E2},\mathrm{alignment}=\mathrm{left}\right):$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(T\right)\right)\right)\right):$

The sum of the first n positive integers $\sum _{i=1}^{n}i$ is equal to $\frac{n\left(n+1\right)}{2}$

The next examples illustrate using 2-D Math for both input and output.

 > $\mathrm{Ein}≔\mathrm{Equation}\left('\mathrm{BesselJ}\left(0,x\right)+\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i\right)',\mathrm{style}=\mathrm{TwoDimInput},\mathrm{executable}=\mathrm{true}\right):$$\mathrm{Eout}≔\mathrm{Equation}\left(\mathrm{BesselJ}\left(0,x\right)+\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i\right),\mathrm{style}=\mathrm{TwoDimOutput},\mathrm{typesetting}=\mathrm{standard}\right):$\mathrm{Tin}≔\mathrm{Textfield}\left(\mathrm{Ein},\mathrm{alignment}=\mathrm{left},\mathrm{prompt}=">",\mathrm{style}=\mathrm{MapleInput}\right):$\mathrm{Tout}≔\mathrm{Textfield}\left(\mathrm{Eout}\right):$$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Tin}\right),\mathrm{Output}\left(\mathrm{Tout}\right)\right)\right)\right):$
 > $\mathrm{BesselJ}\left(0,x\right)+\mathrm{factor}\left(\sum _{i=1}^{n}i\right)$
 ${\mathrm{BesselJ}}{}\left({0}{,}{x}\right){+}\frac{{1}}{{2}}{}{n}{}\left({n}{+}{1}\right)$ (2)

Note the effect of the typesetting option.

 > $\mathrm{Eout}≔\mathrm{Equation}\left(\mathrm{BesselJ}\left(0,x\right)+\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i\right),\mathrm{style}=\mathrm{TwoDimOutput},\mathrm{typesetting}=\mathrm{extended}\right):$$\mathrm{Tout}≔\mathrm{Textfield}\left(\mathrm{Eout}\right):$$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Tin}\right),\mathrm{Output}\left(\mathrm{Tout}\right)\right)\right)\right):$
 > $\mathrm{BesselJ}\left(0,x\right)+\mathrm{factor}\left(\sum _{i=1}^{n}i\right)$
 ${\mathrm{BesselJ}}{}\left({0}{,}{x}\right){+}\frac{{n}{}\left({n}{+}{1}\right)}{{2}}$ (3)

The options typesetbold, typesetcolor, typesetitalic, and typesetsize are used in the next example to override the default styles for 2D Math input and output.

 > $\mathrm{Ein}≔\mathrm{Equation}\left('\mathrm{BesselJ}\left(0,x\right)+\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i\right)',\mathrm{style}=\mathrm{TwoDimInput},\mathrm{executable}=\mathrm{true},\mathrm{typesetting}=\mathrm{extended},\mathrm{typesetbold}=\mathrm{true}\right):$$\mathrm{Eout}≔\mathrm{Equation}\left(\mathrm{BesselJ}\left(0,x\right)+\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i\right),\mathrm{style}=\mathrm{TwoDimOutput},\mathrm{typesetting}=\mathrm{extended},\mathrm{typesetsize}=18,\mathrm{typesetcolor}=\mathrm{black},\mathrm{typesetitalic}=\mathrm{false}\right):$\mathrm{Tin}≔\mathrm{Textfield}\left(\mathrm{Ein},\mathrm{alignment}=\mathrm{left},\mathrm{prompt}=">",\mathrm{style}=\mathrm{MapleInput}\right):$\mathrm{Tout}≔\mathrm{Textfield}\left(\mathrm{Eout}\right):$$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Tin}\right),\mathrm{Output}\left(\mathrm{Tout}\right)\right)\right)\right):$
 > $\mathbf{BesselJ}\left(\mathbf{0}\mathbf{,}\mathbit{x}\right)\mathbf{+}\mathbit{factor}\left(\mathbf{\sum }_{\mathbit{i}\mathbf{=}\mathbf{1}}^{\mathbit{n}}\mathbit{i}\right)$
 $\mathrm{BesselJ}{}\left(0,\mathrm{x}\right)+\frac{\mathrm{n}{}\left(\mathrm{n}+1\right)}{2}$ (4)

Compatibility

 • The DocumentTools:-Layout:-Equation command was introduced in Maple 2015.
 • For more information on Maple 2015 changes, see Updates in Maple 2015.

 See Also