(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Formula response questions with XML example
<problem >
<script type="loncapa/perl">
        $coeff1=&random(1,5,.1);
        $coeff2=&random(1,5,.1);
        $power1=&random(1,4,1);
        $power2=&random(1,4,1);
        $answer="$coeff1*x^$power1+$coeff2*y^$power2";
</script >
<startouttext />Answer is <m eval="on">$ $answer $</m ><endouttext />
<formularesponse samples="x,y@1,-1:3,10#10;10,1.01:1000,-1000#4" answer="$answer">
    <responseparam name="tol" type="tolerance" description="Numerical Tolerance"
default="1%" />
    <textline size="50" />
    <hintgroup >
    </hintgroup >
</formularesponse >
</problem >


The samples is supposed to be the points you sample the equation
at. It lists the variables first (comma seperated) then an @ then

(
  (a comma seperated list of numbers equal to the number of variables)
 or
  (a comma seperated list of numbers equal to the number of variables,
  followed by an : followed by a comma seperated list of numbers equal
  to the number of variables, followed by a # folowed by an integer)
)

Then optionally a ; and more of the numbers
[Append to This Answer]
Previous: (Answer) tolerance?
Next: (Answer) How do I put a table in my problem?
This document is: http://help.loncapa.org/cgi-bin/fom?file=115
[Search] [Appearance] [Show This Answer As Text]
This is a Faq-O-Matic 2.719.
This FAQ administered by the LON-CAPA team at MSU. Submit a help request ticket to contact us.