 SolveFeedback - Maple Help

 SolveFeedback
 generate feedback for a step-by-step solution Calling Sequence SolveFeedback(solution,options) Parameters

 solution - solution steps {canvas-string,table,rtable,list} options - (optional) equation(s) of the form option = value where option is one of variables, equations, or solutions Options

 • variables = list, the variable to solve for
 • equations = list, the initial expression
 • solutions = list, the solutions that are relevant
 • group = integer or set of integers, restrict the elements to inspect to the specified group(s)
 • correcteq = truefalse, indicate whether to display "correct equation" message
 • filter = set(equation), input element filters passed to GetMath
 • output = default, list or canvaslist, specify an output format
 • cursorgroup = truefalse, when true consider only elements in the group containing the cursor (Maple Learn only) Description

 • The SolveFeedback command is the procedure behind the SolvePractice command.  It analyzes a step-by-step solution to the given problem and provides feedback for each step of the solution.  It can also be called directly, or used behind the scenes for other interactive applications of your own design.
 • The solution argument, when part of an interactive canvas-based application, is a XML-based string representing a canvas, or a table representing the embedded component name mapping.  In this case, the returned result is a DocumentTools:-Canvas:-Script.
 When called directly, solution can also be a list or array of expressions.  In this case, the returned result is a list of feedback strings.  The result has one extra string than the number of input steps, concluding with a (possibly empty) summary statement.
 • The variables = [x] option is useful to provide when the expression to solve for is multivariate.  This clarifies exactly which variable is to be solved for.  The list must contain exactly one variable.
 • The solutions = [x=0] option allows you to specify which solutions are relevant to the given problem, in order to avoid feedback that prompts to solve for more solutions.
 • The equations = [...] option allows you to specify the initial expression, as opposed to showing it as the first expression in a canvas.  This way it is up to the user to come up with the equation themselves.
 • When the optional argument, group=1, or group={2,3} is specified in conjunction with a canvas-based solution input, only the specified elements in the given group or groups will be considered when generating feedback.
 • The output option can be set to default, list, or canvaslist.  When solution is a canvas, the default action is to generate a Script, which will be applied to the active Canvas.  Otherwise, when solution is an Array or list, the default output is a list of strings.
 Use output = list to force list-of-strings output even when solution is a canvas.
 Use output = canvaslist to return a list of [string,record] pairs, when solution is a canvas. This returns a list of lists, where the [i,1] element is a feedback comment string, and the [i,2] element is the canvas record-object that identifies the expression for which the feedback applies.  The record-object can be inspected as per any object returned by GetMath, or it can be passed as an argument to some Script commands like Annotate.
 • By default, SolveFeedback can give messages identifying "this is a correct equation" intended for cases when the input equation is hidden and the user must provide the equation.  In cases where the equation is visible, use the option correcteq=false to show simple "Ok" messages instead.
 • The filter option applies to canvas-based input, and will cause the canvas elements to be pruned if they match the given specified properties.  For example, 'filter'={'readonly'=true} will prune out all math containers that have their readonly property set to true. Examples Feedback

 • In this section we call the SolveFeedback command directly with a list of inputs, where the second item through to the end of the list represents steps towards solving the first expression in the list.  The result returned is a list of strings.
 > $\mathrm{with}\left(\mathrm{Grading}\right):$
 > $\mathrm{SolveFeedback}\left(\left[2x+3=4x-5,2x-4x=-5-3,-2x=-8,x=4\right]\right)$
 $\left[{""}{,}{"Ok"}{,}{"Ok"}{,}{"Good job, this is the correct solution"}{,}{"Great! You found the correct solution"}\right]$ (1)
 > $\mathrm{SolveFeedback}\left(\left[2x+3=4x-5,2x-4x=-5+3,-2x=-2,x=1\right]\right)$
 $\left[{""}{,}{"Check this step"}{,}{"Ok"}{,}{"Ok"}{,}{"Please try again. This is not the correct solution"}\right]$ (2)
 > $\mathrm{SolveFeedback}\left(\left[2x+y=4y,2x=3y,y=\frac{2x}{3}\right],\mathrm{variables}=\left[y\right]\right)$
 $\left[{""}{,}{"Ok"}{,}{"Good job, this is the correct solution"}{,}{"Great! You found the correct solution"}\right]$ (3) Interactive Canvas-Based Interface

 • In this example we create an interactive canvas presenting a word problem.  The input equation is not shown.  Note that the t=-2.5 root is not part of the solutions list, as it does not make physical sense.
 > $\mathrm{with}\left(\mathrm{Grading}\right):$
 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Canvas}\right):$
 > $\mathrm{cv}≔\mathrm{NewCanvas}\left(\left[\mathrm{Text}\left("Kiera throws a ball in the air from a 11-meter tall structure. The height of the ball in meters is described by the equation %1. Her brother, Paul, catches the rock just before it hits his head. Paul is 152 cm tall and is standing on the ground. How long was the rock in the air?",s\left(t\right)=-{t}^{2}+2t+12.77\right),\mathrm{ScriptButton}\left("Check My Work","Grading\left[SolveFeedback\right]\left(_canvas,equations=\left[-t^2 + 2*t + 12.77 = 1.52\right],variables=\left[t\right],solutions=\left[t=4.5\right]\right);",\mathrm{position}=\left[800,90\right],\mathrm{encode}=\mathrm{false}\right)\right]\right):$
 > $\mathrm{ShowCanvas}\left(\mathrm{cv},\mathrm{input}=\left["-t^2 + 2*t + 12.77 = 1.52","-t^2+2*t+11.25 = 0",t=\frac{\left(-2\right)±\left(\sqrt{{2}^{2}+4\cdot 1\cdot 11.25}\right)}{-2\cdot 1},t=-2.5,t=4.5,t\ne -2.5\right]\right)$
 • The feedback can be generated directly as follows:
 > ${\mathrm{Grading}}_{\mathrm{SolveFeedback}}\left(\left["-t^2 + 2*t + 12.77 = 1.52","-t^2+2*t+11.25 = 0",t=\frac{\left(-2\right)±\left(\sqrt{{2}^{2}+4\cdot 1\cdot 11.25}\right)}{-2\cdot 1},t=-2.5,t=4.5\right],\mathrm{equations}=\left[-{t}^{2}+2t+12.77=1.52\right],\mathrm{variables}=\left[t\right],\mathrm{solutions}=\left[t=4.5\right]\right)$
 $\left[{"Ok \left(this is the correct equation\right)"}{,}{"Ok"}{,}{"Ok"}{,}{"Ok"}{,}{"Good job, this is a correct solution"}{,}{"Almost there! Remove the steps that look like invalid solutions in this situation by stating t <> ..."}\right]$ (4)
 • The canvas can also be shared via Maple Learn:
 > $\mathrm{ShareCanvas}\left(\mathrm{cv}\right)$ Custom Feedback

 • In this example we create a custom canvas, where the final summary feedback will be directed to a specific spot on the canvas.  Also, as a demonstration, specific output is looked for in order to display a custom message.
 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Canvas}\right):$
 > $\mathrm{with}\left(\mathrm{Grading}\right):$
 > Check := proc( canvas )    local feedback := SolveFeedback(canvas,'output'='canvaslist'):    local script := Script();    for local C in feedback do        local msg := C;        local obj := C;        if msg = "Ok" and value(obj:-math) = (factor(x^2-4)=0) then            msg := "Perfect -- you factored the expression";        end if;        SetActive(script,if(obj=[],"Summary",obj));        Annotate(script,msg);    end do;    ToString(script); end proc:
 > $\mathrm{cv}≔\mathrm{NewCanvas}\left(\left["Solve this equation:",{x}^{2}-4=0,\mathrm{Math}\left(\left(x-2\right)\left(x+2\right)=0,\mathrm{border}=\mathrm{true}\right),\mathrm{Math}\left(x=2,\mathrm{border}=\mathrm{true}\right),\mathrm{ScriptButton}\left("Check My Work",\mathrm{Check},\mathrm{position}=\left[500,90\right]\right),\mathrm{Math}\left("Feedback:",'\mathrm{custom}'="Summary",\mathrm{position}=\left[500,90\right]\right)\right]\right):$
 > $\mathrm{ShowCanvas}\left(\mathrm{cv}\right)$ Restricting input to a section of a canvas

 • In this example we split the answer areas for a system-of-equations solution into three groups.  Group and filter options are used to grab the input from a different specific column on the canvas for each section.
 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Canvas}\right):$
 > $\mathrm{with}\left(\mathrm{Grading}\right):$
 > $\mathrm{cv}≔\mathrm{NewCanvas}\left(\left["Solve System","Solve the system of equations 1 and 2 by first solving for x in column 1, then use that value in column 2 to solve for y, and finally find the value of x in column 3.",\mathrm{Group}\left(\left["Equation 1:","solve for x",\mathrm{Math}\left(x-y=2,\mathrm{readonly}\right),\mathrm{seq}\left(\mathrm{Math}\left("",\mathrm{border}\right),i=1..3\right)\right],\mathrm{position}=\left[30,200\right]\right),\mathrm{ScriptButton}\left("Check My Work 1",\mathrm{CheckWork},\mathrm{parameters}=\left[\left[x-y=2\right],1\right],\mathrm{position}=\left[30,460\right]\right),\mathrm{Group}\left(\left["Equation 2:","insert value of x","solve for y",\mathrm{Math}\left(x+y=2,\mathrm{readonly}\right),\mathrm{seq}\left(\mathrm{Math}\left("",\mathrm{border}\right),i=1..3\right)\right],\mathrm{position}=\left[300,200\right]\right),\mathrm{ScriptButton}\left("Check My Work 2",\mathrm{CheckWork},\mathrm{parameters}=\left[\left[y+2+y=2\right],2\right],\mathrm{position}=\left[300,460\right]\right),\mathrm{Group}\left(\left["Use the results from 1 and 2","to find the value of x",\mathrm{Math}\left(x=\mathrm{NULL},\mathrm{readonly}\right),\mathrm{seq}\left(\mathrm{Math}\left("",\mathrm{border}\right),i=1..3\right)\right],\mathrm{position}=\left[600,200\right]\right),\mathrm{ScriptButton}\left("Check My Work 3",\mathrm{CheckWork},\mathrm{parameters}=\left[\left[x=2\right],3\right],\mathrm{position}=\left[600,460\right]\right)\right]\right):$
 > $\mathrm{ShowCanvas}\left(\mathrm{cv}\right)$ Compatibility

 • The Grading:-SolveFeedback command was introduced in Maple 2021.