Carl Hickman

89 Reputation

2 Badges

17 years, 247 days

MaplePrimes Activity


These are answers submitted by Carl Hickman

Hi @nhlbooij,

To get started we encourage you to try applying the algorithm streamlining techniques we provided on your MLE post. Should questions or concerns arise along the way, do please export the Maple TA question so we can take a proper look.

Thanks,

Carl

@nhlbooij 

Not a problem, Nico. As for streamlining your question algorithm,

  • Take advantage of Maple's ability to randomly generate entire vectors with a single command; and
  • As @kat05 noted have a maple() block output a list of entities you need for other parts of the question, then use TA's switch() command to extract them into separate variables.

Resulting in this case a 1/4 as many lines of code and 1 maple() block instead of 20:

$seed=rint(1000000);

$m=maple("
randomize($seed):

ruisLow := rand(1..5)():
ruisHigh := rand(6..9)():
gen := rand(ruisLow..ruisHigh):

X := Vector([10,30,50,70,90,125,175]) + LinearAlgebra:-RandomVector(7, generator=gen):
Y := Vector([4,12,32,36,42,36,19]) + LinearAlgebra:-RandomVector(7, generator=gen):
Z := Vector([76,108,128,54,18,4,1]) + LinearAlgebra:-RandomVector(7, generator=gen):

L := Vector(7, proc(i) evalf(ln(Y[i]/Z[i])) end proc):
r := Statistics:-Correlation(X, L):

V := Vector([seq(L[i]-a*X[i]-b, i=1..numelems(X))]):
lf := subs(d=1, Statistics:-Likelihood(Normal(0, d), V)):
mle := Optimization:-Maximize(lf, initialpoint={a=0,b=0}):
mle := map(rhs, mle[2]):

mle[], r, map(MathML:-ExportPresentation@LinearAlgebra:-Transpose, [X, Y, Z])[]
");

$slope=switch(0, $m);
$intercept=switch(1, $m);
$r=switch(2, $m);
$displayTX=switch(3, $m);
$displayTY=switch(4, $m);
$displayTZ=switch(5, $m);

Sincerely,

Carl

Hello,

Using square brackets to specify packages is fine. The issue rather is in nesting strings when defining algorithmic variables, which isn't currently supported. As your examples illustrate, adding single quotes (') to the mix doesn't always get around this and can have unexpected results.

