File:  [LON-CAPA] / loncom / homework / templates / functionplotone.problem
Revision 1.1: download - view: text, annotated - select for diffs
Thu Nov 11 03:53:33 2010 UTC (13 years, 6 months ago) by www
Branches: MAIN
CVS tags: HEAD
* Implement tolerance on rule-level
* Template

    1: <problem>
    2: <script type="loncapa/perl">$maxacc=&random(3,5,1);
    3: $maxbraketime=&random(6,10,2);</script>
    4: <startouttext />
    5: At t=0 s, a car cruises at a constant positive velocity. Suddenly, a light switches to red. At t=$maxbraketime s, the driver is maximum on the brake. The car then stops in front of the red light for a while. Eventually, it drives off, and then again cruises at a constant velocity. Provide a graph of its acceleration as a function of time. The car cannot accelerate with more than $maxacc m/s<sup>2</sup>.<br />
    6: <endouttext />
    7: <functionplotresponse xaxisvisible="yes" xlabel="t [s]" gridvisible="yes" ylabel="a(t) [m/s^2]" id="11" xmax="30" yaxisvisible="yes" xmin="-4" ymin="-8" ymax="8">
    8: <spline initx="-2" inity="0" index="A" order="8" scalex="28" />
    9: <functionplotrule relationship="eq" xinitiallabel="start" xfinallabel="brake" value="0" derivative="0" percenterror="1" />
   10: <functionplotrule relationship="eq" xinitial="0" value="0" derivative="0" percenterror="1" />
   11: <functionplotrule relationship="lt" xinitiallabel="brake" xfinallabel="stop" value="0.1" derivative="0" />
   12: <functionplotrule relationship="eq" xinitial="$maxbraketime" value="0" derivative="1" percenterror="40" />
   13: <functionplotrule relationship="eq" xinitiallabel="stop" xfinallabel="driveoff" value="0" derivative="0" percenterror="1" />
   14: <functionplotrule relationship="gt" xinitiallabel="driveoff" xfinallabel="cruise" value="0.1" derivative="0" />
   15: <functionplotrule relationship="le" xinitiallabel="driveoff" xfinallabel="cruise" value="$maxacc" derivative="0" />
   16: <functionplotrule relationship="eq" xinitiallabel="cruise" xfinallabel="end" value="0" derivative="0" percenterror="1" />
   17: </functionplotresponse>
   18: </problem>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>