Skip to content

Instantly share code, notes, and snippets.

@irl-dan
Created December 16, 2023 03:32
Show Gist options
  • Save irl-dan/d69c706d12765fb759f3b50bc43d18aa to your computer and use it in GitHub Desktop.
Save irl-dan/d69c706d12765fb759f3b50bc43d18aa to your computer and use it in GitHub Desktop.
dyson sphere feasibility estimate (barely serious)
import math
import numpy as np
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
# Assumptions
solar_panel_area = 10 # m²
solar_panel_efficiency = 0.10
# 40.8 kW in watts, assumes 10.2 kW per HGX A100
power_requirement_GPU = 40.8 * 1000
cost_of_servers = 120000 # $120,000, assumes $30,000 per
mass_of_solar_panel_system_m = 260 # kg
specific_energy_of_rocket_fuel = 4500 # N s kg⁻¹
# Constants
solar_constant_I0 = 1361 # W/m² at 1 AU
gravitational_constant_G = 6.67430e-11 # N⋅m²⋅kg⁻²
mass_of_sun_M = 3.955e30 # kg
orbit_radius_AU = math.sqrt(
solar_constant_I0 * solar_panel_area * solar_panel_efficiency / power_requirement_GPU)
orbit_radius_meters = orbit_radius_AU * 1.496e11 # Convert AU to meters
gravitational_potential_energy_U = - \
(gravitational_constant_G * mass_of_sun_M *
mass_of_solar_panel_system_m) / orbit_radius_meters
# Convert Effective Potential Energy to Equivalent Rocket Fuel Mass
equivalent_fuel_mass = abs(
gravitational_potential_energy_U) / specific_energy_of_rocket_fuel
# Hardcoded historical LEO launch cost data (year, cost per kg)
# source: https://ourworldindata.org/grapher/cost-space-launches-low-earth-orbit
historical_data = np.array([
[2014, 4500], [2013, 13600], [1988, 18300], [1997, 10200], [1997, 19200],
[1963, 29500], [1991, 18700], [2000, 16000], [2002, 8100], [1975, 21400],
[1980, 32800], [1965, 177900], [1990, 38800], [1999, 18000], [2002, 10400],
[2004, 11600], [1999, 9600], [2018, 23100], [2013, 34500], [2008, 12600],
[2010, 2600], [2018, 1500], [2001, 10000], [1994, 10500], [1962, 14900],
[2013, 10600], [2017, 8000], [2015, 10600], [1975, 17500], [1982, 8300],
[1992, 9100], [1990, 9900], [1994, 8700], [1997, 6200], [1999, 7600],
[2016, 7900], [1997, 45800], [2000, 73100], [2010, 30500], [1994, 8500],
[1990, 41100], [1996, 50600], [1965, 8200], [1966, 8400], [1994, 20600],
[1967, 5400], [1961, 118500], [1988, 31100], [2019, 17300], [1998, 19100],
[1966, 17900], [1981, 65400], [1993, 23600], [2003, 11200], [1994, 34600],
[1964, 30600], [1965, 21000], [1989, 30800], [2012, 20000], [1985, 5100],
[1999, 8900]
])
# Log-linear regression
log_costs = np.log(historical_data[:, 1])
launch_cost_model = LinearRegression().fit(
historical_data[:, 0].reshape(-1, 1), log_costs)
# Initialize lists for plotting
years = []
launch_costs = []
# Exponential backoff for future years
year_increment = 1
current_year = 2023
year = current_year
max_year = 10000
feasible_year = None
while year < max_year:
predicted_log_cost = launch_cost_model.predict([[year]])
predicted_launch_cost_per_kg = np.exp(predicted_log_cost)
total_launch_cost = predicted_launch_cost_per_kg * equivalent_fuel_mass
# Collect data for plotting
years.append(year)
launch_costs.append(total_launch_cost)
if total_launch_cost <= cost_of_servers:
feasible_year = year
break
year += year_increment
# Exponentially increase the year increment for an exponential backoff
year_increment **= 2
# Plotting
plt.figure(figsize=(10, 6))
plt.plot(years, launch_costs, label='Total Launch Cost')
plt.axhline(y=cost_of_servers, color='r', linestyle='-', label='GPU Cost')
plt.xlabel('Year')
plt.ylabel('Cost ($)')
plt.title('Launch Cost vs GPU Cost Over Time')
plt.legend()
plt.grid(True)
plt.show()
# Output the result
if feasible_year:
print(f"Feasible year for launch: {feasible_year}")
else:
print(f"Launch not feasible within the year {max_year}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment