General Theory of Relativity - A Simple Visualization of Space Time Curvature - The The Schwarzschild Metric

Curvature of Space-Time

Spacetime Fabric

According to General Relativity, gravity is not a force, but rather a curvature of spacetime caused by mass and energy.

Massive bodies like stars and planets create "potential wells." The denser the mass, the deeper the metric deformation.

Telemetry Data

Sun Mass (M) 1.50
Earth Mass (m) 0.15
Orbit Radius (r) 25.0 AU
Time Dilation (Δt') 0.982
Status: STABLE ORBIT
Sun Mass 1.5
Earth Mass 0.15
Curvature 30
Orbit Radius 25
Orbital Velocity 1.0
Sun Brightness 1.0

Notebook 01: Euler - Lagrange Lab - Derivation of Euler Lagrange Equation Using Variational Principle

Euler–Lagrange Lab

An interactive environment exploring analytical mechanics and the Principle of Stationary Action. Discover the fundamental equations that govern the paths of nature.

$$S[q] = \int_{t_1}^{t_2} L(q, \dot{q}, t) \, dt$$

$$\delta S = 0$$

The Derivation Pathway

Step 1: Path Variation +
$$q(t) \to q(t) + \epsilon \eta(t)$$
Assume a true path \(q(t)\) that minimizes action. We introduce a small variation \(\eta(t)\) scaled by parameter \(\epsilon\). The endpoints are fixed.
Step 2: Action Functional +
$$S(\epsilon) = \int L(q + \epsilon\eta, \dot{q} + \epsilon\dot{\eta}) \, dt$$
Substitute the varied path into the action integral. The action \(S\) is now a function of the scalar parameter \(\epsilon\).
Step 3: First Order Expansion +
$$\frac{dS}{d\epsilon} \bigg|_{\epsilon=0} = \int \left( \frac{\partial L}{\partial q}\eta + \frac{\partial L}{\partial \dot{q}}\dot{\eta} \right) dt = 0$$
For stationary action, the derivative with respect to \(\epsilon\) evaluated at \(\epsilon=0\) must vanish. We use the chain rule to expand the Lagrangian.
Step 4: Integration by Parts +
$$\int \frac{\partial L}{\partial \dot{q}} \dot{\eta} \, dt = \left[ \frac{\partial L}{\partial \dot{q}} \eta \right] - \int \frac{d}{dt}\left(\frac{\partial L}{\partial \dot{q}}\right) \eta \, dt$$
Apply integration by parts to the second term to factor out \(\eta(t)\). This shifts the time derivative onto the momentum term.
Step 5: Euler-Lagrange Equation +
$$\frac{\partial L}{\partial q} - \frac{d}{dt}\left(\frac{\partial L}{\partial \dot{q}}\right) = 0$$
Since \(\eta(t)\) is zero at the boundaries, the surface term vanishes. Because the remaining integral must be zero for any arbitrary variation \(\eta(t)\), the term in brackets must be identically zero.

Action Minimization (Gravity Field)

ACTION PHASE SPACE (S vs ε)
VARIATION ε →
← VARIATION -ε
TRUE PATH (CYAN) / VARIED PATH (VIOLET)
ACTION S = 0.000

Observe a particle in a uniform gravitational field. Modify the variation amplitude \(\epsilon\) to see how arbitrary wavy paths increase the total Action compared to the natural parabolic path.

Classical Systems

Lagrangian: $$L = \frac{1}{2} m \dot{x}^2$$

E-L Eq: $$\frac{d}{dt}(m \dot{x}) - 0 = 0$$

EOM: $$\ddot{x} = 0 \implies v = \text{const}$$

Lagrangian: $$L = \frac{1}{2} m \dot{x}^2 - \frac{1}{2} k x^2$$

E-L Eq: $$\frac{d}{dt}(m \dot{x}) - (-kx) = 0$$

EOM: $$\ddot{x} = -\frac{k}{m}x$$

Lagrangian: $$L = \frac{1}{2} m l^2 \dot{\theta}^2 + m g l \cos(\theta)$$

E-L Eq: $$\frac{d}{dt}(m l^2 \dot{\theta}) - (-m g l \sin(\theta)) = 0$$

EOM: $$\ddot{\theta} = -\frac{g}{l}\sin(\theta)$$

Numerical Workspace

Runge-Kutta 4 (JS)
Euler Method (Python)
// RK4 Integrator for 2nd Order ODE: x'' = f(x, v, t)
function rk4_step(x, v, t, dt, force_func) {
    const k1_v = force_func(x, v, t);
    const k1_x = v;

    const k2_v = force_func(x + 0.5*dt*k1_x, v + 0.5*dt*k1_v, t + 0.5*dt);
    const k2_x = v + 0.5*dt*k1_v;

    const k3_v = force_func(x + 0.5*dt*k2_x, v + 0.5*dt*k2_v, t + 0.5*dt);
    const k3_x = v + 0.5*dt*k2_v;

    const k4_v = force_func(x + dt*k3_x, v + dt*k3_v, t + dt);
    const k4_x = v + dt*k3_v;

    const new_x = x + (dt / 6.0) * (k1_x + 2*k2_x + 2*k3_x + k4_x);
    const new_v = v + (dt / 6.0) * (k1_v + 2*k2_v + 2*k3_v + k4_v);
    
    return { x: new_x, v: new_v };
}
# Basic Euler Integration for Harmonic Oscillator
def simulate_ho(k, m, x0, v0, dt, steps):
    x = x0
    v = v0
    
    history = [(x, v)]
    
    for _ in range(steps):
        # EOM: a = - (k/m) * x
        a = -(k / m) * x
        
        # Update state
        v_new = v + a * dt
        x_new = x + v * dt
        
        x = x_new
        v = v_new
        history.append((x, v))
        
    return history

Phase Space Geometry

The state of a system is fully described by coordinates \(q\) and momenta \(p\). For a conservative system like the Harmonic Oscillator, energy conservation manifests as closed orbits in phase space.

INITIATIVE FOR PHYSICS VISUALIZATION NOTEBOOKS // V2.0 // KAZ
NOTEBOOK 01: CLASSICAL MECHANICS - EULER - LAGRANGE EQNS FROM VARIATIONAL PRINCIPLE

Visulalization of Fourier Synthesis of Common Wave Forms

Interactive Fourier Explorer

Decompose complex periodic waveforms into a sum of simple oscillating sine and cosine waves. Adjust the harmonics and observe how rotating epicycles generate the target function.

f(x) = a0 + (an cos(nx) + bn sin(nx))
Domain: Time (t) Points Rendered: 0

Frequency Spectrum

Learn

A Fourier Series expands a periodic function into an infinite sum of sines and cosines. This implies that any complex repeating pattern can be broken down into fundamental, simple oscillations.
Visualized here as connecting rotating circles. Each circle represents one term in the Fourier series. The radius is the amplitude, the rotation speed is the frequency, and adding them vectorially traces the complex shape!
Notice the "wiggles" or "ringing" near sharp corners (like the edges of the Square Wave)? This is the Gibbs phenomenon. Because we use continuous sine waves, they struggle to perfectly replicate instantaneous jumps, resulting in overshoot.