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
PracticeSheet
Steps
Quiz
Next Steps
The SolvePractice command generates a canvas with SolveFeedback as the command behind the button.
with(Grading):
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'):
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);
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> );
•Let's find the determinant•Use cofactor expansion on the3by3matrix1⋅+−1⋅2⋅+1⋅4⋅•Find the determinant of the 2 by 2 matrices by multiplying the diagonals1⋅4⋅7−6⋅5+−1⋅2⋅3⋅7−5⋅5+1⋅4⋅3⋅6−5⋅4•Evaluate inside the brackets1⋅−2+−1⋅2⋅−4+1⋅4⋅−2•Multiply−2+8−8•Evaluate−2
Student:-LinearAlgebra:-DeterminantSteps( <1,2,4; 3, 4, 5; 5,6,7>, 'output'='link' );
Create Your Own Steps Output
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=<x=2,y=3>,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:
Student:-Basics:-OutputStepsRecord( rec, displaystyle=columns, animated=true, output=link );
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
with(Grading): with(DocumentTools:-Canvas):
cv := Quiz("Is 1 + 1 = 2? ", true, 'style' = truefalse, output=canvas):
ShowCanvas(cv, entrybox=false);
https://learn.maplesoft.com/#/?d=MNFHGFLQNPNIMOJNLFHOPGFQMKEPHLHNAHOUORFNHSOQAFJQNMNPDNDLOGNJIMPMITPSIKHGDRBPHLELEMGLCTKTLGGONSJOEKKH
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):
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);
See the BinomialQuiz example for a more in-depth sample with feedback and algorithmic variables.
Inspect and Annotate Math on a Canvas
Return to DocumentTools[Canvas] Overview Page
Download Help Document