fb_vars - mkraska/meclib GitHub Wiki

Feedback for symbolic input

Checks for missing and spurious vars by comparing the lists of variables in tans and sans. If they match, then compares the terms with the variables in vars. Provide an empty list if you don't want this check (or just use two arguments).

If tans is zero, then no feedback is given.

fb_vars(sans, tans, vars, label) Returns the text to be displayed for feedback.

fb_varsOK(sans, tans, vars, label) Returns the test result (true/false). Note that this also returns true if the test is not done because tans is zero.

  • sans student's answer (usually the same as in the PRT node)
  • tans teacher's answer (usually the same as in the PRT node)
  • vars (optional) list with vars, for which a check of coefficient is made. If not needed but you want a label, set it to []
  • label (optional) Text to preceed the feedback text. Only used if there is actual feedback text (you won't get just the label with nothing to follow).

Returns a castext() expression in case anything is to say, otherwise returns an empty string ""

image

Based on this Github issue.

See also this Moodle forum post.

Question variables

German version:

stack_include("https://raw.githubusercontent.com/mkraska/meclib/main/Maxima/fb_value.mac");

English version:

stack_include("https://raw.githubusercontent.com/mkraska/meclib/main/Maxima/fb_value_EN.mac");

Feedback tree

{@fb_vars(sans, tans, vars, label)@}

If you don't want a label:

{@fb_vars(sans, tans, vars)@}

If you don't want a label and don't want to check the coefficients:

{@fb_vars(sans, tans)@}

If you want to check the coefficients of all variables:

{@fb_vars(sans, tans, listofvars(tans))@}`

Feedback for vector components in a matrix answer test. Labels are provided to specify to which component the feedback applies.

{@fb_vars(S_RF[1,1], RF[1,1], [],      "\\(x\\):")@}
{@fb_vars(S_RF[2,1], RF[2,1], [],      "\\(y\\):")@}
{@fb_vars(S_RF[3,1], RF[3,1], [q,F_1], "\\(z\\):")@}

STACK 4.3 (Legacy)

Issue: This does not work for special names like alpha, they aren't converted properly to TeX. Solved in 4.4.

Question Variables

fb_vars(%_sans,%_tans, [%_opt] ) := block([%_vars, %_label, %_tansvar,%_sansvar,%_extras, %_missing,simp, %_txt, %_L],
    if length(%_opt)>0 then %_vars: %_opt[1] else %_vars: [], 
    if length(%_opt)>1 then %_label: %_opt[2] else %_label: "",
    %_txt: %_label,
    simp: true, /* Extract vars with simp:true does mean that "x/x+y" -> [y] */
    %_sansvar: setify(listofvars(%_sans)),
    %_tansvar: setify(listofvars(%_tans)),
    /* Say nothing if tans is free of vars (e.g. because it is zero) */
    if emptyp(%_tansvar) then return(""),
    /* Check for spurious (extra) vars */
    %_extras: setdifference(%_sansvar, %_tansvar),
    if length(%_extras) > 0 then 
    %_txt: sconcat(%_txt," Unerwartete Variable: \\(", stack_disp_comma_separate(listify(%_extras)), "\\)." ),
    /* Check for missing vars */
    %_missing: setdifference(%_tansvar, %_sansvar),
    if length(%_missing) > 0 then 
    %_txt: sconcat(%_txt," Fehlende Variable: \\(", stack_disp_comma_separate(listify(%_missing)), "\\) (<code>", stack_disp_comma_separate(listify(%_missing)), "</code>)."  ),
    /* if set of vars is ok, then check for the terms with vars from given list (%_vars). */ 
    if %_txt # %_label then return(sconcat(%_txt, "<br>")),
    %_L: sublist (%_vars, lambda ([x], diff(%_sans-%_tans, x)#0)),
    if length(%_L)=0 then return( ""),
    if length(%_L)=1 then return(sconcat(%_label," Pr&uuml;fen Sie den Term mit \\(", %_L[1], "\\).<br>")),
    return(sconcat(%_label," Pr&uuml;fen Sie die Terme mit \\(",stack_disp_comma_separate(%_L ), "\\).<br>")),
  "" );

Feedback Node

{@fb_vars(sans, tans, vars, label)@}

If you don't want a label:

{@fb_vars(sans, tans, vars)@}

If you don't want a label and don't want to check the coefficients:

{@fb_vars(sans, tans)@}

If you want to check the coefficients of all variables:

{@fb_vars(sans, tans, listofvars(tans))@}`

Feedback for vector components in a matrix answer test. Labels are provided to specify to which component the feedback applies.

{@fb_vars(S_RF[1,1], RF[1,1], [],      "\\(x\\):")@}<br>
{@fb_vars(S_RF[2,1], RF[2,1], [],      "\\(y\\):")@}<br>
{@fb_vars(S_RF[3,1], RF[3,1], [q,F_1], "\\(z\\):")@}
⚠️ **GitHub.com Fallback** ⚠️