广义mandelbrot集,使用python的matplotlib绘制,支持放大缩小

本文介绍了如何使用Python的matplotlib库绘制广义Mandelbrot集,重点在于迭代公式中复数指数的运用。读者可以自由调整指数参数以生成不同形态的图形。对于缺少的Python库,建议访问指定网站进行安装。
摘要由CSDN通过智能技术生成

 

 

迭代公式的指数,使用的1+5j,这是个复数,所以是广义mandelbrot集,大家可以自行修改指数,得到其他图形。各种库安装不全的,自行想办法,可以在这个网站找到几乎所有的python库

http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

 

 

#encoding=utf-8
import numpy as np
import pylab as pl
import time
from matplotlib import cm
from math import log

escape_radius = 10
iter_num = 20


def draw_mandelbrot2(cx, cy, d, N=600):
    global mandelbrot
    """
    绘制点(cx, cy)附近正负d的范围的Mandelbrot
    """
    x0, x1, y0, y1 = cx-d, cx+d, cy-d, cy+d 
    y, x = np.ogrid[y0:y1:N*1j, x0:x1:N*1j]
    c = x + y*1j
    
    smooth_mand = np.frompyfunc(smooth_iter_point,1,1)(c).astype(np.float)
    pl.gca().set_axis_off()
    pl.imshow(smooth_mand, cmap=cm.Blues_r,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值