Broken MathML



  • I am trying to display a graph (i.e., a set of vertices and edges) in a question using

    $g=maple("printf(MathML[ExportPresentation]($graph))");

    where $graph is defined using 

    $graph=maple("GraphTheory[DrawGraph](GraphTheory[Graph](directed, Matrix([[0, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 0]])))");

    However, when I preview the question only a brokenMML image is displayed. I suspect that this type of object cannot be represented in MathML. If this is true, how can I embed the image in the problem given that I ultimately want the matrix to be randomized and therefore do not want a static image?

     


  • administrators

    Hi @jgray. There are two Maple T.A. commands that can execute maple code. As i understand it, the maple() function runs maple commands and expects to return strings of characters as the result. The plotmaple() function also runs maple commands but then it expects to returns an image. Since the command in your example returns an image of the graph you need to use the plotmaple() command to wrap your maple code.

    Here is the modified version of your code. You do not need the mathml function. 

    $graph=plotmaple("GraphTheory[DrawGraph](GraphTheory[Graph](directed, Matrix([[0, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 0]])))");


  • Thanks very much, @jmtrik . I thought that plotmaple() was only used for plots and did not know that it could be used more generally so I did not attempt to use it.


Log in to reply