Mandelbrot mit JSXGraph

Aus Wiki1

(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
 
(Der Versionsvergleich bezieht 2 dazwischenliegende Versionen mit ein.)
Zeile 20: Zeile 20:
   });
   });
-
  // Slider für Formel
 
-
  const sliderPotx = board.create('slider', [[-2.3, 1.1], [0.5, 1.1], [2, 2, 3]], {
 
-
    name:'Potenz x',
 
-
    snapWidth:0.1
 
-
  });
 
-
  // Slider für Formel
 
-
  const sliderPoty = board.create('slider', [[-2.3, 1.00], [0.5, 1.0], [2, 2, 3]], {
 
-
    name:'Potenz y',
 
-
    snapWidth:0.1
 
-
  });
 
   // Canvas ins DOM hängen
   // Canvas ins DOM hängen
   const div = document.getElementById('jxgbox');
   const div = document.getElementById('jxgbox');
Zeile 46: Zeile 36:
     let x = 0, y = 0, iter = 0;
     let x = 0, y = 0, iter = 0;
     while (x*x + y*y <= 4 && iter < maxIter) {
     while (x*x + y*y <= 4 && iter < maxIter) {
-
       const xtemp = Math.pow(x,sliderPotx.Value()) - Math.pow(y,sliderPoty.Value()) + cx;
+
       const xtemp = x*x - y*y + cx;
       y = 2*x*y + cy;
       y = 2*x*y + cy;
       x = xtemp;
       x = xtemp;
Zeile 102: Zeile 92:
   sliderIter.on('drag', update);
   sliderIter.on('drag', update);
   sliderZoom.on('drag', update);
   sliderZoom.on('drag', update);
-
  sliderPotx.on('drag', update);
+
 
-
  sliderPoty.on('drag', update);
+
   // Panning mit Maus
   // Panning mit Maus

Aktuelle Version vom 12:37, 26. Sep. 2025

Mit den Schiebereglern können Iterations-Tiefe und Zoom gesteuert werden. Mit der Maus+linke Maustaste kann der Bildausschnitt verschoben werden.

Persönliche Werkzeuge