Step function

From JSXGraph Wiki
Jump to: navigation, search

This is an example for a step function realized as function graph. The steps are not drawn. JSXGraph has its own element "stepfunction", where the steps are visible, see Step function II.

The underlying JavaScript code

var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,8,8,-5], axis:true});

var f = function(x) {
    return -1;
  if(x>=0 && x <2)
    return 1;
    return 2;