Step function

From JSXGraph Wiki
Revision as of 17:39, 16 May 2010 by Michael (talk | contribs) (New page: <jsxgraph width="600" height="400"> 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) ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The underlying JavaScript code

<input type="text" id="input" value="sin(x)*x">
<input type="button" value="plot" onClick="plotter()">
<input type="button" value="clear all" onClick="clearAll()">
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]);