instruction
stringlengths
2.01k
8.44k
input
stringclasses
1 value
output
stringlengths
180
2.3k
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def earth_time(distance_ly, speed_c): '''Calculate the total time elapsed on Earth for the round trip. Inputs: distance_ly: one-way distance to the star system in light years, float speed_c: speed of the astronaut as a fraction of the speed of light, float Output: t_earth: total time elapsed on ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def lorentz_factor(speed_c): '''Calculate the Lorentz factor for a given speed. Inputs: speed_c: speed as a fraction of the speed of light, float Output: gamma: Lorentz factor, float ''' import math if abs(speed_c) >= 1.0: raise ValueError("Speed must be less than the speed of li...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def astronaut_time(t_earth, gamma): '''Calculate the time elapsed for the astronaut. Inputs: t_earth: total time elapsed on Earth in years, float gamma: Lorentz factor, float Output: t_astronaut: total time elapsed for the astronaut in years, float ''' t_astronaut = float(t_earth) / floa...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def aging_difference(distance_ly, speed_c): '''Calculate the difference in aging between Earth observers and the astronaut. Inputs: distance_ly: one-way distance to the star system in light years, float speed_c: speed of the astronaut as a fraction of the speed of light, float Output: time_diff:...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_critical_angle_rad(mu_s, mass, gravity): '''Compute the critical angle in radians for a block on an inclined plane. Inputs: mu_s: coefficient of static friction, float mass: mass of the block in kg, float gravity: acceleration due to gravity in m/s^2, float Output: angle_rad: cri...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def convert_angle_format(angle_rad, to_degrees, round_digits): '''Convert an angle from radians to degrees and round it. Inputs: angle_rad: angle in radians, float to_degrees: flag to convert to degrees, boolean round_digits: number of decimal places to round to, int Output: formatted_angle:...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def solve_sliding_angle(mu_s, mass, gravity): '''Compute the critical sliding angle in degrees. Inputs: mu_s: coefficient of static friction, float mass: mass of the block in kg, float gravity: acceleration due to gravity in m/s^2, float Output: critical_angle_deg: critical angle in degrees,...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_orbital_distances(h_p, h_a, R_E): '''Compute the perigee and apogee distances from the center of the Earth. Inputs: h_p: altitude at perigee in km, float h_a: altitude at apogee in km, float R_E: radius of the Earth in km, float Outputs: r_p: perigee distance from Earth's center ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_semi_major_axis(r_p, r_a): '''Compute the semi-major axis of the elliptical orbit. Inputs: r_p: perigee distance from Earth's center in km, float r_a: apogee distance from Earth's center in km, float Outputs: a: semi-major axis of the orbit in km, float ''' a = (r_p + r_a) / ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_halfway_altitude(a, R_E): '''Compute the altitude of the satellite when it is halfway from perigee to apogee. Inputs: a: semi-major axis of the orbit in km, float R_E: radius of the Earth in km, float Outputs: h_halfway: altitude of the satellite at the halfway point in km, float ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def satellite_altitude_halfway(h_p, h_a, R_E): '''Compute the altitude of the satellite when it is halfway from perigee to apogee. Inputs: h_p: altitude at perigee in km, float h_a: altitude at apogee in km, float R_E: radius of the Earth in km, float Outputs: h_halfway: altitude of the sate...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def height_quadratic_coefficients(total_time, speed_of_sound, gravity): '''Calculate the coefficients of the quadratic equation for the building height. Inputs: total_time: total time elapsed in seconds, float speed_of_sound: speed of sound in m/s, float gravity: acceleration due to gravity in m/s^2...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function `heig...
def solve_height_quadratic(A, B, C): '''Solve the quadratic equation for the building height. Inputs: A: coefficient of h^2, float B: coefficient of h, float C: constant term, float Outputs: h1: first root of the quadratic equation, float h2: second root of the quadratic equation, float ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function `heig...
def select_physical_height(h1, h2, total_time, speed_of_sound): '''Select the physically valid height from the two mathematical roots. Inputs: h1: first root of the quadratic equation, float h2: second root of the quadratic equation, float total_time: total time elapsed in seconds, float speed_o...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function `heig...
def building_height(total_time, speed_of_sound, gravity): '''Compute the height of the building. Inputs: total_time: total time elapsed in seconds, float speed_of_sound: speed of sound in m/s, float gravity: acceleration due to gravity in m/s^2, float Outputs: height: height of the building ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_tidal_work_per_mass(G, M_m, r, D): '''Compute the work done by tidal forces per unit mass. Inputs: G: gravitational constant, float M_m: mass of the Moon, float r: radius of the Earth, float D: distance to the Moon, float Outputs: work_per_mass: work done per unit mass in J/k...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_tidal_height(work_per_mass, g): '''Compute the tidal height change from the work per unit mass. Inputs: work_per_mass: work done per unit mass in J/kg, float g: acceleration due to gravity on Earth in m/s^2, float Outputs: h: tidal height change in meters, float ''' h = work_...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def calculate_maximum_tidal_height(G, M_m, r, D, g): '''Calculate the maximum height change in the ocean tides caused by the Moon. Inputs: G: gravitational constant, float M_m: mass of the Moon in kg, float r: radius of the Earth in meters, float D: distance between the Earth and the Moon in met...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_final_balance(initial_balance, nominal_rate, periods_per_year): '''Compute the final balance after one year of compound interest. Inputs: initial_balance: starting amount in the account, float nominal_rate: nominal annual interest rate as a decimal, float periods_per_year: number of comp...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_effective_yield(initial_balance, final_balance): '''Compute the effective annual yield in percentage. Inputs: initial_balance: starting amount in the account, float final_balance: balance after one year, float Output: effective_yield_percent: effective annual yield as a percentage, f...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def bank_account_yield(nominal_rate_percent, periods_per_year): '''Compute the effective annual yield of a bank account. Inputs: nominal_rate_percent: nominal annual interest rate in percentage, float periods_per_year: number of compounding periods per year, int Output: effective_yield_percent: ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def cone_unrolled_parameters(r_base, h): '''Calculate the slant height and sector angle of an unrolled cone. Inputs: r_base: base radius of the cone, float h: height of the cone, float Outputs: R_slant: slant height of the cone, float phi_max: central angle of the unrolled sector in radians,...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def unrolled_angle(theta1, theta2, phi_max): '''Calculate the angle between two points in the unrolled sector. Inputs: theta1: azimuthal angle of the first point in radians, float theta2: azimuthal angle of the second point in radians, float phi_max: total central angle of the unrolled sector in rad...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def shortest_path_length(R1, R2, delta_phi): '''Calculate the straight-line distance in the unrolled sector. Inputs: R1: distance of the first point from the apex, float R2: distance of the second point from the apex, float delta_phi: angle between the points in the unrolled sector, float Output...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def solve_shortest_path(p1, p2): '''Find the shortest path between two points on the cone z = 1 - sqrt(x^2+y^2). Inputs: p1: tuple of (x, y, z) for the first point, tuple of floats p2: tuple of (x, y, z) for the second point, tuple of floats Outputs: shortest_distance: length of the shortest pat...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_particular_coefficients(): '''Compute the coefficients A, B, C for the particular solution. Inputs: None Outputs: A: coefficient of the constant term, float B: coefficient of the cosine term, float C: coefficient of the sine term, float ''' A = -1.0 B = -1.5 C = -...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_integration_constant(y0, A, B): '''Compute the integration constant K given the initial value y0 and particular solution coefficients. Inputs: y0: initial value y(0), float A: coefficient of the constant term in particular solution, float B: coefficient of the cosine term in particular s...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def find_finite_y0(): '''Find the initial value y0 for which the solution remains finite. Inputs: None Outputs: y0_finite: the required initial value, float ''' A, B, C = compute_particular_coefficients() y0_finite = A + B K = compute_integration_constant(y0_finite, A, B) return ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_velocity_components(v0, theta_deg): '''Compute the initial velocity components in the x and y directions. Inputs: v0: muzzle velocity in m/s, float theta_deg: angle of elevation in degrees, float Outputs: v0x: horizontal velocity component in m/s, float v0y: vertical velocity com...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_time_of_flight(v0y, g): '''Compute the total time of flight of the projectile. Inputs: v0y: vertical velocity component in m/s, float g: acceleration due to gravity in m/s^2, float Outputs: T: total time of flight in seconds, float ''' T = 2.0 * v0y / g if T < 0.0: ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_range(v0x, T): '''Compute the horizontal range of the projectile in kilometers. Inputs: v0x: horizontal velocity component in m/s, float T: total time of flight in seconds, float Outputs: range_km: horizontal range in kilometers, float ''' range_km = (v0x * T) / 1000.0 re...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def projectile_range_big_bertha(v0, theta_deg, g): '''Compute the predicted range of the Big Bertha gun in kilometers. Inputs: v0: muzzle velocity in m/s, float theta_deg: angle of elevation in degrees, float g: acceleration due to gravity in m/s^2, float Outputs: range_km: predicted range o...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def convert_rate_to_decimal(rate_percent): '''Convert an interest rate from percentage to decimal. Inputs: rate_percent: annual rate of return as a percentage, float Outputs: rate_decimal: annual rate of return as a decimal fraction, float ''' rate_decimal = float(rate_percent) / 100.0 r...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_doubling_time(rate_decimal): '''Calculate the doubling time for continuous compounding. Inputs: rate_decimal: annual rate of return as a decimal fraction, float Outputs: doubling_time: time required for the investment to double in years, float ''' import math if rate_decimal ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def solve_doubling_time_problem(rate_percent): '''Determine the doubling time for an investment with continuous compounding. Inputs: rate_percent: annual rate of return as a percentage, float Outputs: doubling_time: time required for the investment to double in years, float ''' rate_decimal ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def calculate_velocity(L0, delta_t_mu_s): '''Calculate the velocity of the racer relative to the ground. Inputs: L0: proper distance between the markers in meters, float delta_t_mu_s: time interval in microseconds, float Output: v: velocity in meters per second, float ''' delta_t_s = del...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def compute_lorentz_factor(v, c=299792458.0): '''Compute the Lorentz factor for a given velocity. Inputs: v: velocity in meters per second, float c: speed of light in meters per second, float Output: gamma: Lorentz factor, float ''' return 1.0 / math.sqrt(1.0 - (v / c)**2)
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def calculate_contracted_length(L0, gamma): '''Calculate the contracted length using the proper length and Lorentz factor. Inputs: L0: proper length in meters, float gamma: Lorentz factor, float Output: L: contracted length in meters, float ''' L = L0 / gamma return L
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def solve_land_speed_record(L0, delta_t_mu_s): '''Solve for the distance between the markers as measured by the racer. Inputs: L0: proper distance between the markers in meters, float delta_t_mu_s: time interval in microseconds, float Output: L_racer: distance measured by the racer in meters, fl...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_velocity(b, omega, t): '''Compute the velocity vector of the particle at time t. Inputs: b: length parameter, float omega: angular frequency, float t: time, float Output: v: velocity vector [v_x, v_y], numpy array of floats ''' vx = 2.0 * b * omega * np.cos(omega * t) ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_acceleration(b, omega, t): '''Compute the acceleration vector of the particle at time t. Inputs: b: length parameter, float omega: angular frequency, float t: time, float Output: a: acceleration vector [a_x, a_y], numpy array of floats ''' a_x = -2.0 * b * omega**2 * np.s...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_angle_between_vectors(v1, v2): '''Calculate the angle between two vectors in degrees. Inputs: v1: first vector, numpy array of floats v2: second vector, numpy array of floats Output: angle: angle between v1 and v2 in degrees, float ''' v1_flat = np.asarray(v1).flatten() v...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def solve_orbit_angle(b, omega): '''Find the angle between velocity and acceleration at t = pi / (2 * omega). Inputs: b: length parameter, float omega: angular frequency, float Output: angle: angle in degrees, float ''' if omega == 0: raise ValueError("omega cannot be zero") ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def complex_conjugate(v): '''Compute the complex conjugate of a complex vector. Inputs: v: a list of complex numbers representing the vector Outputs: v_conj: a list of complex numbers representing the conjugated vector ''' v_conj = [] for x in v: c = complex(x) imag = -c....
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def inner_product(u, v): '''Compute the inner product of two complex vectors. Inputs: u: a list of complex numbers representing the first vector v: a list of complex numbers representing the second vector Outputs: result: the complex inner product of u and v ''' v_conj = complex_conjugat...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def self_inner_product(y): '''Compute the inner product of a complex vector with itself. Inputs: y: a list of complex numbers representing the vector Outputs: norm_sq: the real part of the inner product (y, y), float ''' result = inner_product(y, y) norm_sq = float(result.real) retur...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def angular_velocity_sq(g, a, theta): '''Compute the square of the angular velocity of the particle. Inputs: g: gravitational acceleration, float a: radius of the hemisphere, float theta: angle from the vertical in radians, float Output: omega_sq: square of the angular velocity, float ''...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def constraint_force(m, g, a, theta): '''Calculate the constraint force (normal force) on the particle. Inputs: m: mass of the particle, float g: gravitational acceleration, float a: radius of the hemisphere, float theta: angle from the vertical in radians, float Output: lambda_force: co...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def leaving_angle(m, g, a): '''Determine the angle at which the particle leaves the hemisphere. Inputs: m: mass of the particle, float g: gravitational acceleration, float a: radius of the hemisphere, float Output: theta_deg: angle in degrees, float ''' import math theta_deg = ma...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def environment_properties(h_m): '''Compute air density and gravity at a given altitude. Inputs: h_m: altitude in meters, float Outputs: rho: air density in kg/m^3, float g: acceleration of gravity in m/s^2, float ''' h_km = h_m / 1000.0 rho = 10.0 ** (-0.05 * h_km + 0.11) R...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def rocket_derivatives(t, h, v, m, v_e, m0, fuel_fraction, t_b, r, c_w): '''Compute the time derivatives of the rocket's state. Inputs: t: current time in seconds, float h: current altitude in meters, float v: current velocity in m/s, float m: current mass in kg, float v_e: exhaust velocity ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def simulate_rocket_flight(v_e, m0, fuel_fraction, t_b, r, c_w, dt): '''Simulate the rocket flight to find the maximum height. Inputs: v_e: exhaust velocity in m/s, float m0: initial mass in kg, float fuel_fraction: fraction of initial mass that is fuel, float t_b: burn time in seconds, float ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def rocket_mass_and_thrust(t, M0, Mf, tb, ve): '''Compute the mass and thrust of the rocket at time t. Inputs: t: current time in seconds, float M0: initial total mass in kg, float Mf: fuel mass in kg, float tb: burn time in seconds, float ve: exhaust velocity in m/s, float Outputs: ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def rocket_derivatives(t, y, v, M0, Mf, tb, ve, r, cw, rho, g0, Re): '''Compute the derivatives dy/dt and dv/dt for the rocket. Inputs: t: current time in seconds, float y: current altitude in meters, float v: current velocity in m/s, float M0, Mf, tb, ve: rocket parameters r, cw, rho: aerod...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def rk4_step(t, y, v, dt, M0, Mf, tb, ve, r, cw, rho, g0, Re): '''Perform one RK4 step to update the rocket's state. Inputs: t: current time in seconds, float y: current altitude in meters, float v: current velocity in m/s, float dt: time step in seconds, float M0, Mf, tb, ve, r, cw, rho, g0...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def solve_rocket_height(ve, M0, Mf, tb, r, cw, rho, g0, Re, dt): '''Simulate the rocket flight and find the maximum height. Inputs: ve, M0, Mf, tb, r, cw, rho, g0, Re: physical parameters dt: time step for integration in seconds, float Outputs: max_height: maximum height reached in kilometers, f...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_rocket_parameters(m_propellant, burn_time, diameter): '''Compute the mass flow rate and cross-sectional area. Inputs: m_propellant: mass of the propellant in kg, float burn_time: duration of the engine burn in s, float diameter: diameter of the rocket in m, float Outputs: mass_fl...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_acceleration(t, v, m_initial, mass_flow_rate, exhaust_speed, area, c_w, rho): '''Compute the acceleration of the rocket at time t and velocity v. Inputs: t: current time in s, float v: current velocity in m/s, float m_initial: initial mass of the rocket in kg, float mass_flow_rate: m...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def integrate_motion(m_initial, mass_flow_rate, exhaust_speed, area, c_w, rho, burn_time, dt=0.001): '''Integrate the motion to find the distance traveled at burn out. Inputs: m_initial: initial mass of the rocket in kg, float mass_flow_rate: mass flow rate in kg/s, float exhaust_speed: exhaust spee...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def solve_rocket_distance(m_initial, m_propellant, burn_time, exhaust_speed, diameter, c_w, rho): '''Solve for the distance traveled by the rocket at burn out. Inputs: m_initial: initial mass of the rocket in kg, float m_propellant: mass of the propellant in kg, float burn_time: duration of the engi...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_drag_factor(diameter, drag_coefficient, air_density): '''Compute the aerodynamic drag factor. Inputs: diameter: rocket diameter in meters, float drag_coefficient: dimensionless drag coefficient, float air_density: air density in kg/m^3, float Output: drag factor in kg/m, float ''...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_characteristic_velocity(exhaust_speed, mass_burn_rate, drag_factor): '''Compute the characteristic velocity of the rocket. Inputs: exhaust_speed: exhaust speed in m/s, float mass_burn_rate: mass burn rate in kg/s, float drag_factor: drag factor in kg/m, float Output: characteristic v...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_burnout_speed(initial_mass, final_mass, exhaust_speed, characteristic_velocity): '''Compute the rocket speed at burnout. Inputs: initial_mass: initial mass of the rocket in kg, float final_mass: final mass of the rocket at burnout in kg, float exhaust_speed: exhaust speed in m/s, float ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def solve_rocket_burnout(initial_mass, propellant_mass, burn_time, diameter, exhaust_speed, drag_coefficient, air_density): '''Solve for the rocket's speed at burnout. Inputs: initial_mass: initial mass in kg, float propellant_mass: propellant mass in kg, float burn_time: burn time in seconds, float...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_inverse_grav_parameter(G, M_sun): '''Compute the inverse of the standard gravitational parameter. Inputs: G: gravitational constant in m^3/(kg s^2), float M_sun: mass of the Sun in kg, float Output: inverse_mu: inverse gravitational parameter in s^2/m^3, float ''' inverse_mu ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_transfer_semi_major_axis(r_inner, r_outer): '''Calculate the semi-major axis of the Hohmann transfer orbit. Inputs: r_inner: orbital radius of the inner planet in meters, float r_outer: orbital radius of the outer planet in meters, float Output: a_t: semi-major axis of the transfer o...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_hohmann_transfer_time(inverse_mu, a_t): '''Calculate the time of flight for the Hohmann transfer. Inputs: inverse_mu: inverse gravitational parameter in s^2/m^3, float a_t: semi-major axis of the transfer orbit in meters, float Output: transfer_time: time of flight in seconds, float ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def hohmann_transfer_earth_to_mars(G, M_sun, r_earth, r_mars): '''Compute the total time needed for a Hohmann transfer from Earth to Mars. Inputs: G: gravitational constant in m^3/(kg s^2), float M_sun: mass of the Sun in kg, float r_earth: orbital radius of Earth in meters, float r_mars: orbita...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def undamped_properties(m, k): '''Compute the undamped natural frequency and period. Inputs: m: mass of the system, float k: spring constant, float Outputs: omega_0: undamped natural frequency, float T_0: undamped period, float ''' import math omega_0 = math.sqrt(k / m) T_0 =...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def target_quasi_frequency(T_0, period_ratio): '''Calculate the required quasi frequency based on the period ratio. Inputs: T_0: undamped period, float period_ratio: ratio of quasi period to undamped period (T_d / T_0), float Outputs: mu: quasi frequency of the damped motion, float ''' i...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_damping_coefficient(omega_0, mu, m): '''Compute the damping coefficient gamma. Inputs: omega_0: undamped natural frequency, float mu: quasi frequency of the damped motion, float m: mass of the system, float Outputs: gamma: damping coefficient, float ''' import math ga...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def solve_problem(period_ratio): '''Find the damping coefficient gamma for a given period ratio. Inputs: period_ratio: ratio of quasi period to undamped period, float Outputs: gamma: damping coefficient, float ''' m = 1 k = 1 omega_0, T_0 = undamped_properties(m, k) mu = target_q...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_rate_constant(r_in, V0): '''Compute the rate constant for the decay of dye concentration. Inputs: r_in: flow rate of water into and out of the tank, float V0: constant volume of the liquid in the tank, float Output: k: rate constant, float ''' k = r_in / V0 return k
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_target_concentration(C0, f): '''Compute the target concentration of the dye. Inputs: C0: initial concentration of the dye, float f: target fraction of the original concentration, float Output: C_target: target concentration, float ''' C_target = float(f * C0) return C_tar...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_elapsed_time(k, f): '''Compute the time elapsed to reach the target concentration fraction. Inputs: k: rate constant of the decay, float f: target fraction of the original concentration, float Output: t: elapsed time, float ''' if f == 1.0: return 0.0 t = -math.lo...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def tank_rinsing_time(V0, C0, r_in, f): '''Find the time elapsed before the dye concentration reaches a target fraction. Inputs: V0: initial volume of the dye solution in the tank, float C0: initial concentration of the dye, float r_in: rate at which fresh water flows in, float f: target fractio...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_burn_parameters(thrust, exhaust_velocity, fuel_mass): '''Calculate the mass burn rate and burnout time. Inputs: thrust: constant mean thrust in N, float exhaust_velocity: exhaust velocity of gases in m/s, float fuel_mass: mass of the first-stage fuel in kg, float Outputs: burn_ra...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def compute_final_mass(initial_mass, fuel_mass): '''Calculate the final mass of the rocket at burnout. Inputs: initial_mass: initial mass of the rocket in kg, float fuel_mass: mass of the first-stage fuel in kg, float Output: final_mass: mass of the rocket at burnout in kg, float ''' fin...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def compute_burnout_velocity(initial_mass, final_mass, exhaust_velocity, burnout_time, gravity): '''Calculate the final velocity of the rocket at burnout. Inputs: initial_mass: initial mass of the rocket in kg, float final_mass: mass of the rocket at burnout in kg, float exhaust_velocity: exhaust ve...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ca...
def rocket_final_speed(initial_mass, fuel_mass, thrust, exhaust_velocity, gravity): '''Calculate the final speed of the rocket at burnout in 10^3 m/s. Inputs: initial_mass: initial mass of the rocket in kg, float fuel_mass: mass of the first-stage fuel in kg, float thrust: constant mean thrust in N,...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def eval_Y11(theta, phi): '''Evaluate the spherical harmonic Y_1^1. Inputs: theta: polar angle in radians, float phi: azimuthal angle in radians, float Output: u: value of the spherical harmonic, complex ''' norm = math.sqrt(3.0 / (8.0 * math.pi)) u = -norm * (math.cos(phi) + 1j * ma...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ev...
def eval_derivatives_Y11(theta, phi): '''Compute the partial derivatives of Y_1^1. Inputs: theta: polar angle in radians, float phi: azimuthal angle in radians, float Output: du_dtheta: first derivative with respect to theta, complex d2u_dtheta2: second derivative with respect to theta, comp...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ev...
def compute_angular_laplacian(theta, phi): '''Compute the angular part of the Laplacian for Y_1^1. Inputs: theta: polar angle in radians, float phi: azimuthal angle in radians, float Output: angular_laplacian: value of the angular Laplacian, complex ''' du_dtheta, d2u_dtheta2, d2u_dphi2 ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ev...
def compute_eigenvalue_c(theta, phi, r): '''Compute the constant c in the Laplacian eigenvalue equation. Inputs: theta: polar angle in radians, float phi: azimuthal angle in radians, float r: radial distance, float Output: c: the constant eigenvalue, float ''' u = eval_Y11(theta, phi...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def undamped_natural_frequency(L, C): '''Compute the undamped natural frequency of an LC circuit. Inputs: L: inductance in Henrys, float C: capacitance in Farads, float Output: omega_0: undamped natural frequency in rad/s, float ''' import math if L == 0 or C == 0: return flo...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def critical_damping_resistance(L, omega_0): '''Compute the resistance required for critical damping. Inputs: L: inductance in Henrys, float omega_0: undamped natural frequency in rad/s, float Output: R: critical damping resistance in Ohms, float ''' return float(2.0 * L * omega_0)
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def solve_critical_damping(L, C): '''Find the resistance R so that the series RLC circuit is critically damped. Inputs: L: inductance in Henrys, float C: capacitance in Farads, float Output: R: critical damping resistance in Ohms, float ''' omega_0 = undamped_natural_frequency(L, C) ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def convert_period_to_seconds(period_years): '''Convert the orbital period from years to seconds. Inputs: period_years: orbital period in years, float Output: period_seconds: orbital period in seconds, float ''' seconds_per_year = 365 * 24 * 60 * 60 period_seconds = float(period_years * ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_semimajor_axis(period_seconds, G, M_sun): '''Compute the semi-major axis of the orbit using Kepler's Third Law. Inputs: period_seconds: orbital period in seconds, float G: gravitational constant, float M_sun: mass of the Sun, float Output: semimajor_axis: semi-major axis in meter...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_perihelion_distance(semimajor_axis, eccentricity): '''Calculate the minimum distance from the Sun (perihelion). Inputs: semimajor_axis: semi-major axis of the orbit in meters, float eccentricity: orbital eccentricity, float Output: min_distance: minimum distance in meters, float ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def halleys_comet_min_distance(period_years, eccentricity, G, M_sun): '''Calculate the minimum distance of Halley's comet from the Sun. Inputs: period_years: orbital period in years, float eccentricity: orbital eccentricity, float G: gravitational constant, float M_sun: mass of the Sun, float ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_p_t(t): '''Compute the coefficient p(t) for the standard form of the ODE. Inputs: t: the independent variable, float Outputs: p_val: the value of p(t), float ''' p_val = 2.0 / t return p_val
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ex...
def integrate_p(t0, t1): '''Compute the definite integral of p(t) from t0 to t1. Inputs: t0: lower limit of integration, float t1: upper limit of integration, float Outputs: integral_val: the value of the integral, float ''' integral_val = 2.0 * math.log(t1 / t0) return integral_val
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ex...
def compute_wronskian(W0, integral_val): '''Compute the Wronskian at t1 using Abel's theorem. Inputs: W0: the Wronskian at t0, float integral_val: the integral of p(t) from t0 to t1, float Outputs: W1: the Wronskian at t1, float ''' W1 = W0 * math.exp(-integral_val) return W1
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to ex...
def solve_wronskian_problem(t0, W0, t1): '''Solve for the Wronskian at t1 given its value at t0. Inputs: t0: initial point, float W0: Wronskian at t0, float t1: target point, float Outputs: W1: Wronskian at t1, float ''' integral_val = integrate_p(t0, t1) W1 = compute_wronskian(W...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: NEXT STEP - PROBLEM ...
def compute_mass_parameters(m0, fuel_fraction, t_b): '''Compute the mass flow rate and final mass of the rocket. Inputs: m0: initial mass of the rocket in kg, float fuel_fraction: fraction of the initial mass that is fuel, float t_b: burn time in seconds, float Outputs: mass_flow_rate: mass ...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_drag_constant(r, c_w, rho): '''Compute the drag proportionality constant. Inputs: r: radius of the rocket in meters, float c_w: drag coefficient, float rho: air density in kg/m^3, float Outputs: k: drag proportionality constant in kg/m, float ''' k = 0.5 * c_w * rho * mat...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def simulate_burn_phase(v_e, m0, mass_flow_rate, t_b, k, g): '''Simulate the burn phase to find the final height and velocity. Inputs: v_e: gas exhaust velocity in m/s, float m0: initial mass of the rocket in kg, float mass_flow_rate: mass flow rate of the fuel in kg/s, float t_b: burn time in s...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def compute_coasting_distance(m_f, v_burn, k, g): '''Compute the additional height reached during the coasting phase. Inputs: m_f: final mass of the rocket in kg, float v_burn: velocity at the end of the burn phase in m/s, float k: drag proportionality constant in kg/m, float g: acceleration due...
PROBLEM DESCRIPTION: You will be provided with the main description of the problem, previous steps, and the next step. Your task will be to generate the disciplinary knowledge necessary for solving the next step and then develop a Python solution focused on this step. PREVIOUS STEPS DESCRIPTION: Write a function to co...
def rocket_max_height(v_e, m0, fuel_fraction, t_b, r, c_w, rho, g): '''Compute the total maximum height reached by the rocket in kilometers. Inputs: v_e: gas exhaust velocity in m/s, float m0: initial mass of the rocket in kg, float fuel_fraction: fraction of the initial mass that is fuel, float ...