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

**Guy Albertelli II
**
lon-capa-dev@mail.lon-capa.org

*Wed, 23 May 2007 12:51:19 -0400 (EDT)*

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?
>*
*>* 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,
*>* >>
*>* >><formularesponse samples="x,y@-3,-3,;2,2#4" answer="$answer" id="11">
*>* >>
*>* >>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"
*>* >>answer="$integral" id="11">
*>* >
*>* >
*>* > 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
*>*
*
--
guy@albertelli.com 0-7-0-9-27,137