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:20%; aspect-ratio:3/2; margin-top:20px;"></div>
     <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, 8, -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, // Wir setzen das Label manuell als JSXGraph-Text
             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'
            }
         });
         });


         // LaTeX-Text für das Integral
         // Integral-Label anpassen
         var integralText = board.create('text', [0, 4, ''], { fontSize: 16, useMathJax: true });
         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}\\]`;
        });


         // Funktion zum Aktualisieren des Labels mit MathJax-Neurendering
         // MathJax nach jeder Änderung neu ausführen
         function updateIntegralLabel() {
         i1.label.onUpdate = function() {
            const a = i1.baseLeft.X().toFixed(2);
             // MathJax neu rendern
            const b = i1.baseRight.X().toFixed(2);
            if (typeof MathJax !== 'undefined' && MathJax.typesetPromise) {
            const value = i1.Value().toFixed(4);
                MathJax.typesetPromise();
           
            }
            integralText.setText(`\\[\\int_{${a}}^{${b}} f(t) \\, dt = ${value}\\]`);
         };
 
             MathJax.typesetPromise();  // MathJax erneut rendern
        }
 
        // Event-Listener für die Endpunkte des Integrals
        i1.baseLeft.on('drag', updateIntegralLabel);
        i1.baseRight.on('drag', updateIntegralLabel);
 
         // Erstes Rendern
        updateIntegralLabel();


         // Beschriftung der Funktion mit f
         // Beschriftung der Funktion mit f