# [LON-CAPA-users] functionplotresponse problems

Lucas, Mark lucasm at ohio.edu
Sun Jun 2 16:26:17 EDT 2019

```Hon-Kie,

There must be some in Gerd’s area or his former student’s authoring
space, but I can’t remember his student’s name.

Gerd has some function plotting (not vectors) in:
/res/msu/kortemey/physicsprecourse/graphing/

If you’re looking for really simple stuff, I’ve created a singlearrow set of routines
that take a static imaged and allow you to resize and rotate the arrow, but not drag
it. This was based off some code Wolfgang Bauer shared at the conference a few
years ago.
Here is one example:
/res/ohiou/physicslib/practice/09_Newtons_Laws/Book on the ceiling - normal force.problem

Copied below is a free-body diagram for an incline that I think came from one
of Gerd’s sample problems:

————————
<problem>
<script type="loncapa/perl">\$slope=&random(0.5,0.8,0.1);
\$function="2+\$slope*x";
\$massx=&random(3.5,6.5,0.1);
\$massy=2.1+\$slope*\$massx;
\$angle=180.*atan(\$slope)/\$pi;
\$perp=\$angle+90.;</script>
<startouttext />
A mass is sliding down the indicated incline with a constant velocity. Construct the free body diagram, making sure the forces are approximately proportionally correct. Leave unused vectors unattached.<br />
<i>You can use the red-colored vector sum tool to help you construct your diagram; check the boxes for the vectors you want included in the sum. The tool is just there to help you, its settings are not graded.</i>
<br />
<endouttext />
<functionplotresponse xaxisvisible="no" xlabel="x" gridvisible="yes" ylabel="y" id="11" xmax="10" yaxisvisible="no" xmin="0" ymin="0" ymax="10" width="450" height="450">
<functionplotelements>

<backgroundplot function="\$function" fixed="yes" />
<plotobject label="Mass" x="\$massx" y="\$massy" />
<plotvector label="Gravity" tailx="7" taily="1" tipx="8" tipy="1" />
<plotvector label="KineticFriction" tailx="7" taily="2" tipx="8" tipy="2" />
<plotvector label="StaticFriction" tailx="7" taily="3" tipx="8" tipy="3" />
<plotvector label="NormalForce" tailx="7" taily="4" tipx="8" tipy="4" />
<drawvectorsum label="Sum" tailx="\$massx" taily="\$massy" showvalue="no" vectorlist="Gravity,KineticFriction,StaticFriction,NormalForce" />
</functionplotelements>
<functionplotruleset>
<functionplotvectorrule index="Grav" vector="Gravity" attachpoint="Mass" angle="270" angleerror="2" />
<functionplotvectorrule index="Norm" vector="NormalForce" attachpoint="Mass" angle="\$perp" angleerror="4" />
<functionplotvectorrule index="KFriction" vector="KineticFriction" attachpoint="Mass" angle="\$angle" angleerror="3" />
<functionplotvectorrule index="SFriction" vector="StaticFriction" notattachpoint="Mass" />
<functionplotvectorsumrule vectors="Gravity,NormalForce,KineticFriction" length="0" lengtherror="2" index="Total" />
</functionplotruleset>
<hintgroup showoncorrect="no">

<hintpart on="Grav">
<startouttext />Gravity acts on the mass and points straight down.<endouttext />
</hintpart>
<hintpart on="SFriction">
<startouttext />The mass is sliding.<endouttext />
</hintpart>
<hintpart on="Total">
<startouttext />What should be the net force on the mass?<endouttext />
</hintpart>
<hintpart on="Norm">
<startouttext />What should be the direction of the normal force?<endouttext />
</hintpart>

</hintgroup>
</functionplotresponse>
</problem>

—————————————

Hope this helps some,
Mark

> On Jun 1, 2019, at 12:10 PM, H. K. Ng <hkng at fsu.edu> wrote:
>
> Good morning,
>
> I am looking for examples of functionplotresponse problems (one where a student can resize/drag a vector,..) Let me know if you don't mind sharing the source codes. Thanks.
>
> Regards,
> -hk
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org