Hauptsatz der Differential- und Integralrechnung: Unterschied zwischen den Versionen
Markierung: Zurückgesetzt |
Markierung: Manuelle Zurücksetzung |
||
| Zeile 41: | Zeile 41: | ||
</head> | </head> | ||
<body> | <body> | ||
<div id="box2" style="width: | <div id="box2" style="width:500px; height:500px;"></div> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
JXG.Options.text.useMathJax = true; | // MathJax in JSXGraph aktivieren | ||
JXG.Options.text.useMathJax = true; | |||
// JSXGraph-Board erstellen | |||
var board = JXG.JSXGraph.initBoard('box2', { | var board = JXG.JSXGraph.initBoard('box2', { | ||
boundingbox: [-5, 5, | boundingbox: [-5, 5, 5, -5], // Angepasste Boundingbox für die Skalierung | ||
axis: true, | axis: true, | ||
showCopyright: false, | showCopyright: false, | ||
showNavigation: true, | showNavigation: true, | ||
grid: true, | grid: true, // Gitternetz aktivieren | ||
defaultAxes: { | defaultAxes: { | ||
x: { | x: { | ||
| Zeile 84: | Zeile 87: | ||
// Funktion erstellen | // Funktion erstellen | ||
var c1 = board.create('functiongraph', [function(t) { | var c1 = board.create('functiongraph', [function(t) { | ||
return (Math.pow(t, 5) / 24 - Math.pow(t, 3) / 2 + t | return (Math.pow(t, 5) / 24 - Math.pow(t, 3) / 2 + t; | ||
}]); | }]); | ||
| Zeile 91: | Zeile 94: | ||
[-2.0, 2.0], c1 | [-2.0, 2.0], c1 | ||
], { | ], { | ||
withLabel: false, | withLabel: true, | ||
baseLeft: { visible: true, fixed: false, withLabel: true, name: 'a' }, | label: { | ||
baseRight: { visible: true, fixed: false, withLabel: true, name: 'b' } | fontSize: 16, | ||
offset: [0, 50], | |||
digits: 4, | |||
intl: { | |||
enabled: false, | |||
options: {} | |||
} | |||
}, | |||
baseLeft: { // Start point | |||
visible: true, | |||
fixed: false, | |||
withLabel: true, | |||
name: 'a' | |||
}, | |||
baseRight: { // End point | |||
visible: true, | |||
fixed: false, | |||
withLabel: true, | |||
name: 'b' | |||
} | |||
}); | }); | ||
// | // Integral-Label anpassen | ||
i1.label.setText(() => { | |||
const a = i1.baseLeft.X().toFixed(2); // Untere Grenze | |||
const b = i1.baseRight.X().toFixed(2); // Obere Grenze | |||
const value = i1.Value().toFixed(4); // Wert des Integrals | |||
return `\\[\\int_{${a}}^{${b}} f(x) \\, dx = ${value}\\]`; | |||
}); | |||
// | // MathJax nach jeder Änderung neu ausführen | ||
i1.label.onUpdate = function() { | |||
// MathJax neu rendern | |||
if (typeof MathJax !== 'undefined' && MathJax.typesetPromise) { | |||
MathJax.typesetPromise(); | |||
} | |||
}; | |||
// Beschriftung der Funktion mit f | // Beschriftung der Funktion mit f | ||