# [LON-CAPA-dev] How does formularesponse work

Peter Riegler lon-capa-dev@mail.lon-capa.org
Thu, 24 May 2007 10:02:48 +0200

```Guy Albertelli II wrote:

> Hi Peter,
>
>
>>PS: Funny though that wrong responses are graded as correctly ...
>
>
> If I sample at x=2,y=2
>
> sin(x) == sin(y)
>
> Doesn't it?

Ehm, I think so.
Sorry, sometimes I need to be told twice.
I was still under the impression that code wise we have nested loops
>>>x,y@-3,-3,;2,2#4
>>>
>>>Will sample at x=-3,y=-3, and x=2,y=2
makes it clear that we have a single "loop"

>
>
>
>
>>Guy Albertelli II wrote:
>>
>>
>>>Hi Peter,
>>>
>>>Looks like a typo.
>>>
>>>
>>>
>>>>we have a problem using formula response here, which brings up the
>>>>question how it works internally. Unfortunately, I am not really capable
>>>>of understanding what is going on in caparesponse.pm.
>>>>
>>>>So far, my idea of formularesponse has been that it runs nested
>>>>for-loops w.r.t. the sampling variables. For instance,
>>>>
>>>>
>>>>should result in something like
>>>>
>>>>for each x value
>>>>   for each y value
>>>>       check whether \$answer evaluated at x and y equals
>>>>		response evaluated at x an y
>>>>       if not break out of the for loops and return false
>>>>   end
>>>>end
>>>
>>>
>>>Yes, it should, however you have a ; where you want a :
>>>
>>>x,y@-3,-3,;2,2#4
>>>
>>>Will sample at x=-3,y=-3, and x=2,y=2
>>>
>>>x,y@-3,-3:2,2#4
>>>
>>>Will sample at 4 random points in the box defined by -3 <= x <= 2, and
>>>-3 <= y <= 2
>>>
>>>
>>>
>>>><formularesponse samples="x,z,t,C@-3,-3,-3,-3;2,2,2,2#4"
>>>
>>>
>>>and similarly here there is a ; where you likely want a :
>>
>>--
>>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
>>_______________________________________________
>>LON-CAPA-dev mailing list
>>LON-CAPA-dev@mail.lon-capa.org
>>http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
>>
>
>

--
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

```