I'm seeing some curious behaviour when I use maple to produce MathML for my TA questions.
What I want to do is generate the first few terms of a sequence, followed by "...". I've managed to achieve this in Maple, but it's the conversion to MathML that is causing trouble.
I've pasted the code below, showing what I'm trying to do.
Maple TA code:
$W1=maple("printf(MathML:-ExportPresentation( [seq('ln'(2*3^i),i=0..3),`...`] ))");
$W2=maple("printf( StringTools[CharacterMap](convert(`[]`,string),convert(`[]`,string), MathML:-ExportPresentation( [seq('ln'(2*3^i),i=0..3),`...`] )));");
$W3=maple("printf( StringTools[CharacterMap](convert(`[]`,string),convert(` `,string), MathML:-ExportPresentation( [seq('ln'(2*3^i),i=0..3),`...`] )));");
Now W1 looks fine, except I don't want the brackets to show. W3 is my attempt to remove them - it just replaces the fence characters [ and ] with whitespace in the hope that they won't show up. It works, but then the functions appear in italic!
I thought this was maybe a problem with the resulting MathML being invalid, but W2 suggests otherwise. That replaces [ with [ and ] with ] - i.e. it does nothing to the MathML string. I've confirmed that by viewing the output in Maple. So, why does it render differently?
More importantly, does anyone have suggestions for how I can get W3 without the italics?
Further example...
Here's further odd behaviour:
$O1=maple("printf( MathML:-ExportPresentation( cos(x) ))");
$O2=maple("printf(MathML:-ExportPresentation( cos(x) ))");
The only difference in the code there is that O1 has a space before the MathML command. Surely that shouldn't affect the rendering?
Italics and space in TA
I tried a few things and did not find a good solution to your first problem.
Maybe you could not require html. Then you could simply use
$W0=maple("seq(ln(2*3^i),i=0..3) ");
and then in the field for the question text simply use
$W0...
It's not quite as beautiful, but pretty darn good.
Blank spaces in MapleTA are a real curse. Look at this discussion:
www.mapleprimes.com/forum/inequality-problem-with-mapleta
Thanks for the reply. I had
Thanks for the reply.
I had considered just displaying the plain text, but it's not ideal as that example is going to be one of 6 sequences put out in a multiple selection question, and the other choices will need to be set in MathML since they contain fractions and symbols.
What I really can't get my head around is that the rendering is different for exactly the same code. It does seem important that you use exactly maple("printf(MathML:-ExportPresentation( - any variation seems to break it.
I've got sommething to say about the topic you linked to, but I'll just post it there.
More MathML woes
As I understand it, Maple TA's own mathml command should only be used for really simple chunks of output.
However, you don't get much simpler than this:
$out1=mathml("-x");
$out2=mathml("-x+1");
$out3=mathml("1-x");
Am I missing something obvious here?