Fortunately, Maple itself often accepts the backquote (`) as an alternative to the double quote (") when a string is expected. So your examples could be reworked as:

$pattern0="sin(1/2*Pi)";
$text0="sin(1/2*Pi)";
$test0=maple("StringTools:-Search(`$pattern0`,`$text0`)");

$test1=maple("StringTools:-Search([`cos`],`cos(0)`)");
$test2=maple("StringTools:-Search([`os`,`cos`],`cos(0)`)");
$test3=maple("StringTools:-Search([`os`,`co`],`cos(0)`)");

$test4=maple("proc() StringTools:-Search([`os`,`co`],`cos(0)`) end proc;");
$test5=maple("($test4)()");

This will yield the expected return values. Note that to find all matches you need StringTools:-SearchAll.

Sincerely,

Carl Hickman

Maplesoft

Hi,

You can make it work by configuring you Maple-graded question as follows:

Grading code (copy/paste this):

respDec := convert(`$RESPONSE`, decimal, hex):

evalb(respDec-($dec) = 0);

Expression type: Maple Syntax

Text/Symbolic entry: Text entry only

This will ensure the student response isn't subject to any preprocessing (such as 8A getting converted to 8*A) before it reaches your Maple grading code.

Hello,

In general a call like $circ=maple("...") results in string output from the final Maple statement within getting assigned to Maple TA variable $circ. In some cases string output either isn't possible as with a plot like geometry:-draw(...), or doesn't adequately capture the object as with geometry:-circle(`Circ`, [geometry:-point(`PP`,0,0),3]) whose ouptut is merely the string Circ.

The following would work:

$circ="geometry:-circle(`Circ`, [geometry:-point(`PP`,0,0),3])";
$p=plotmaple("geometry:-draw($circ)");

Here we set $circ to a string containing the Maple command itself. If you'd rather generate this string from within a library, that should be possible:

$circ=maple("<call to a procedure in your library>, libname='<path to library on your Maple TA class>'");

Either way, $circ can then be referenced throughout the algorithm, and what Maple TA will do is perform a string replacement. So for our plotmaple("...") variable $p above, what actually gets sent to Maple is

geometry:-draw(geometry:-circle(`Circ`, [geometry:-point(`PP`,0,0),3]))

Therefore unless we need our geometry:-circle for more than just the drawing, we might dispense of $circ entirely:

$p=plotmaple("geometry:-draw(geometry:-circle(`Circ`, [geometry:-point(`PP`,0,0),3]))");

Or

$p=plotmaple("geometry:-circle(`Circ`, [geometry:-point(`PP`,0,0),3]):
geometry:-draw(Circ)");

Or if you'd rather generate the drawing from within a library:

$p=plotmaple("<call to a procedure in your library>, libname='<path to library on your Maple TA class>'");

Finally, you can indeed call plots:-display in a plotmaple("...") (either directly or from within your library), though we didn't need to here. What you cannot do (as explained above) is return a plots:-display or any other plot structure from a maple("...").

Hi Jan,

This appears to be a bug, we have logged it in our tracking system. Following is a workaround that doesn't rely on Maple:

$null=0;

$nullstring=if($null,"$null","0");

It sets the string to "$null" if $null is nonzero, and "0" otherwise.

Sincerely,

Carl

This does appear to be a bug in Maple TA's MathML rendering. Please note that substantial changes to math rendering are in fact under development for next release of Maple TA, where in particular &#120083; should render fine:

Hi,

Maple TA's Equation Editor has an  button. And to add a second prime symbol, click the 'MathML' tab in the Equation Editor and change &prime; to &prime;&prime;.

Through LaTeX you may need to use $y\prime\prime$.

Sincerely,

Carl

Hi,

Maple tends to automatically simplify arithmetic expressions. So in a Maple-graded question, you could set your answer code to $a - ($b +($c)) / ($d-($e)), and the resulting simplified fraction gets stored as the correct answer, $ANSWER.

By the same token though, when student submits their response to the question, arithmetic expressions automatically simplify unless special care is taken in your Maple grading code. Here is one way:

  1. Compare student response and correct answer for mathematical equivalence; then
  2. Check student response for the desired form, a simplified fraction, by:
      2.1. Overriding arithmetic operators to prevent auto-simplification; then
      2.2. Checking for analogous pattern in the resulting expression.

An alternative form-checking technique involves treating the student response as a string rather than a mathematical expression, but that doesn't generally extend well to more complex patterns.

To use the grading code below as is, be sure to select "Maple syntax" from the "type of expression you want to accept" menu, to prevent any pre-processing of student response before it reaches Maple.

B := evalb(simplify(($ANSWER)-($RESPONSE))=0):

if B=true then
  resp := eval(parse("use `^`=POW, `*`=MUL, `/`=INV,
          `+`=ADD, `-`=NEG in $RESPONSE end use:")):
  resp := applyrule(MUL(1,INV(n::posint))=INV(n), resp):
  #Example: $RESPONSE=-7/2 => resp=NEG(MUL(7,INV(2)))
 
  if type($ANSWER,integer) then m := 'a'::nonnegint:
  else m := MUL('a'::posint, INV('b'::posint)):
  end if:
  B := typematch(resp, {m,NEG(m)}) and gcd(max(a,1),b)=1:
end if:

B;

Documentation on the commands used here can be found in Maple's Help system:
http://www.maplesoft.com/support/help/

 

Hi,

Your question parts appear to ask for either a number or list of numbers, to be graded per a specified tolerance for error. This is is indeed possible in Maple T.A.

If you are using Maple T.A. and have specific questions regarding how to implement your question, please contact support@maplesoft.com for assistance.

Thank you.

Hello,

To plot the point ($a, $b) you can change your $plot1 variable to:

$plot1=plotmaple("plots[pointplot]([[$a,$b]],symbol=circle)");

You can find documentation on pointplot and other Maple commands at

http://www.maplesoft.com/support/help/

Sincerely,

Carl

Hello,

Please attempt the roster delete again, then send the Tomcat log files to our technical support team at support@maplesoft.com and let us know the time when you attempted the roster delete action. It would be helpful if you could provide us with the roster file itself as well.

Thank you.

Carl

Hello,

What is the full argument you are supplying to \maple*{...}?

Carl

Dear Talzc,

Do you just need to add some text to your Maple T.A. Class Homepage? There is no interface inside Maple T.A. itself for doing this, so the adjustment would have to be made on the server. 

Please email us at support@maplesoft.com so that we can better assist you on the matter.

Thank you.

Dear Mike,

With 'Keyword' search you can find any questions in your class that contain a specific word within the text of the question. The entire question text is searched for that word, rather than assigning keywords to the questions themselves. Currently this is a case-sensitive search.

The internal question ID's stored in the dabase cannot be seen within the Maple T.A. interface.

Sincerely,

Carl

1 2 Page 1 of 2