Untitled

Anonymous
plain_text
02/17/2026 4:59 PM
2.7 KB
10
Indexable
import matplotlib.pyplot as plt
import numpy as np

# Define the domain (distance in meters)
# x < 0 is approach, x = 0 is impact, x > 0 is extrapolated
x_approach = np.linspace(-60, 0, 100)
x_extrap = np.linspace(0, 40, 100)

# Define the functions (Quadratic models based on video analysis)
# Max: Starts wide (y=10), cuts in to hit Apex (y=0) at x=25. Impact at x=0, y=3.
# Function derived to fit points: (-60, 12), (0, 3), (25, 0)
def f_max(x):
    return 0.0016 * x**2 - 0.22 * x + 3.0

# Lewis: Starts tight (y=1.5), drifts wide to Impact (y=3), exits wide (y=6).
# Function derived to fit points: (-60, 1.5), (0, 3), (40, 6)
def f_lewis(x):
    return 0.0006 * x**2 + 0.05 * x + 3.0

# Plotting
plt.figure(figsize=(10, 6))

# Plot Hamilton (Approach + Extrapolated)
plt.plot(x_approach, f_lewis(x_approach), color='#00A19B', linewidth=2.5, label='Hamilton (Mercedes)') # Teal
plt.plot(x_extrap, f_lewis(x_extrap), color='#00A19B', linewidth=2.5, linestyle='--')

# Plot Verstappen (Approach + Extrapolated)
plt.plot(x_approach, f_max(x_approach), color='#1E41FF', linewidth=2.5, label='Verstappen (Red Bull)') # Dark Blue
plt.plot(x_extrap, f_max(x_extrap), color='#1E41FF', linewidth=2.5, linestyle='--')

# Mark Key Points
plt.scatter(0, 3.0, color='red', s=100, zorder=5, marker='X', label='Point of Impact (x=0)')
plt.scatter(25, 0, color='orange', s=80, zorder=5, marker='o', label='Corner Apex')

# Formatting for IA context
plt.axhline(0, color='black', linewidth=1, linestyle='-', alpha=0.3) # Approximate inside track edge
plt.grid(True, which='both', linestyle='--', linewidth=0.5)
plt.legend(loc='upper left')
plt.xlabel('x (Distance along track)', fontsize=12)
plt.ylabel('y (Lateral position)', fontsize=12)
plt.title('modeled Racing Lines: Hamilton vs Verstappen (Copse Corner)', fontsize=14)

# Set limits to match the aerial view proportions
plt.xlim(-60, 50)
plt.ylim(-2, 14)
plt.gca().set_aspect('equal', adjustable='box')

# Save and Show
plt.tight_layout()
plt.show()
Editor is loading...
Leave a Comment