This hobby project presents a captivating exploration of the intersection between mathematics and nature. Through a collection of Jupyter notebooks, it demonstrates how mathematical equations and physical principles can model, simulate, and visualize natural structures and phenomena — from the delicate geometry of flower petals to the wave-like behaviour of quantum particles.
Models the structure of a lotus flower using three layered polar equations. The animation sequentially draws each petal layer with a tracing dot and guide line, revealing how simple trigonometric combinations produce organic, flower-like shapes.
- Equations: Three polar functions (
r1,r2,r3) built from combinations ofcos,abs, and rational expressions, each offset by aseparation_factorto create concentric petal rings. - Animation: 1500-frame
FuncAnimationat 30 fps (~50 s), rendered as an HTML5 inline video optimized for 9:16 (portrait) aspect ratio. - Dependencies:
numpy,matplotlib,IPython.display - Environment: Google Colab (uses
google.colab.drivefor drive mounting).
Visualizes the classic butterfly curve — a parametric equation whose graph resembles the wings of a butterfly. A white tracing dot follows the curve as it is drawn.
- Technique:
matplotlib.animation.FuncAnimationrenders the curve frame-by-frame, saving the result as an embedded HTML5 video (800 × 800resolution). - Known Issue: The notebook output contains
MatplotlibDeprecationWarningmessages related toset_databeing called with non-sequence types (deprecated since matplotlib 3.7). This should be addressed in a future update to ensure forward compatibility. - Dependencies:
numpy,matplotlib,IPython.display - Environment: Google Colab.
Constructs a photorealistic 3D rose using a parametric surface equation. The rose "grows" petal-by-petal via an animated rotation, rendered against a black background with a custom RdPu (red-purple) colormap and gold edge highlights.
- Equation: A single
rose(x, theta)function returning(X, Y, Z)coordinates, built from exponential decay (phi), polynomial shaping, and angular modulation. - Parameters: Fully configurable global constants —
THETA_POINTS,GRID_FRAMES,EXTRA_ROTATION_FRAMES,ROTATION_SPEED,FPS,DPI,BITRATE, etc. - Output: Saved directly to
rose_animation.mp4viaFFMpegWriter. - Dependencies:
numpy,matplotlib(includingmpl_toolkits.mplot3d,matplotlib.animation,matplotlib.colors) - System Requirement:
ffmpegmust be installed and available on the systemPATH. - Environment: Google Colab.
Simulates the quantum-mechanical double-slit experiment for a single electron, showing how a localized wave-packet diffracts through two narrow slits and produces the iconic interference pattern.
- Physics: Uses the
qmsolvelibrary to build a Hamiltonian for a single particle (m = m_e) in a 2D potential well containing a double slit, then runs a split-step time simulation. - Simulation Parameters (configurable):
Parameter Value Slit separation 2.0 Å Slit width 0.7 Å Slit depth 0.5 Å Initial wavefunction σ 1.0 Å Initial velocity 80 Å/fs Total simulation time 0.7 fs Grid size (N) 512 Stored steps 801 - Visualization: Each frame maps the complex wavefunction
Ψ(x, y, t)to RGBA colour via HSV conversion, overlaid on a log-scaled potential image. Saved asdouble_slit_simulation_reel.mp4(9:16 portrait, 300 dpi, 30 fps). - Dependencies:
numpy,matplotlib,qmsolve - System Requirement:
ffmpegmust be installed and available on the systemPATH. - Environment: Google Colab (install
qmsolvevia!pip install qmsolve).
- Python 3.8+
- Google Colab (recommended) — all notebooks are authored and tested in Colab.
- Alternatively, run locally with the following installed:
numpymatplotlibffmpeg(system package — required byEquations_of_Rose.ipynbandYoungs_Double_Slit.ipynb)qmsolve(required only byYoungs_Double_Slit.ipynb; install viapip install qmsolve)
- Open any
.ipynbfile in Google Colab (or Jupyter). - Run all cells sequentially.
- Animations will either render inline (HTML5 video) or be saved as
.mp4files in the working directory.
Mathematics_And_Nature/
├── Butterfly_Equations.ipynb # Butterfly curve animation
├── Butterfly_Equations.jpeg # Example output image
├── Equations_of_Rose.ipynb # 3D rose surface animation
├── Lotus_Plot.ipynb # Lotus flower polar-plot animation
├── Lotus_Plot.jpeg # Example output image
├── Youngs_Double_Slit.ipynb # Quantum double-slit simulation
├── LICENSE # MIT License
├── .gitignore # Standard Python/Jupyter gitignore
└── README.md # This file
Contributions to enhance the Mathematics and Nature visualizations are welcome. Whether it's improving the equations, refining the animations, or fixing bugs, your input is valuable. Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a pull request.
Distributed under the MIT License. See LICENSE for more information.

