The exercise type 'Input Function Graph' lets users draw a function in a graph draw a function in a graph 

This exercise type lets the student draw a piecewise linear function. In contrast to other exercise types, all solution rules that are defined here must be met for the student answer to be accepted as the correct one. Positive and negative rules can also be used to give feedback to the student. Have a look at the exercise [templates] (when you create a new exercise) for some examples.

Graph Show

The graph show text field needs to have at least a range and preferably (it is hard to draw on the edges) also a canvas defined, where the range specifies what part of the graph is visible and the canvas specifies in what part of the range the student can draw. If the 'canvas' is not defined, the range will be used instead, but this is not advised. All other graph show elements as listed above under input graphs can also be used. Make sure that the function that needs to be drawn is always within the canvas, otherwise the evaluation will not work correctly. For example: [range;-1;10;-1;10];[canvas;0;10;0;10], for the function x but not for x+5

Answer

The answer is a list of the points that the student entered, ordered by increasing value of their first coordinates. Two additional points are added where the piecewise linear function enters, respectively, exits the canvas. If the student draws on the edges of the canvas, the points are also added, resulting in double points in the list. This is done to keep the number of points that the author can expect consistent. e.g. [[x1,y1],[x2,y2],[x3,y3]]

Evaluation

The evaluation type function graph allows three types of evaluation: functions, points, and segment direction. Each requires its own syntax, as described under Definition. Additionally, the evaluation check can be written manually with evaluation type eval statement, where the student answer is the list of points as described above. e.g. is(length(answer) > 4) in order to check that at least 3 points have been drawn (best used in positive feedback rule) (the answer will then have at least 5 points as two points are automatically added).

Domain

For functions, points, and segment direction, the domain works the same. All solution / feedback rules are specific to a certain domain (not when using evaluation type eval statement). If the student did not enter any points in that domain, the points not in the domain are replaced by the nearest points within the domain. In the Range low and Range high the minimum and maximum value respectively of the xx-coordinates of the domain is specified. The extreme yy-values of the range can also be specified. They should be separated from the xx-range by a comma in the same range field. If the yy-ranges are not specified, they are taken from the y-min and y-max values from canvas (or if there is no canvas, from range) in graph show. Specifying a proper range is important for the Precision to work well. It is advised to specify the yy-values close to the minumum and the maximum of the function in the domain. e.g. Range low 0,8 and Range high 5,15 means that the rule applies for the domain where x>=0 and x<=5 and y>=8 and x<=15 This means that between x>=0 and x<=5 the function lies within y>=8 and y<=15 and that this area will be used for the Precision.

Precision

For functions, points, and segment direction, the Precision works differently.

functions The precision is important here, because a student cannot draw real curves and therefore (when the correct answer is a curve) his input is an approximation. The precision is a margin of error in percentages, where 0 means the answer must be a 100% correct. The percentage represents the ratio between the L2-norm of the difference between the function in the Definition field (or a best fit, when using a function class) and the piecewise linear function that is given by the student. The best fit minimizes the sum of the square of the differences between the correct answer and the given answer. The result is a difference area that is normalized against the rectangle given by the xx and yy Domain. The normalized value is compared against the Precision. These values are shown in the Author log.

Here's an example of a simple calculation its corresponding picture picture where the Definition is 12⋅x12⋅x in 0≤x≤100≤x≤10 and 0≤y≤100≤y≤10. while the student drew x.

    answerpoints:       [[0,0],[0,0],[5,5],[10,10]];
    bestFitAnswer:      x;
    definition:         1/2*x;
    differencesArea:    integrate((definition-bestFitAnswer)^2, x, 0, 10);
    normalized:         float(1- sqrt(differencesArea / ((10-0)*(5-0)^2) ));

(answerpoints)  [[0,0],[0,0],[5,5],[10,10]]
(bestFitAnswer) x
(definition)    x/2
(differencesArea)   250/3
(normalized)    0.4226497308103741

points The precision is the maximum distance that is allowed between one of the points in the answer and the corresponding point(s) of the Definition.

segment direction

Here, the Precision is a failure tolerance. It is the number of segments that is allowed to fail the condition from the Definition before the rule is triggered.

Definition

Use evaluation type function graph for these function comparisons.

  1. the input can be compared to a function rule in xx. Enter the function rule in xx in maxima syntax in the Definition field. Use the Precision as a margin of error. e.g. 3*x+2
  2. the input can be compared to a class of functions in xx Enter the function in xx in maxima syntax in the Definition field. Use the Precision as a margin of error. Use variables names other than x for all parameters that need to be estimated to best fit the function from the Definition to the points in the answer, as determined by the method of least squares.e.g.a for a constant valuea*x+b for a line a*(x-b)^2-c for a parabola
  3. the input can be compared to a class of functions in xx, where specific conditions must be met. This is the same as the above, but with an extra condition for certain parameters after a ; also in maxima syntax. the Precision is ignored here.e.g.a; a >= 1.5 and a <= 2.5 for a constant value between 1.5 and 2.5 ora*x+b; a > 2 and a < 4 and b = 2 for a line with a slope between 2 and 4 a yy-intercept of 2. or a*(x-b)^2-c;a>0 for a parabola that is concave up

points

The Definition is a list of one or more points in the [x,y] format, separated by a ;. For each point it is checked whether there is at least one point in the answer of the student that lies within the distance of the Precision. e.g. [5,5] or [1,1];[2,2]

segment direction

The Definition is one of the values underneath that specifies the relation between the yy-values of the points that are ordered by increasing value of their first coordinates. Use the following to check whether the yy-values of the consecutive points are always

  • < or increasing = increasing
  • <= or weak_increasing = weakly increasing
  • > or decreasing = decreasing
  • >= or weak_decreasing = weakly decreasing
  • = or constant = constant

Use the Precision to specify the number of pairwise points comparisons that can fail before the check fails.

Graph Solution

The graph solution field can be used to draw the correct function(s) when the student finishes. Here you can insert a correct solution in javascript syntax on a certain domain with the syntax function1,xmin,xmax;function2,xmin,xmax. e.g. Math.sin(x)+3,0,5;x/5+1,5,10

Author log

For functions, points, and segment direction, there is an author log available to see what is going on. There's always a solution rule whether the rule was triggered, a comparison and a value

functions

  1. comparison = (100 - Precision ) / 100, value = normalization of the difference area
  2. comparison = (100 - Precision ) / 100, value = normalization of the difference area
  3. comparison = variables resulting from the best fit, value = condition

points Per point there's a log line where comparison = target point, value = evaluation per point in the answer of the student

segment direction comparison = Precision, value = number of segments that do not pass the rule.

Did this answer your question?