Happy Easter!

Easter egg

To all my readers, colleagues and students,

I would like to wish you a happy Easter holiday, for you and your family and friends. May the free time allow you to clean your mind and do things you never had time for. No matter what your religious beliefs are, use the time to spend it with your close ones, as this is a great opportunity to do so.

~ Lukasz Zmudzinski

Creating the egg in Python

If you are interested on how the Easter egg image was created, you can see that in the code below. The only requirements is to have matplotlib, seaborn and numpy installed. Happy coding!

# Add imports
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
import numpy as np

# Do Easter math magic!
c = 0.5
b = 1.65
u = np.linspace(0, 2*np.pi, 100)
v = np.linspace(0, np.pi, 100)
x = (1 + c * v) * np.outer(np.cos(u), np.sin(v))
y = (1 + c * v) * np.outer(np.sin(u), np.sin(v))
z = np.outer(b, np.cos(v))

# Show the figure
fig = plt.figure(figsize=(10,10))
ax = Axes3D(fig)
ax.plot_surface(x, y, z, rstride=4, cstride=4, cmap=plt.cm.viridis)

Tell me what you think!