Hauptsatz der Differential- und Integralrechnung: Unterschied zwischen den Versionen
Markierung: Zurückgesetzt |
Markierung: Zurückgesetzt |
||
| Zeile 35: | Zeile 35: | ||
<html> | <html> | ||
< | <div id="box2" style="width:25%; aspect-ratio:3/2; margin-top:20px;"></div> | ||
<div id="latex-output" style="margin: 20px;"></div> | |||
</ | |||
<div id=" | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
JXG.Options.text.useMathJax = true; | JXG.Options.text.useMathJax = true; | ||
// JSXGraph-Board erstellen | // JSXGraph-Board erstellen | ||
var board = JXG.JSXGraph.initBoard('box2', { | var board = JXG.JSXGraph.initBoard('box2', { | ||
boundingbox: [-5, 5, 10, -5], | boundingbox: [-5, 5, 10, -5], | ||
axis: true, | axis: true, | ||
showCopyright: false, | showCopyright: false, | ||
showNavigation: true, | showNavigation: true, | ||
grid: true, | grid: true, | ||
defaultAxes: { | defaultAxes: { | ||
x: { | x: { | ||
| Zeile 87: | Zeile 82: | ||
return (Math.pow(t, 5) / 24 - Math.pow(t, 3) / 2 + t); | return (Math.pow(t, 5) / 24 - Math.pow(t, 3) / 2 + t); | ||
}]); | }]); | ||
// Create output div for LaTeX | |||
const latexOutput = document.getElementById('latex-output'); | |||
// Function to update LaTeX display | |||
function updateLatexDisplay(a, b, value) { | |||
const latexString = `\\[\\int_{${a}}^{${b}} f(x) \\, dx = ${value}\\]`; | |||
latexOutput.innerHTML = latexString; | |||
if (window.MathJax) { | |||
MathJax.typesetPromise([latexOutput]); | |||
} | |||
} | |||
// Integral erstellen | // Integral erstellen | ||
| Zeile 92: | Zeile 99: | ||
[-2.0, 2.0], c1 | [-2.0, 2.0], c1 | ||
], { | ], { | ||
withLabel: | withLabel: false, // We'll display the label separately | ||
baseLeft: { | |||
baseLeft: { | |||
visible: true, | visible: true, | ||
fixed: false, | fixed: false, | ||
| Zeile 108: | Zeile 106: | ||
name: 'a' | name: 'a' | ||
}, | }, | ||
baseRight: { | baseRight: { | ||
visible: true, | visible: true, | ||
fixed: false, | fixed: false, | ||
| Zeile 116: | Zeile 114: | ||
}); | }); | ||
// | // Update the LaTeX display whenever the integral changes | ||
board.on('update', function() { | |||
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); | ||
updateLatexDisplay(a, b, value); | |||
}); | }); | ||
// Beschriftung der Funktion mit f | // Beschriftung der Funktion mit f | ||
| Zeile 134: | Zeile 130: | ||
color: 'blue' | color: 'blue' | ||
}); | }); | ||
// Initial update of the LaTeX display | |||
const initialA = i1.baseLeft.X().toFixed(2); | |||
const initialB = i1.baseRight.X().toFixed(2); | |||
const initialValue = i1.Value().toFixed(4); | |||
updateLatexDisplay(initialA, initialB, initialValue); | |||
</script> | </script> | ||
</html> | </html> | ||