GenerateCanvas - Maple Help

Use of Canvas Elements in Maple Library Commands

In this page we will highlight a few of the commands that generate a Canvas suitable for use in both Maple and Maple Learn.

SolvePractice

The SolvePractice command generates a canvas with SolveFeedback as the command behind the button.

 > SolvePractice(2*x + 3 = 4*x - 5, x);



The canvas structure can be extracted directly by using the 'output'='canvas' option.

 > cv := SolvePractice(2*x + 3 = 4*x - 5, x, 'output' = 'canvas'):
 > DocumentTools:-Canvas:-ShowCanvas(cv);

You can also specify 'output'='link' to create a shared Maple Learn Document.

 > SolvePractice(2*x + 3 = 4*x - 5, x, 'output' = 'link'):

PracticeSheet

The PracticeSheet command allows for automatic pattern-based generation of many problems on a single sheet.

 > with(Student:-Basics):
 > cv := Student:-Basics:-PracticeSheet("integer/integer(range=2..5)+integer/integer(range=2..5)",  title = "Addition of Fractions",  message = "Add and reduce each expression",  output = canvas);
 > with(DocumentTools:-Canvas):
 > ShowCanvas(cv, entrybox = false);

 > ShareCanvas(cv);



Steps

Maple has many algorithms for showing step-by-step methods explaining how to simplify, solve, integrate, etc.  These solution steps can be generated as a canvas.

 > Student:-LinearAlgebra:-DeterminantSteps( <1,2,4; 3, 4, 5; 5,6,7> );
 $\begin{array}{lll}\text{â€¢}& {}& \text{Let's find the determinant}\\ {}& {}& \left[\begin{array}{ccc}{1}& {2}& {4}\\ {3}& {4}& {5}\\ {5}& {6}& {7}\end{array}\right]\\ \text{â€¢}& {}& \text{Use cofactor expansion on the}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}3\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}\text{by}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}3\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}\text{matrix}\\ {}& {}& \left[{}\right]\\ \text{â€¢}& {}& \text{Find the determinant of the 2 by 2 matrices by multiplying the diagonals}\\ {}& {}& \left[{}\right]\\ \text{â€¢}& {}& \text{Evaluate inside the brackets}\\ {}& {}& \left[{}\right]\\ \text{â€¢}& {}& \text{Multiply}\\ {}& {}& \left[{}\right]\\ \text{â€¢}& {}& \text{Evaluate}\\ {}& {}& {-2}\end{array}$ (3.1)
 > Student:-LinearAlgebra:-DeterminantSteps( <1,2,4; 3, 4, 5; 5,6,7>, 'output'='link' );

All of the Steps routines generate a series of records with math and annotations, and possibly one level of sub-steps.  These are processed by the OutputStepsRecord command.  Here is an example of a record with math, annotations, and substeps:

 > steps := [   Record(math=<2*x+5*y=19,x-2*y=-4>,annotation="solve system"),   Record(math=(x=2*y-4),annotation="solve equation 2 for x",          substeps=[              Record(math=(x-2*y=-4),annotation="equation 2"),              Record(math=(x=-4+2*y),annotation=_MTEXT("add %1 to both sides",2*y))          ]   ),   Record(math=(y=3),annotation="substitute value of x into equation 1 and solve",          substeps=[              Record(math=(2*x+5*y=19),annotation="equation 1"),              Record(math=(2 %* (2*y-4)+5*y=19),annotation="sub in value for x"),              Record(math=(4 %* y-8+5 %* y=19),annotation="expand"),              Record(math=(9*y-8=19),annotation="collect"),              Record(math=(9*y=27),annotation="add 8 to both sides"),              Record(math=(y=3),annotation="divide both sides by 9")          ]   ),   Record(math=(x=2 %* (3)-4),annotation=_MTEXT("substitute %1 into %2",y=3,x=2*y-4)),   Record(math=(x=2),annotation="simplify"),   Record(math=,annotation="solution") ]:
 > Student:-Basics:-OutputStepsRecord(steps);
 > cv := Student:-Basics:-OutputStepsRecord(steps,output=canvas):
 > DocumentTools:-Canvas:-ShareCanvas(cv);

The OutputStepsRecord command allows for different 'displaystyle' options.

 > rec := Student:-Calculus1:-ShowSolution( Int(  x*sin(x), x ), output=record ):
 > Student:-Basics:-OutputStepsRecord( rec, displaystyle=columns );

This example generates a link to Maple Learn with animated steps:$\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$

 > Student:-Basics:-OutputStepsRecord( rec, displaystyle=columns, animated=true, output=link );

Quiz

The Quiz command lets you create a variety of question types with options for custom grading procedures, feedback, and try-another generation.  Here are some samples:

True or False

 > cv := Quiz("Is 1 + 1 = 2? ", true, 'style' = truefalse, output=canvas):
 > ShowCanvas(cv, entrybox=false);

 > ShareCanvas(cv);

Multiple Choice and Multiple Select

 > cv := Quiz("Which of the following could be portions of the plot of sin(x)?", {1, 2}, [plot(sin(x), x = 0 .. rand(2 .. 3)()), plot(sin(x), x = rand(2 .. 3)() .. 5), plot(2*sin(x), x = rand(2 .. 3)() .. rand(4 .. 7)())], style = multipleselect, gradebyindex = true, size = [250, 150], output=canvas):
 > ShowCanvas(cv, entrybox=false);

 > ShareCanvas(cv);
 >

Free-Form Entry Box

 > cv := Quiz("Factor the expression completely:",   proc(Resp, Ans) evalb(factor(Ans) = Resp); end proc,   proc() local r; r := rand(1 .. 3)(); expand( r()*x*(r()*x + r())*(r()*x + r())); end proc, output=canvas):
 > ShowCanvas(cv,'entrybox'=false);

 > ShareCanvas(cv);

See the BinomiaQuiz example for a more in-depth sample with feedback and algorithmic variables.

 Next Steps