📜  mandle python (1)

📅  最后修改于: 2023-12-03 14:44:08.422000             🧑  作者: Mango

Mandle Python Introduction

Mandle Python is a package for generating Mandelbrot set fractals in Python programming language. Mandelbrot set is a famous fractal that is generated by calculating complex numbers' behavior under iteration. The set is named after Benoit Mandelbrot, who was a famous mathematician.

Installation

The package can be installed using pip package manager. The following command installs the package with its dependencies.

pip install mandle-python
Usage

The package has a simple API that allows for generating Mandelbrot set fractals. The following code snippet generates a fractal at the given coordinates and zoom level.

from mandle_python import MandlebrotSet

# initialize the class with starting parameters
mandle = MandlebrotSet(center_x=0, center_y=0, zoom=1)

# generate an image of the fractal at given coordinates and zoom level
image = mandle.generate_fractal(x_range=(-2, 2), y_range=(-2, 2), max_iterations=100)

# visualize the image
image.show()

This code generates an image of the Mandelbrot set fractal at the coordinates (0, 0) and with a zoom level of 1. The generate_fractal method takes in x_range and y_range, which specifies the range of coordinates to generate the fractal for. The max_iterations argument indicates the maximum number of iterations to be calculated for each pixel in the generated image.

Conclusion

Mandle Python is a handy package for generating fractals in Python. It offers straightforward APIs to generate Mandelbrot set fractals at specific coordinates and zoom levels. It can be used in various applications like generating fractal art, visualizing complex numbers' behavior, and more.