Intersection of functiongraphs: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
(Simplify from JSX.Math.Clip to curveintersection, but also the old code shaded the WRONG area.) |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
}); | }); | ||
var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false | var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false}); | ||
var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false | var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false}); | ||
var clip = board.create('curveintersection', [curve1, curve2], { strokeWidth: 2, fillColor: 'yellow', fillOpacity: 0.3 }); | |||
var | |||
} | |||
</jsxgraph> | </jsxgraph> | ||
Line 40: | Line 18: | ||
}); | }); | ||
var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false | var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false}); | ||
var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false | var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false}); | ||
board. | var clip = board.create('curveintersection', [curve1, curve2], | ||
{strokeWidth: 2, fillColor: 'yellow', fillOpacity: 0.3 }); | |||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Curves]] | [[Category:Curves]] |
Latest revision as of 18:54, 18 July 2024
The underlying JavaScript code
var board = JXG.JSXGraph.initBoard('jxgbox', {
axis:true,
boundingbox:[-5, 10, 10, -5]
});
var curve1 = board.create('functiongraph', ['x^2-2'], {strokeColor: 'blue', fixed: false});
var curve2 = board.create('functiongraph', ['4/x', 0.001, 20], {strokeColor: 'black', fixed: false});
var clip = board.create('curveintersection', [curve1, curve2],
{strokeWidth: 2, fillColor: 'yellow', fillOpacity: 0.3 });