Step function: Difference between revisions
From JSXGraph Wiki
(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) ...) |
A WASSERMANN (talk | contribs) No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
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]]. | |||
<jsxgraph width="600" height="400"> | <jsxgraph width="600" height="400"> | ||
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,8,8,-5], axis:true}); | var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,8,8,-5], axis:true}); | ||
Line 13: | Line 15: | ||
</jsxgraph> | </jsxgraph> | ||
===The underlying JavaScript code=== | ===The underlying JavaScript code=== | ||
<source lang="javascript"> | <source lang="javascript"> | ||
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,8,8,-5], axis:true}); | var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,8,8,-5], axis:true}); |
Latest revision as of 08:03, 10 April 2014
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) {
if(x<0)
return -1;
if(x>=0 && x <2)
return 1;
if(x>=2)
return 2;
}
board.create('functiongraph',[f]);