(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Equation Entry Example

<problem>
<script type="loncapa/perl">
# Enter computations here 
$x1 = random(2,4,1);
$y1 = random(3,7,1);

$x2 = random($x1+1,9,1);
$y2 = random($y1+1,15,1);

$m = "($y2-$y1)/($x2-$x1)";
$b = "$y1-$m*$x1";
$answer = "$m*x+$b";
$answer =~ s/\+-/-/g;
$answer =~ s/-\+/-/g;
</script>

<startouttext />
<p>
What is the equation of the line which passess through ($x1,$y1) and ($x2,$y2)?
</p>
y = 
<endouttext />

<formularesponse samples="x@-5:5#11" id="11" answer="$answer">
    <textline size="25" />    
</formularesponse>

</problem>


hallmat3@msu.edu
[Append to This Answer]
Previous: (Answer) Can I create a problem which presents a choice from completely different questions?
Next: (Answer) When to use <display> tag
This document is: http://help.loncapa.org/cgi-bin/fom?file=223
[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.