FromMma - Maple Help

MmaTranslator[FromMma]

convert Mathematica input into equivalent Maple input

convert/FromMma

convert Mathematica input into equivalent Maple input

 Calling Sequence FromMma(Mma_input, options) convert(Mma_input, FromMma, options)

Parameters

 Mma_input - Mathematica input; expressions or operations options - (optional) keywords evaluate and/or quiet; evaluate translated Mathematica input and/or suppress warning messages FromMma - literal name; FromMma

Description

 • The FromMma(Mma_input) calling sequence translates Mathematica input into its Maple input equivalent. This command helps Mathematica users learn Maple.
 • You can also use the Maplet application interface MmaTranslator[MmaToMaple] to translate Mathematica input and notebooks to Maple input and worksheets.
 • The FromMma(Mma_input) and convert(Mma_input, FromMma) calling sequences produce the same result.
 • If you are using the Maple command prompt, the Mathematica input to be translated Mma_input  must be enclosed in double quotes (") or left single () quotes.
 Note: The FromMma(Mma_input) calling sequence does not translate Mathematica programs or Mathematica comments enclosed by (* ... *). Some automatic simplifications, for example, 2+2 -> 4, are also unavoidable.
 • If you call FromMma(Mma_input) with no options specified, the Mathematica input is translated without performing the intended computation.
 To evaluate the translation, specify the optional argument evaluate.
 To suppress warning messages, specify the optional argument quiet.
 • Some Mathematica commands do not have an exact Maple equivalent; however, the translation can still be performed using the MmaTranslator[Mma] subpackage, which contains commands based on the existence of very similar Maple commands.  For more information, see MmaTranslator[Mma].

Examples

The translation of Mathematica input considers the differences in the definitions of the mathematical functions.

 > $\mathrm{with}\left(\mathrm{MmaTranslator}\right)$
 $\left[{\mathrm{FromMma}}{,}{\mathrm{FromMmaNotebook}}{,}{\mathrm{Mma}}{,}{\mathrm{MmaToMaple}}\right]$ (1)
 > $\mathrm{Exp\left[x\right]EllipticPi\left[a,z,b\right]}$
 ${\mathrm{Exp\left[x\right]EllipticPi\left[a,z,b\right]}}$ (2)

Translate the Mathematica input defined above.

 > $\mathrm{FromMma}\left(\right)$
 ${{ⅇ}}^{{x}}{}{\mathrm{EllipticPi}}{}\left({\mathrm{sin}}{}\left({z}\right){,}{a}{,}\sqrt{{b}}\right)$ (3)

The FromMma( % ) command and the convert(%, FromMma) command are equivalent.  They return the same results. Note also that the Mathematica input is translated, but not evaluated.

 > $\mathrm{convert}\left(\mathrm{Integrate\left[Cos\left[x\right],x\right]},\mathrm{FromMma}\right)$
 ${\int }{\mathrm{cos}}{}\left({x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (4)

Produce a full evaluation of the above translation.

 > 
 ${\mathrm{sin}}{}\left({x}\right)$ (5)

Alternatively, include the evaluate option to evaluate the translation in one step.

 > $\mathrm{convert}\left(\mathrm{Integrate\left[Cos\left[x\right],x\right]},\mathrm{FromMma},\mathrm{evaluate}\right)$
 ${\mathrm{sin}}{}\left({x}\right)$ (6)

Apart from mathematical expressions, command operations can also be translated.

 > $\mathrm{FromMma}\left(\mathrm{StringLength\left["spaces count"\right]}\right)$
 ${\mathrm{length}}{}\left({"spaces count"}\right)$ (7)
 > 
 ${12}$ (8)

The following are plotting examples.

 > $\mathrm{FromMma}\left("Plot3D\left[ Sin\left[x\right]*BesselJ\left[a,x\right],\left\{x,0,10\right\},\left\{a,0,10\right\}\right]",\mathrm{evaluate}\right)$
 > $\mathrm{convert}\left(\mathrm{Show\left[ContourGraphics\left[Table\left[Sin\left[x y\right], \left\{x, -5, 5\right\}, \left\{y, -5, 5\right\}\right], Contours -> 10\right]\right]},\mathrm{FromMma}\right)$
 ${\mathrm{plots}}\left[{\mathrm{display}}\right]{}\left({\mathrm{plots}}\left[{\mathrm{listcontplot}}\right]{}\left({\mathrm{ListTools}}{:-}{\mathrm{Transpose}}{}\left(\left[{\mathrm{seq}}{}\left(\left[{\mathrm{seq}}{}\left({\mathrm{sin}}{}\left({x}{}{y}\right){,}{y}{=}{-5}{..}{5}\right)\right]{,}{x}{=}{-5}{..}{5}\right)\right]\right){,}{\mathrm{filled}}{=}{\mathrm{true}}{,}{\mathrm{coloring}}{=}\left[{\mathrm{black}}{,}{\mathrm{white}}\right]{,}{\mathrm{contours}}{=}{10}\right)\right)$ (9)

Generate the plot.

 > 

Most Mathematica plotting options have an equivalent Maple option. Consider the following example.

 > $\mathrm{ListPlot\left[Transpose\left[\left\{\left\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17, 18, 19\right\}*0.2, \left\{11, 7,4, 2.4, 1.4,0.8, 0.5, 0.301,0.2, 0.1, 0.005, 0.04,0.025, 0.016, 0.0106,0.0069, 0.0053, 0.004,0.0030, 0.0023\right\}\right\}\right],Prolog -> AbsolutePointSize\left[5\right], PlotLabel -> "Voltage Decay of RC circuit",AxesLabel -> \left\{"Time \left(sec\right)", "Voltage \left(Volts\right)"\right\}\right]`}$
 ${\mathrm{ListPlot\left[Transpose\left[\left\{\left\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17, 18, 19\right\}*0.2, \left\{11, 7,4, 2.4, 1.4,0.8, 0.5, 0.301,0.2, 0.1, 0.005, 0.04,0.025, 0.016, 0.0106,0.0069, 0.0053, 0.004,0.0030, 0.0023\right\}\right\}\right],Prolog -> AbsolutePointSize\left[5\right], PlotLabel -> "Voltage Decay of RC circuit",AxesLabel -> \left\{"Time \left(sec\right)", "Voltage \left(Volts\right)"\right\}\right]}}$ (10)
 > $\mathrm{FromMma}\left(\right)$
 ${\mathrm{plots}}\left[{\mathrm{listplot}}\right]{}\left({\mathrm{convert}}{}\left({{\mathrm{Matrix}}{}\left(\left[\left[{0.}{,}{0.2}{,}{0.4}{,}{0.6}{,}{0.8}{,}{1.0}{,}{1.2}{,}{1.4}{,}{1.6}{,}{1.8}{,}{2.0}{,}{2.2}{,}{2.4}{,}{2.6}{,}{2.8}{,}{3.0}{,}{3.2}{,}{3.4}{,}{3.6}{,}{3.8}\right]{,}\left[{11}{,}{7}{,}{4}{,}{2.4}{,}{1.4}{,}{0.8}{,}{0.5}{,}{0.301}{,}{0.2}{,}{0.1}{,}{0.005}{,}{0.04}{,}{0.025}{,}{0.016}{,}{0.0106}{,}{0.0069}{,}{0.0053}{,}{0.004}{,}{0.0030}{,}{0.0023}\right]\right]\right)}^{{+}}{,}{\mathrm{listlist}}\right){,}{\mathrm{style}}{=}{\mathrm{POINT}}{,}{\mathrm{symbol}}{=}{\mathrm{CIRCLE}}{,}{\mathrm{symbolsize}}{=}{15}{,}{\mathrm{title}}{=}{"Voltage Decay of RC circuit"}{,}{\mathrm{labels}}{=}\left[{"Time \left(sec\right)"}{,}{"Voltage \left(Volts\right)"}\right]\right)$ (11)

Generate the plot.

 >