Step function

From JSXGraph Wiki
Revision as of 14:01, 8 June 2011 by Michael (talk | contribs)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The underlying JavaScript code

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

var f = function(x) {
  if(x<0)
    return -1;
  if(x>=0 && x <2)
    return 1;
  if(x>=2)
    return 2;
}
board.create('functiongraph',[f]);