# [LON-CAPA-users] Understanding formularesponses

Peter Riegler lon-capa-users@mail.lon-capa.org
Mon, 08 Sep 2008 13:47:35 +0200

```Hi,

I agree with Justin that sampling is the easiest (and most efficient)
approach. Using maxima you would have to use mathresponse with a program
code like
tol:0.001;
is(RESPONSE[1]=log(2)) or is( abs(RESPONSE[1]-log(2)) <= tol);

Logically all boils down to the 2nd "is" statement, which is exactly
what formula response w/ sampling does.

Peter

Justin Gray wrote:

> Hi Ray,
>
> If you want to allow a numerical approximation to log(2) as a correct
> answer, then I recommend that you use point sampling rather than a
> computer algebra system to evaluate the answer. Try this:
>
> <problem>
> <part><startouttext />Numerical Tolerance works well with formula
> response when point sampling is used. Either log(2) or 0.6931 are graded
> correct:<endouttext />
>
>     <responseparam description="Numerical Tolerance" type="tolerance"
> default="0.0001" name="tol" />
>
> </formularesponse>
> </part>
>
> <part><startouttext />Numerical Tolerance does not seem to work well
> with formula response when the expression is evaluated in Maxima. This
> time log(2) is correct but 0.6931 is graded as incorrect:<endouttext />
>     <responseparam description="Numerical Tolerance" type="tolerance"
> default="0.0001" name="tol" />
>
> </formularesponse>
> </part>
> </problem>
>
> Justin
>
>
> On Sun, Sep 7, 2008 at 11:36 PM, Ray Batchelor <batchelo@sfu.ca
> <mailto:batchelo@sfu.ca>> wrote:
>
>
>     How would you create a formula response question for which you want both
>     "log(2)" to be the answer both symbolically and numerically?
>
>     --
>     Ray
>
>
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Justin Gray
> Dept. of Mathematics
> Simon Fraser University
> 8888 University Drive
> Burnaby, B.C. V5A 1S6
> Tel. +1 778-782-4237
> Fax. +1 778-782-4947
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> http://www.terryfoxrun.org/ENRunner/default.asp?s=1&RunnerID=56229
> <http://www.terryfoxrun.org/ENRunner/default.asp?s=1&RunnerID=56229>
>
>
>

--
Peter Riegler
Fachhochschule Braunschweig/Wolfenbüttel
Salzdahlumer Str. 46/48, 38302 Wolfenbüttel
Tel. +49 5331 939 6314, Fax. +49 5331 939 6002
email: p.riegler@fh-wolfenbuettel.de
http://public.rz.fh-wolfenbuettel.de/~riegler

```