<iframe src="https://www.jsxgraph.uni-bayreuth.de/share/iframe/shade-region-bounded-by-curves" style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" name="JSXGraph example: Shade region bounded by curves" allowfullscreen ></iframe>
<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; "> <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div> </div> <script type = "text/javascript"> /* This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'board-0'; const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-1, 2, 2, -1], axis: true }); // 1. We need the mutual intersections of the curves. // However, only one intersection is not obvious. // Numerically compute intersection of the first two curves, 'sqrt(x^2-1)' and '0.707*x' var diff = x => Math.sqrt(x * x - 1) - 0.707 * x; var x_intersect = JXG.Math.Numerics.root(diff, 1.5); // 2. Plot curves only up to the mutual intersections // We use JessieCode for the function terms var curve1 = board.create('functiongraph', ['0', 0, 1]); var curve2 = board.create('functiongraph', ['sqrt(x^2-1)', 1, x_intersect]); var curve3 = board.create('functiongraph', ['0.707*x', 0, x_intersect]); // 3. Plot a filled curve which starts at (0,0), contains all points of 'sqrt(x^2-1)' // and is closed by adding (0,0) at the end. var curve = board.create('curve', [[], []], { strokeWidth: 3, fillColor: 'yellow', fillOpacity: 0.3 }); curve.updateDataArray = function() { // Start with (0, 0) this.dataX = [0]; this.dataY = [0]; // Copy all points from curve2 this.dataX = this.dataX.concat(curve2.points.map(p => p.usrCoords[1])); this.dataY = this.dataY.concat(curve2.points.map(p => p.usrCoords[2])); // Close the curve by adding (0,0) this.dataX.push(0); this.dataY.push(0); }; board.update(); </script>
/* This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'your_div_id'; // Insert your id here! const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-1, 2, 2, -1], axis: true }); // 1. We need the mutual intersections of the curves. // However, only one intersection is not obvious. // Numerically compute intersection of the first two curves, 'sqrt(x^2-1)' and '0.707*x' var diff = x => Math.sqrt(x * x - 1) - 0.707 * x; var x_intersect = JXG.Math.Numerics.root(diff, 1.5); // 2. Plot curves only up to the mutual intersections // We use JessieCode for the function terms var curve1 = board.create('functiongraph', ['0', 0, 1]); var curve2 = board.create('functiongraph', ['sqrt(x^2-1)', 1, x_intersect]); var curve3 = board.create('functiongraph', ['0.707*x', 0, x_intersect]); // 3. Plot a filled curve which starts at (0,0), contains all points of 'sqrt(x^2-1)' // and is closed by adding (0,0) at the end. var curve = board.create('curve', [[], []], { strokeWidth: 3, fillColor: 'yellow', fillOpacity: 0.3 }); curve.updateDataArray = function() { // Start with (0, 0) this.dataX = [0]; this.dataY = [0]; // Copy all points from curve2 this.dataX = this.dataX.concat(curve2.points.map(p => p.usrCoords[1])); this.dataY = this.dataY.concat(curve2.points.map(p => p.usrCoords[2])); // Close the curve by adding (0,0) this.dataX.push(0); this.dataY.push(0); }; board.update();
<jsxgraph width="100%" aspect-ratio="1 / 1" title="Shade region bounded by curves" description="This construction was copied from JSXGraph examples database: BTW HERE SHOULD BE A GENERATED LINKuseGlobalJS="false"> /* This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-1, 2, 2, -1], axis: true }); // 1. We need the mutual intersections of the curves. // However, only one intersection is not obvious. // Numerically compute intersection of the first two curves, 'sqrt(x^2-1)' and '0.707*x' var diff = x => Math.sqrt(x * x - 1) - 0.707 * x; var x_intersect = JXG.Math.Numerics.root(diff, 1.5); // 2. Plot curves only up to the mutual intersections // We use JessieCode for the function terms var curve1 = board.create('functiongraph', ['0', 0, 1]); var curve2 = board.create('functiongraph', ['sqrt(x^2-1)', 1, x_intersect]); var curve3 = board.create('functiongraph', ['0.707*x', 0, x_intersect]); // 3. Plot a filled curve which starts at (0,0), contains all points of 'sqrt(x^2-1)' // and is closed by adding (0,0) at the end. var curve = board.create('curve', [[], []], { strokeWidth: 3, fillColor: 'yellow', fillOpacity: 0.3 }); curve.updateDataArray = function() { // Start with (0, 0) this.dataX = [0]; this.dataY = [0]; // Copy all points from curve2 this.dataX = this.dataX.concat(curve2.points.map(p => p.usrCoords[1])); this.dataY = this.dataY.concat(curve2.points.map(p => p.usrCoords[2])); // Close the curve by adding (0,0) this.dataX.push(0); this.dataY.push(0); }; board.update(); </jsxgraph>
// Define the id of your board in BOARDID const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-1, 2, 2, -1], axis: true }); // 1. We need the mutual intersections of the curves. // However, only one intersection is not obvious. // Numerically compute intersection of the first two curves, 'sqrt(x^2-1)' and '0.707*x' var diff = x => Math.sqrt(x * x - 1) - 0.707 * x; var x_intersect = JXG.Math.Numerics.root(diff, 1.5); // 2. Plot curves only up to the mutual intersections // We use JessieCode for the function terms var curve1 = board.create('functiongraph', ['0', 0, 1]); var curve2 = board.create('functiongraph', ['sqrt(x^2-1)', 1, x_intersect]); var curve3 = board.create('functiongraph', ['0.707*x', 0, x_intersect]); // 3. Plot a filled curve which starts at (0,0), contains all points of 'sqrt(x^2-1)' // and is closed by adding (0,0) at the end. var curve = board.create('curve', [[], []], { strokeWidth: 3, fillColor: 'yellow', fillOpacity: 0.3 }); curve.updateDataArray = function() { // Start with (0, 0) this.dataX = [0]; this.dataY = [0]; // Copy all points from curve2 this.dataX = this.dataX.concat(curve2.points.map(p => p.usrCoords[1])); this.dataY = this.dataY.concat(curve2.points.map(p => p.usrCoords[2])); // Close the curve by adding (0,0) this.dataX.push(0); this.dataY.push(0); }; board.update();
This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.