(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Gnuplot Example 1
<problem>

<script type="loncapa/perl">
# Enter computations here
$m = random(-3,3,2);
$b = random(-4,3,1);
$equation = "$m*x+$b";
</script>

<gnuplot font="small" samples="100" width="500" grid="on" height="300"
         alttag="Linear Plot" border="on" fgcolor="x000000" 
         align="center" bgcolor="xffffff" transparent="off">
    <xtics 
        end=" 10.0" 
        location="border" 
        start="-10.0" 
        increment="1.0" 
        mirror="on" />
    <ytics 
        end=" 10.0" 
        location="border" 
        start="-10.0" 
        increment="1.0" 
        mirror="on" />
    <axis ymin="-4.0" ymax="4.0" xmin="-6.0" xmax="6.0" color="x000099" />
    <xlabel>X</xlabel>
    <ylabel>Y</ylabel>
    <curve linestyle="lines" pointtype="0" name="Line" color="x000000">
        <function>$equation</function>
    </curve>
    <curve 
         linestyle="lines"
         pointtype="1"
         pointsize="1"
         name=""
         color="x000000" >
        <data>-10,0,10</data>
        <data>0,0,0</data>
    </curve>
    <curve 
         linestyle="lines"
         pointtype="1"
         pointsize="1"
         name=""
         color="x000000" >
        <data>0,0,0</data>
        <data>-10,0,10</data>
    </curve>
</gnuplot>

<startouttext /><br />
What is the slope of the line graphed above?
<endouttext />

<numericalresponse answer="$m">
    <responseparam name="tol" type="tolerance" description="Numerical Tolerance" default="5%" />
    <responseparam name="sig" type="int_range,0-16" description="Significant Figures" default="0,15" />
    <textline />

</numericalresponse>
</problem>


hallmat3@msu.edu
[Append to This Answer]
Previous: (Answer) How can I create a dynamic plot of a piecewise defined function?
Next: (Answer) Gnuplot Example 2
This document is: http://help.loncapa.org/cgi-bin/fom?file=205
[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.