## WeBWorK Main Forum

### fun_cmp evaluation points

by Arnold Pizer -
Number of replies: 2
Here is a question emailed to us by Daniel A. Graham from Duke.

1. When both absolute and relative tolerance are specified as they are, I believe, by default, must a correct answer satisfy both or either?

2. When the default number of points is in effect for fun_cmp, 3 I think, and there are two variables, say x and y, I understand that 3 values for x are selected, call them x1, x2 and x3, and 3 values for y, call them y1, y2 and y3. Are the correct and student answers compared at the three points (x1, y1), (x2, y2) and (x3, y3) or at the nine points (x1, y1), (x1, y2), (x1, y3), ..., (x3, y3)?
In reply to Arnold Pizer

### Re: fun_cmp evaluation points

by Arnold Pizer -
> 1. When both absolute and relative tolerance are specified as they are, I believe, by default, must a correct answer satisfy both or either?

It's either one or the other (not both) and relative tolerance is the default.

> 2. When the default number of points is in effect for fun_cmp, 3 I think, and there are two variables, say x and y, I understand that 3 values for x are selected, call them x1, x2 and x3, and 3 values for y, call them y1, y2 and y3. Are the correct and student answers compared at the three points (x1, y1), (x2, y2) and (x3, y3) or at the nine points (x1, y1), (x1, y2), (x1, y3), ..., (x3, y3)?

I didn't know the answer to this so I checked by using the very useful
diagnostics tag introduced by Davide Cervone. The answer is (x1, y1),
(x2, y2) and (x3, y3) which you can find as follows:

ANS(fun_cmp("xy", var=>2, diagnostics=>1));
and then submitting an answer gives:

Only formulas with one variable can be graphed at

Diagnostics for x*y:

(x,y): (0.4170000166,0.564999987) (0.6859999628,0.5569999886) (0.8059999388,0.9619999076)

Correct Answer: 0.235605 0.382102 0.775372
Student Answer: 0.235605 0.382102 0.775372
Absolute Error: 0 0 0
Relative Error: 0 0 0

Arnie
In reply to Arnold Pizer

### Re: fun_cmp evaluation points

by Davide Cervone -
For fun_cmp(), if you provide both a tol and relTol value, the tol value will take precedence, so absolute tolerances will be used.

On the other hand, for num_cmp() and its brethren, supplying both tolerances will generate an error message. It would probably be good if fun_cmp() did the same.

If you use MathObjects, the tolerance type is set by using tolType=>"absolute" or tolType=>"relative", so there is no ambiguity, as there is no way to specify both at once.

Davide