计算没有复杂对象的Mandelbrot集

时间:2019-05-05 14:55:53

标签: python python-3.x complex-numbers mandelbrot

我试图计算Python 3.6中的Mandelbrot集,但我不想使用复杂的对象来计算它。有人有getIterationCount(x, y)功能吗?

我试图将Java代码重写为python,但是没有用。

def getIterationCount(x, y):
    maxiter = 100
    z = complexe(x, y)
    c = z
    for n in range(0, maxiter):
        if abs(z) > 2:
            return n
        z = z*z + c
    return maxiter

1 个答案:

答案 0 :(得分:2)

如果您只想使用实数,我可以为您编写它:

df %>%
  group_by(Protein) %>%
  ggplot(., aes(x = factor(Protein), y = Melting_Temperature)) +
  geom_boxplot() +
  theme_classic() + 
  geom_point(aes(x = as.numeric(df$Protein) + 0.5, colour = Protein), 
  alpha=0.7)+
  xlab("Protein Type")+
  ylab("Melting Temperature") +
  stat_summary(fun.y=mean, colour = "darkred", geom = "point", shape = 
  18, size = 3, show_guide = FALSE) +
  geom_text(data = means, aes(label = round(Melting_Temperature, 1), y = 
  Melting_Temperature + 0.5))