Inequalities: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 6: | Line 6: | ||
ineq = b.create('inequality', [line]), | ineq = b.create('inequality', [line]), | ||
</source> | </source> | ||
and an | and an inequality of this line have to be created. | ||
In case ''a = 0'', that is if the equation of the line is ''bx + c = 0'', the area of the inequality | |||
''bx + c <= 0'' is shown. | |||
If one wants to show "greater than", ''inverse:true'' has to be used: | If one wants to show "greater than", ''inverse:true'' has to be used: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
Line 16: | Line 20: | ||
The first, black line has the equation ''y = c'' or ''0 = -1y + 0x + c'', | The first, black line has the equation ''y = c'' or ''0 = -1y + 0x + c'', | ||
the second, blue line has the equation ''y = 2/3 x + 1'' or ''0 = -3y + 2x +1''. | the second, blue line has the equation ''y = 2/3 x + 1'' or ''0 = -3y + 2x +1''. | ||
<jsxgraph width="400" height="400" box="box1"> | <jsxgraph width="400" height="400" box="box1"> |
Revision as of 13:12, 2 June 2017
To graph inequalities of the form y <= b/a * x + c/a a line of the form
line = b.create('line', [c, b, a]);
ineq = b.create('inequality', [line]),
and an inequality of this line have to be created.
In case a = 0, that is if the equation of the line is bx + c = 0, the area of the inequality bx + c <= 0 is shown.
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}),
In the following example, two lines are shown. The first, black line has the equation y = c or 0 = -1y + 0x + c, the second, blue line has the equation y = 2/3 x + 1 or 0 = -3y + 2x +1.
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'});