Inequalities: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
To graph inequalities of the form  
To graph inequalities of the form  
:<math> ay + bx + c <= 0 </math>
''ay + bx + c <= 0''
a line of the form
a line of the form
<source lang="javascript">
<source lang="javascript">

Revision as of 13:03, 16 December 2014

To graph inequalities of the form ay + bx + c <= 0 a line of the form

line = b.create('line', [c, b, a]);
ineq = b.create('inequality', [line]),

and an equality of this line have to be created. If one wants to show "greater than", inverse:true has to be used:

line = b.create('line', [c, b, a]);
ineq = b.create('inequality', [line], {inverse:true}),


The JavaScript code

var b = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 5, 5, -5], axis:true});
var c = b.create('slider', [[-3,4], [2,4], [-5,1,5]]),
    line1 = b.create('line', [function() { return [c.Value(), 0, -1]; }], {strokeColor: 'black'}),
    ineq1 = b.create('inequality', [line1], {inverse: true}),

    line2 = b.create('line', [1, 2, -3]), // Line y = 2/3 x + 1 or 0 = -3y + 2x +1
    ineq2 = b.create('inequality', [line2], {fillColor: 'yellow'});