Skip to content

Spline Example Question

mkraska edited this page Sep 21, 2026 · 1 revision

We want to create a question with a given a(t) graph. The user has to interactively build the according v(t) graph.

The question has two jsxgraph widgets in the question text and another one in the general feedback (correct solution).

We start with an empty STACK question.

Question Variables

The question variables specify the piecewise constant acceleration and the initial velocity. We will later randomize these values.

ti: [0,1,2,4];
ai: [-2,0,2];
v0: 2;

They also specify the reference solution. v(t) is piecewise linear, so we provide the polygon vertices

vi[1]: v0;
vi[2]: v0 + (ti[2]-ti[1])*ai[1];
vi[3]: vi[2] + (ti[3]-ti[2])*ai[2];
vi[4]: vi[3] + (ti[4]-ti[3])*ai[3];

minv: min(vi);
maxv: max(vi);
maxt: max(ti);

Question Text

We copy the standard JSXGraph block from the wiki MecLib-Question-Setup.

Input fields

Then press Check question text and update the fields and provide settings as given in the above wiki page.

Import the feedback function for splines as specified in Values-and-Slope-of-Splines.

Tryout Space

In order to try code snippets in jsfiddle,

  1. copy the code from the wiki page to the clipboard
  2. follow the link for the JSXGraph version you want to try
  3. Replace the code in the HTML section (contents of <p id="init">) with the content of the clipboard

The remaining jsfiddle pages don't seem to work any more (as of 04/26)

Clone this wiki locally