Mandelbrot Explorer

14-October-2024 By Jeffrey Cooper

Mandelbrot Explorer

This week’s project (Week 3) is a standalone Mandelbrot explorer. I had planned to deploy it to AWS, but that will be a future project for now due to a couple of issues and a time crunch.

Part of the goal was to continue to explore Python and its vast set of available libraries, and part to deploy it locally and using the Python to serve the image, exercising local hosting, including setting CORS permissions, using AI to accelerate the learning process.  That worked fine.  Translating that to AWS is going to take a bit more work.

The code is straightforward, mostly.  I used ChatGPT’s o1-preview to generate the Python and the HTML/CSS/Javascript code to start with. Everything worked quite well and didn’t take long to get running locally.  I will say that OpenAI’s JavaScript generation is less straightforward than I would have written it, and in fact, I did end up rewriting portions of the code.  It reverse registered clicks from within the JavaScript for things I would use onClick in the HTML, i.e., for small projects. (I get that in the big picture, it’s better to keep JavaScript out of the HTML, but for quick projects shortcuts are OK, as long as bad habits don’t form. 😉)

 

Nota para los lectores españoles: Estoy escribiendo mis articulos en dos idiomas mientras lo aprendo. Para mas información, lea este artículo.

El proyecto de esta semana (Semana 3) es un independiente explorador de Mandelbrot. Había planeado desplegarlo a AWS, per esto será un proyecto futuro para ahora porque unos problemas y una falta de tiempo.

Un parte de el objetivo fue continuar explorar Python y sus inmensas de librerías disponibles, y otro parte para desplegarlo localmente, usando Python para servir la imagen, utilizando alojamiento local, incluyendo la configuración de permisos de CORS, utilizando IA para acelerar el proceso de aprendiendo. Esto funcionó perfecto. Pero, traducir esto a AWS va a costar un poco más de trabajo.

El código es directo, más o menos. Usé o1-preview de ChatGPT para generar el Python y el código de HTML/CSS/JavaScript para empecer el proyecto. Todo funcionó bastante bien y no tardó mucho en funcionar localmente. Diré que el JavaScript de ChatGPT fue más formal que lo hubiera escrito, y de hecho, fue reescrito porciones del código. ChatGPT había registrado los clics en reverso de dentro el JavaScript para cosas yo usaría onClick en el HTML, i.e., para proyectos pequeños. (Entiendo en el panorama general, lo que es mejor mantener el JavaScript separado de HTML, pero para proyectos rápidos, los atajos están bien, mientras no se formen malos hábitos.

Mandelbrot Settings

What I spent the most amount of time on was making the webpage itself more presentable, with instructions. And along the way, I found that as you zoom in, it gets really fiddly with nudges in X and Y. The amount you nudge is inversely proportional to the zoom level, so it takes a lot of iterations to zoom/recenter/zoom to find the many interesting and unique structures within (infinitely so). So I decided to explore for a while, and found half a dozen different areas and created presets from those that you can use to start with.

If you manually explore, the zoom ratio does inversely affect the XY nudge values, but it does get out of whack as it is not very well mapped to what it should actually be. It was something I just implemented to help out a bit, but you will get the idea from watching the numbers how quickly the Zoom setting diminishes the delta you will want to apply to XY nudges.  Presently, the Presets do not change the default zoom and nudge values, so if you use a preset, you are on your own. Maybe you should explore it a bit manually to get a feel for how the nudges change, then use the presets.

Lo que pasé la mayoría de tiempo on estaba haciendo la página web más presentable, con instrucciones. Y por el camino, descubrí que a medida que se amplía la imagen, se vuelve más sensible con las empujones en X y Y. La cantidad empujas es proporcional inversamente al nivel de zoom, y toma muchas iteraciones para ampliar/recentrar/ampliar para descubrir las estructuras más interesante y únicas que hay dentro (infinitamente). Así decidí explorar por un tiempo, y descubría seis areas diferentes mucho interesantes y he creado preajustes a partir de esos que puede utilizar para empezar.

Si explora manualmente, la relación de zoom cambia inversamente para cambiar los valores de los empujones de XY, pero después de algunos usos, los valores convierte menos preciso, como no están mapeado muy bien para que deberías ser. Fue una cosa había implementado ayudar un poco, pero se hará una idea de mirando los números como rápidamente los valores delta de Zoom reduce que querrás aplicar para los empujones de XY. Actualmente, los preajustes no cambia los valores por defecto de ampliar y empujar, así si utilizaría un preajuste, está solo. Quizás deberías explorar un poco manualmente para tener una idea de como los empujones cambian los valores, entonces utilizar los preajustes.

For now, you will have to download the code and deploy it on your own machine. I used straight up Python to run it, pip installed the requisite libraries that are not prebuilt in, and let it serve up the webpage.  I did not use the Anaconda environment.

If/when I revisit to deploy to AWS, I will revise this article.

Para ahora, necesitará descargar el código de GitHub y instalar en su propio computadora. Utilicé Python normal (no Anaconda) para ejecutar, instalé con pip las librerías requisitas no hay incluido directamente, y lo dejo que sirva la página de web.

Si/cuando vuelva a visitar para desplegar a AWS, revisaré esta publicación. 

El contenido de estos artículos son un poco avanzado. Necesito utilizar ayuda de DeepL, per trato utilizar lo menos posible. Todavía lo estoy utilizando alrededor 30% o un poco más, porque necesito un más vocabulario y coloquialismos también.

COMMENTS

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe

Subscribe and get a notice when the next article is published.

Thank you for subscribing.

Something went wrong.

Subscribe

Subscribe and get a notice when the next article is published.

Thank you for subscribing.

Something went wrong.