Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
¿Por qué mi código de configuración de Mandelbrot no funciona correctamente?

Estoy tratando de crear el conjunto de Mandelbrot y otros Conjuntos de Julia en JavaScript para un proyecto escolar. Revisé mi código y parece que sigue la fórmula correctamente, pero mi conjunto de Mandelbrot no se dibuja correctamente. ¿Algún consejo sobre lo que está mal?

 <!DOCTYPE html> <html> <head> </head> <body> <canvas id="canvas" width="600" height="600" style="background-color: black;"></canvas> <script> //center the canvas at the coordinate plane var canvas = document.getElementById("canvas"); const width = canvas.width; const height = canvas.height; const scalingFactor = width / 4; var graphics = canvas.getContext("2d"); function mandelbrotDraw(iterations) { //multiply by 4 in order to get the scaling right for (var i = 0; i <= width; i++) { for (var j = 0; j <= height; j++) { var x = 0; var y = 0; var re = (i - width / 2) / scalingFactor; var im = (j - height / 2) / scalingFactor; var k = 0; while (x * x + y * y <= 4 && k < iterations) { x = x * x - y * y + re; y = 2 * x * y + im; k++; } if (k < iterations) { graphics.fillStyle = "black"; graphics.fillRect(i, j, 1, 1); } else { graphics.fillStyle = "white"; graphics.fillRect(i, j, 1, 1); } } } } mandelbrotDraw(25); </script> </body> </html>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!