Hauptsatz der Differential- und Integralrechnung: Unterschied zwischen den Versionen
| Zeile 37: | Zeile 37: | ||
<head> | <head> | ||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/1.4.6/jsxgraphcore.js"></script> | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/1.4.6/jsxgraphcore.js"></script> | ||
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js | <script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> | ||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/1.4.6/jsxgraph.css" /> | <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/1.4.6/jsxgraph.css" /> | ||
</head> | </head> | ||
<body> | <body> | ||
<div id="box2" style="width: | <div id="box2" style="width:40%; aspect-ratio:3/2; margin-top:20px;"></div> | ||
<div id="integralLabel" style="font-size: 20px; margin-top: 20px;"></div> <!-- Hier wird das LaTeX-Label gerendert --> | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
JXG.Options.text.useMathJax = true; | JXG.Options.text.useMathJax = true; | ||
var board = JXG.JSXGraph.initBoard('box2', { | var board = JXG.JSXGraph.initBoard('box2', { | ||
boundingbox: [-5, 5, | boundingbox: [-5, 5, 8, -5], | ||
axis: true, | axis: true, | ||
showCopyright: false, | showCopyright: false, | ||
showNavigation: true, | showNavigation: true, | ||
grid: true | grid: true | ||
}); | }); | ||
| Zeile 94: | Zeile 64: | ||
[-2.0, 2.0], c1 | [-2.0, 2.0], c1 | ||
], { | ], { | ||
withLabel | withLabel: false, // Wir setzen das Label manuell | ||
baseLeft: { visible: true, fixed: false, withLabel: true, name: 'a' }, | |||
baseRight: { visible: true, fixed: false, withLabel: true, name: 'b' } | |||
baseLeft: { | |||
baseRight: { | |||
}); | }); | ||
// | // Funktion zum Aktualisieren des LaTeX-Labels | ||
function updateIntegralLabel() { | |||
const a = i1.baseLeft.X().toFixed(2); | const a = i1.baseLeft.X().toFixed(2); | ||
const b = i1.baseRight.X().toFixed(2); | const b = i1.baseRight.X().toFixed(2); | ||
const value = i1.Value().toFixed(4); | const value = i1.Value().toFixed(4); | ||
}); | document.getElementById('integralLabel').innerHTML = `\\[ | ||
\\int_{${a}}^{${b}} f(t) \\, dt = ${value} | |||
\\]`; | |||
MathJax.typesetClear(); // Vorherige Formeln löschen | |||
MathJax.typesetPromise(); // Neu rendern | |||
} | |||
// Event-Listener für die Endpunkte des Integrals | |||
i1.baseLeft.on('drag', updateIntegralLabel); | |||
i1.baseRight.on('drag', updateIntegralLabel); | |||
// | // Erstes Rendern | ||
updateIntegralLabel(); | |||
</script> | </script> | ||
</body> | </body> | ||