Mandelbrot set in Python

Поделиться
HTML-код
  • Опубликовано: 16 янв 2025

Комментарии • 50

  • @jaeimp
    @jaeimp 5 лет назад +8

    Running the code on Windows 10 with an anaconda install of Python 3, I get only a segment of the actual set. It seems like it's a display issue, but if you can offer some troubleshooting, I would appreciate it.

  • @gerhardkpunkt
    @gerhardkpunkt 5 лет назад +11

    is there a possibility to see the figure grow pixel for pixel?

    • @bohdan_tyshchenko
      @bohdan_tyshchenko 4 года назад

      You can create animations in matplolib with FuncAnimation function. To zoom in shrink boundaries of Im and Re components.

  • @geraldsnodd
    @geraldsnodd 3 года назад

    Thank you this worked
    I finally made my beloved mandelbrot set in python.
    💪😃

  • @prenomnom8860
    @prenomnom8860 5 лет назад +7

    Hi, i just tried to make this and it was successful ! However, my image is rotate by pi/2, so i just inverted row_index and column_index but is there an other solution ?
    thanks

    • @atharvachoudhary6974
      @atharvachoudhary6974 3 года назад

      maybe you missed that he passed the transpose of the result set in imshow()

  • @bencekaltenecker742
    @bencekaltenecker742 4 года назад +1

    You are from Hungary? Helpful and great video btw!

  • @Sam-wf9rk
    @Sam-wf9rk 5 лет назад +5

    Amazing

  • @Zergplayer1
    @Zergplayer1 6 лет назад +3

    Hello, I copy exactly your code, and when running I get only vertical lines in the color 'hot', do you know why i can't get the mandelbrot image?

    • @computationalscientist6368
      @computationalscientist6368  6 лет назад

      Hi! There may be a problem in indexing the grid points. Does changing the colormap solve the issue? Can you copy your code here?

    • @Zergplayer1
      @Zergplayer1 6 лет назад

      That was exactly what I was thinking, but I couldn't figure out what was wrong, >_= 4:
      return i
      return max_iter
      columns = 2000
      rows = 2000
      result = np.zeros([rows, columns])
      for row_index, Re in enumerate(np.linspace(-2, 1, num=rows)):
      for column_index, Im in enumerate(np.linspace(-1, -1, num=columns)):
      result[ row_index, column_index] = mandelbrot(Re, Im, 500)
      plt.figure(dpi=100)
      plt.imshow(result.T, cmap = 'hot', interpolation = 'bilinear', extent =[-2, 1, -1, 1])
      plt.xlabel('Re')
      plt.ylabel('Im')
      plt.show()

    • @Zergplayer1
      @Zergplayer1 6 лет назад

      and changing the color doesn't fix it :(

    • @computationalscientist6368
      @computationalscientist6368  6 лет назад +8

      Hi! There is a small typing error in your code. This line:
      "for column_index, Im in enumerate(np.linspace(-1, -1, num=columns)):"
      is supposed to be:
      "for column_index, Im in enumerate(np.linspace(-1, 1, num=columns)):"
      so there is a "-" that you don't need.

    • @mamo987
      @mamo987 4 года назад +4

      @@computationalscientist6368 u know your shit AND ur willing to help

  • @RobertReilly-k9d
    @RobertReilly-k9d Год назад

    How much memory does your computer have? I only get a round circle.

  • @AnComplexFraktal
    @AnComplexFraktal 10 месяцев назад

    bro i got a LOT OF ERRORS how do i fix it.

  • @nixboaski
    @nixboaski Год назад

    wow... I wrote a code in a different way and the figure was so rudimentary. I didn't use that convergence critera of |z| < 2. Instead, I iterated the expression for z_n 10 times (because more times than that would make NaN values begin to appear) and made a linear regression over those points. If the linear coefficient was negative, then it converges.
    Yeah, I know, it's a pretty bad test of convergence, but I was just playing. It generated an image that was poor, it didn't get even closer to the one you generated here with your code. Thanks for showing us how you did it.

  • @deepkorper249
    @deepkorper249 6 лет назад +6

    thanks!

  • @namanvohra8262
    @namanvohra8262 6 лет назад +3

    Nice Video! Where can i get a more detailed explanation of the code?

  • @sametocsy
    @sametocsy 3 года назад

    hi, how can I do this using the message passing method?

  • @thomasfahey3207
    @thomasfahey3207 4 года назад +1

    i keep getting this error:
    ImportError: cannot import name 'autojit' from 'numba' (C:\Users\Tom\anaconda3\lib\site-packages
    umba\__init__.py)
    Where can I get autojit?

    • @mubin2026
      @mubin2026 4 года назад +2

      it is in numba package. however, in python 3 you need to use a different import statement.
      try:
      from numba.roc.decorators import autojit

  • @motezelissa4807
    @motezelissa4807 6 лет назад +1

    I tried to implement the code but all I get is black plotiing and no mandelbrot , what is the problem ?

  • @marcdelosaires2289
    @marcdelosaires2289 5 лет назад +1

    How can I change the colors of the Mandelbrot set?

    • @computationalscientist6368
      @computationalscientist6368  5 лет назад +2

      You need to specify a different colormap (cmap). Here is a list of them:
      matplotlib.org/3.1.0/tutorials/colors/colormaps.html

  • @novygaming5713
    @novygaming5713 2 года назад

    Hippety poppity your code is now my property

  • @bondy4869
    @bondy4869 6 лет назад +2

    This is good, i tried it and it works, impored the stuff and all, but there was a maximum resolution in mine, i found out it was 5984X5984. Is there any way to increase the max resolution?

    • @computationalscientist6368
      @computationalscientist6368  6 лет назад

      Hi! I've just tried, and I can generate a 7000x7000 image on my laptop. Is it possible that your PC runs out of memory? Can you check this?

    • @bondy4869
      @bondy4869 6 лет назад

      A convinience actually, i’m getting a high-spec pc in july, i can tell you how it goes, has 16gb ram so that should be something improved.

    • @electrickinyourface2
      @electrickinyourface2 5 лет назад

      @@bondy4869 Your max resolution is dependent on how much ram you have available

  • @HackerTypeZ
    @HackerTypeZ 6 лет назад

    Have you tried generating something to a vector format instead of working with pixels?

    • @computationalscientist6368
      @computationalscientist6368  5 лет назад

      I'm afraid that is not possible, you need to compute every pixel individually, because even if you know the value of two points, you know nothing about the points between them.

  • @gonzalomarcavargas1750
    @gonzalomarcavargas1750 7 лет назад +3

    I need help zooming in on part of the image

    • @computationalscientist6368
      @computationalscientist6368  7 лет назад +3

      H!
      Try adjusting the limits within 'numpy.linspace()':
      - setting the x-axis: 'numpy.linspace(X_LOWER, X_UPPER, num=rows)'
      - setting the y-axis: 'numpy.linspace(Y_LOWER, Y_UPPER, num=columns)'
      For example try 'numpy.linspace(-0.5, 1, num=rows)' and 'numpy.linspace(0, 1, num=columns)'.
      I recommend to flip the numpy array horizontally as well, because imshow does it by nature and it should be corrected: 'plt.imshow(numpy.flipud(result.T), ...)'.
      I hope it helps.

    • @vmikeyboi323
      @vmikeyboi323 6 лет назад +1

      You can't do that in notebook, try a IDE, same code works don't implement autojit

  • @user-jc5pg3jg8l
    @user-jc5pg3jg8l 2 года назад +1

    That isnt mandelbrot set by python but there have some solution of 'drawing mandelbrot set'. usually programmers introduce these set by mathmatical ways or using some pararell programming but this video just use **MODULE** so i dont advise these video. :(

  • @kusumapuramsetty133
    @kusumapuramsetty133 5 лет назад

    can you send python code for fractals

  • @mikethe2238
    @mikethe2238 4 года назад

    can I use numbers?

    • @computationalscientist6368
      @computationalscientist6368  4 года назад

      I'm afraid I cannot understand your question.

    • @mikethe2238
      @mikethe2238 4 года назад

      @@computationalscientist6368 the extension of the numbers cuz I can't find pyglet or pygame anymore

    • @mikethe2238
      @mikethe2238 4 года назад

      extensions are vanishing

  • @a-ragdoll
    @a-ragdoll 4 года назад

    how do i run this
    also can you make the code copy and paste because it didnt work