Zooming into a butterfly function (Python code in description)

Channel:
Subscribers:
771
Published on ● Video Link: https://www.youtube.com/watch?v=s6Leoqjakas



Duration: 0:17
61 views
4


The butterfly function is a function of two variables

f(x,y) = ((x ** 2 - y ** 2) * math.sin((x + y) / 1.5)) / (x ** 2 + y ** 2)

https://mathworld.wolfram.com/ButterflyFunction.html

The Python code:

https://github.com/26F/skeleton-code/blob/main/butterfly_function.py

You can output a single frame by just calling the function once rather than in the for loop. Change STRETCH to change the 'zoom'







Tags:
Math
programming
Python
recreational mathematics