Visualizing the beauty in physics and mathematics
Somehow it’s okay for people to chuckle about not being good at math. Yet, if I said “I never learned to read,” they’d say I was an illiterate dolt. — Neil deGrasse Tyson
The application below let’s one render functions in two real variables $x$ and $y$. The color-coding below is associated with the height of the object and is added purely for aesthetical purposes.
A field is an algebraic structure that is defined as a non-empty collection with two (binary) operations: addition, $a+b$, and multiplication, $a\cdot b$.
These operations are accurately defined by the conditions they must suffice, but roughly speaking they should behave similarly as we know them already from the rational numbers $\mathbb{Q}$ and real numbers $\mathbb{R}$.
The applications below render two such fields, that are abundant in physics, namely scalar fields and vector fields. The former assigns a value (scalar) to every point in space (e.g. the temperature in a room), the latter a vector (e.g. the force and direction of the wind).
def sphere_harmonic():
theta = np.linspace(-1.1 * pi, pi, 100)
phi = np.linspace(0, pi, 100)
U, V = np.meshgrid(theta, phi)
R1 = np.cos(U.multiply(2)).multiply(np.cos(U.multiply(2)))
R2 = np.sin(V).multiply(np.sin(V))
R = R1.multiply(R2).multiply(4)
X = np.sin(U).multiply(np.cos(V)).multiply(R)
Y = np.sin(U).multiply(np.sin(V)).multiply(R)
Z = np.cos(U).multiply(R)
return X, Y, Z, None, None
Share on: