Python

Python Projects Showcase

Welcome to my Python Projects Showcase! This portfolio features a selection of my projects developed using Python at Stanford University, illustrating my capabilities in software design, algorithm development, and simulation.

Pendulum-Projectile Simulation on Solar Planets

  • Project Repository: View Project
  • Description: A sophisticated simulation that combines the dynamics of pendulum motion with projectile motion in a solar system context.
  • Course: Stanford University CS106A (2023)
  • Frameworks & Libraries: Python 3, Canvas
  • Key Features:
    • Realistic simulation of pendulum and projectile dynamics.
      Pendulum-Projectile Simulation

Finite Difference Method (FDM) for Heat Transfer

  • Project Repository: View Project
  • Description: A sophisticated implementation of the Finite Difference Method (FDM) that numerically solves heat transfer problems by approximating differential equations with difference equations.
  • Course: Academic Project
  • Frameworks & Libraries: Python 3, NumPy, Matplotlib
  • Key Features:
    • Simulation of heat distribution in solid materials.
    • Simulation of deflection in solid bar.
    • Flexibility to analyze both cylindrical and spherical coordinate systems.
      FDM Heat Transfer Simulation

Heat Equation

The one-dimensional heat equation is: $$ \frac{\partial u}{\partial t} = \alpha \frac{\partial^2 u}{\partial x^2} $$

Where:

  • \( u \): temperature
  • \( \alpha \): thermal diffusivity

Discretization Using FDM

The equation can be discretized as:

$$ \frac{u_i^{n+1} - u_i^n}{\Delta t} = \alpha \frac{u_{i+1}^n - 2u_i^n + u_{i-1}^n}{\Delta x^2} $$

Rearranged to:

$$ u_i^{n+1} = u_i^n + \frac{\alpha \Delta t}{\Delta x^2} (u_{i+1}^n - 2u_i^n + u_{i-1}^n) $$

Simplified Algorithm

  1. Initialization: Define thermal properties \( h_a, T_a, k, g \).
  2. User Input: Gather inputs like \( h_a, T_a, k, g, L, n \).
  3. Discretization: $$ h = \frac{L}{n}, \quad s = -\frac{g \cdot h^2}{4k} \text{ (cylindrical)}, \quad s = -\frac{g \cdot h^2}{6k} \text{ (spherical)} $$
  4. Matrix Setup: Construct \( \text{matA} \) with boundary conditions.
  5. Matrix Construction: Append internal node coefficients \( a, b, c \) to \( \text{matA} \).
  6. Constant Vector: Create \( \text{matB} \) with boundary values.
  7. Matrix Calculations: Solve using: $$ u = \text{inmatA} \cdot \text{matB} $$
  8. Visualization: Plot temperature distribution.
  9. Execution: Run the algorithm.

Karel Robot (7 Mini Projects)

  • Project Repository: View Projects
  • Description: A series of seven mini-projects utilizing the Karel Robot programming environment to introduce fundamental programming concepts.
  • Course: Stanford University CS106A (2023)
  • Key Features:
    • Hands-on programming exercises including maze navigation and object manipulation.
    • Emphasis on logical thinking and problem-solving skills.
  • Projects:
    • Beyond Fill Karel
    • Checkerboard Karel
    • Fill Karel
    • Jigsaw Karel
    • Piles
    • Spread Beepers
    • Stone Mason Karel
      Karel Robot Projects

Graph Simulator

  • Project Repository: View Project
  • Description: A versatile graph simulation tool that allows users to visualize and manipulate graph structures interactively.
  • Course: Stanford University CS106A (2023)
  • Frameworks & Libraries: Python 3, Canvas
  • Key Features:
    • Fourier Transform Visualization: Analyzing Signal Frequencies
    • Trigonometric Functions: Graphical Representations
    • Linear Algebra in Action: Visualizing Vectors and Matrices
      Graph Simulator

Baby Snake

  • Project Repository: View Project
  • Description: A collection of engaging mini-games developed using Python, showcasing programming logic and design principles.
  • Course: Stanford University CS106A (2023)
  • Frameworks & Libraries: Python 3, Canvas
  • Key Features:
    • Key Features: Classic gameplay with simple controls, colorful graphics, score tracking.
      Baby Snake