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: Write a function to ca...
def calculate_new_enthalpy(enthalpy_initial, delta_cp, delta_t): '''Calculate the new enthalpy of formation using Kirchhoff's law. Inputs: enthalpy_initial: initial enthalpy of formation in kJ/mol, float delta_cp: change in molar heat capacity in J/(K mol), float delta_t: temperature difference in 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 ca...
def estimate_enthalpy_of_formation(enthalpy_298, t1_k, t2_c, cp_h2o, cp_h2, cp_o2): '''Estimate the standard enthalpy of formation of H2O(g) at a new temperature. Inputs: enthalpy_298: standard enthalpy of formation at 298 K in kJ/mol, float t1_k: initial temperature in Kelvin, float t2_c: final tem...
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_units_and_moles(mass_g, molar_mass_g_mol, temp_celsius, v1_cm3, v2_dm3): '''Convert units to SI and calculate moles. Inputs: mass_g: mass of the gas in grams, float molar_mass_g_mol: molar mass of the gas in g/mol, float temp_celsius: initial temperature in degrees Celsius, float v1_...
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_final_temperature(t1_k, v1_m3, v2_m3, c_v_m, r_const): '''Calculate the final temperature after adiabatic expansion. Inputs: t1_k: initial temperature in Kelvin, float v1_m3: initial volume in m^3, float v2_m3: final volume in m^3, float c_v_m: molar heat capacity at constant volume ...
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_adiabatic_work(n_moles, t1_k, t2_k, c_v_m): '''Calculate the work done during the adiabatic expansion. Inputs: n_moles: amount of substance in moles, float t1_k: initial temperature in Kelvin, float t2_k: final temperature in Kelvin, float c_v_m: molar heat capacity at constant volum...
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_adiabatic_work(mass_g, molar_mass_g_mol, temp_celsius, v1_cm3, v2_dm3, c_v_m, r_const): '''Calculates the work done during a reversible adiabatic expansion. Inputs: mass_g: mass of the gas in grams, float molar_mass_g_mol: molar mass of the gas in g/mol, float temp_celsius: initial tempera...
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_kinetic_energy(potential_difference_V, charge): '''Compute the kinetic energy of an accelerated charge. Inputs: potential_difference_V: electric potential difference in Volts, float charge: elementary charge in Coulombs, float Output: kinetic energy in Joules, float ''' kinetic_e...
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_momentum(kinetic_energy, mass): '''Compute the momentum of a particle given its kinetic energy and mass. Inputs: kinetic_energy: kinetic energy in Joules, float mass: mass of the particle in kg, float Output: momentum in kg*m/s, float ''' momentum = (2.0 * mass * kinetic_energy) ...
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_de_broglie_wavelength(momentum, planck_constant): '''Compute the de Broglie wavelength of a particle. Inputs: momentum: momentum of the particle in kg*m/s, float planck_constant: Planck's constant in J*s, float Output: de Broglie wavelength in meters, float ''' if momentum == 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 ca...
def electron_wavelength(potential_difference_kV): '''Estimate the wavelength of electrons accelerated through a potential difference. Inputs: potential_difference_kV: potential difference in kilovolts, float Output: wavelength in meters, float ''' e = 1.602e-19 m_e = 9.109e-31 h = 6.626e...
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_displacement_vector(point_a, point_b): '''Calculate the displacement vector between two points. Inputs: point_a: initial point coordinates, list of 3 floats point_b: final point coordinates, list of 3 floats Output: displacement: displacement vector, list of 3 floats ''' disp...
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_work_done(force_vector, displacement_vector): '''Compute the work done by a force over a displacement. Inputs: force_vector: force vector components, list of 3 floats displacement_vector: displacement vector components, list of 3 floats Output: work: work done, float ''' 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 ca...
def solve_work_problem(force_vector, point_a, point_b): '''Solve for the total work done by a force moving an object between two points. Inputs: force_vector: force vector components, list of 3 floats point_a: initial point coordinates, list of 3 floats point_b: final point coordinates, list of 3 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 convert_to_si(c_array, h_array, rho): '''Convert concentration, height, and density to SI units. Inputs: c_array: array of concentrations in g/dm^3, list of floats h_array: array of heights in cm, list of floats rho: density in g/cm^3, float Outputs: c_si: array of concentrations in kg/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 calculate_intercept(c_si, h_si): '''Calculate the intercept of h/c vs c. Inputs: c_si: array of concentrations in kg/m^3, list of floats h_si: array of heights in m, list of floats Outputs: intercept: y-intercept of the linear fit, float ''' c_arr = np.array(c_si, dtype=float) h_...
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_molar_mass(intercept, rho_si, T): '''Calculate the molar mass of the polymer. Inputs: intercept: y-intercept of h/c vs c in SI units, float rho_si: density in kg/m^3, float T: temperature in Kelvin, float Outputs: M: molar mass in kg/mol, float ''' R = 8.3145 g = 9....
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 molar_mass_polymer(c_array, h_array, rho, T): '''Determine the molar mass of the polymer from osmometry data. Inputs: c_array: array of concentrations in g/dm^3, list of floats h_array: array of heights in cm, list of floats rho: density of the solution in g/cm^3, float T: temperature in Kel...
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_semi_major_axis(major_axis_length): '''Compute the semi-major axis of an ellipse. Inputs: major_axis_length: length of the major axis, float Output: semi_major_axis: length of the semi-major axis, float ''' semi_major_axis = major_axis_length / 2.0 return semi_major_axis
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_aphelion_distance(semi_major_axis, eccentricity): '''Compute the maximum distance from the focus to the ellipse. Inputs: semi_major_axis: length of the semi-major axis, float eccentricity: eccentricity of the ellipse, float Output: aphelion_distance: maximum distance from the focus, ...
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_max_distance(eccentricity, major_axis_length): '''Compute the maximum distance from Halley's comet to the sun. Inputs: eccentricity: the eccentricity of the elliptical orbit, float major_axis_length: the length of the major axis of the orbit in AU, float Output: max_distance: 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: NEXT STEP - PROBLEM ...
def calculate_height(t): '''Calculate the height of the ball at time t. Inputs: t: time in seconds, float Output: height: height of the ball in feet, float ''' height = 40 * t - 16 * t**2 return height
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_displacement(t1, delta_t): '''Calculate the displacement of the ball over a time interval. Inputs: t1: starting time in seconds, float delta_t: duration of the interval in seconds, float Output: displacement: change in height in feet, float ''' t2 = t1 + delta_t displac...
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_average_velocity(t1, delta_t): '''Calculate the average velocity over a time interval. Inputs: t1: starting time in seconds, float delta_t: duration of the interval in seconds, float Output: avg_velocity: average velocity in ft/s, float ''' if delta_t == 0: return 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 calculate_extension_meters(natural_length_cm, stretched_length_cm): '''Calculate the extension of the spring in meters. Inputs: natural_length_cm: natural length of the spring in cm, float stretched_length_cm: stretched length of the spring in cm, float Output: extension_m: extension of the ...
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_spring_constant(work_joules, extension_m): '''Compute the spring constant k from the work done and extension. Inputs: work_joules: work done to stretch the spring in Joules, float extension_m: extension of the spring in meters, float Output: spring_constant: spring constant in N/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 ca...
def calculate_force_extension_cm(force_newtons, spring_constant): '''Determine the extension of the spring in cm for a given force. Inputs: force_newtons: applied force in Newtons, float spring_constant: spring constant in N/m, float Output: extension_cm: extension of the spring in cm, 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 ca...
def spring_extension_from_force(work_joules, natural_length_cm, stretched_length_cm, force_newtons): '''Calculate the extension of the spring in cm caused by a specific force. Inputs: work_joules: work done to stretch the spring initially in Joules, float natural_length_cm: natural length of the spring ...
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 pool_area(diameter): '''Compute the radius and area of a circular pool. Inputs: diameter: diameter of the pool, float Outputs: radius: radius of the pool, float area: surface area of the pool, float ''' radius = diameter / 2.0 area = math.pi * radius**2 return radius, area
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 depth_function_parameters(radius, depth_south, depth_north): '''Compute the slope and intercept of the linear depth function. Inputs: radius: radius of the pool, float depth_south: depth at the south end (y = -R), float depth_north: depth at the north end (y = R), float Outputs: slope: 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_volume(area, intercept): '''Compute the total volume of the pool. Inputs: area: surface area of the pool, float intercept: y-intercept of the depth function, float Outputs: volume: total volume of water, float ''' volume = float(area * intercept) return volume
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 swimming_pool_volume(diameter, depth_south, depth_north): '''Compute the total volume of water in the swimming pool. Inputs: diameter: diameter of the circular pool, float depth_south: depth at the south end, float depth_north: depth at the north end, float Outputs: volume: total volume ...
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_molar_volume(p1, T1, R): '''Compute the molar volume of the gas at the initial state. Inputs: p1: initial pressure in atm, float T1: initial absolute temperature in Kelvin, float R: ideal gas constant, float Output: molar_volume: volume occupied by one mole of the gas, 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_final_pressure(T2, molar_volume, R): '''Compute the final pressure of the gas at constant volume. Inputs: T2: final absolute temperature in Kelvin, float molar_volume: volume occupied by one mole of the gas, float R: ideal gas constant, float Output: p2: final pressure in atm, 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 solve_gas_pressure(p1, T1, T2): '''Solve for the final pressure of a gas heated at constant volume. Inputs: p1: initial pressure in atm, float T1: initial absolute temperature in Kelvin, float T2: final absolute temperature in Kelvin, float Output: final_pressure: final pressure in atm, ...
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 water_mass_at_height(x, m_w0, H): '''Compute the mass of the water at a given height. Inputs: x: current height in meters, float m_w0: initial mass of the water in kg, float H: total height in meters, float Output: m_w: mass of the water at height x in kg, float ''' x = float(x) ...
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 rope_mass_at_height(x, H, lambda_rope): '''Compute the mass of the hanging rope at a given height. Inputs: x: current height of the bucket in meters, float H: total height in meters, float lambda_rope: linear mass density of the rope in kg/m, float Output: m_r: mass of the hanging rope 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 total_force_at_height(x, m_b, m_w0, H, lambda_rope, g): '''Compute the total force required to lift the system at height x. Inputs: x: current height in meters, float m_b: mass of the empty bucket in kg, float m_w0: initial mass of the water in kg, float H: total height 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 compute_total_work(m_b, m_w0, H, lambda_rope, g): '''Compute the total work done to lift the system. Inputs: m_b: mass of the empty bucket in kg, float m_w0: initial mass of the water in kg, float H: total height in meters, float lambda_rope: linear mass density of the rope 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: NEXT STEP - PROBLEM ...
def compute_standard_gibbs_energy(T, a, b, c, nu): '''Compute the standard Gibbs energy of the reaction. Inputs: T: temperature in Kelvin, float a: polynomial coefficient for the constant term in V, float b: polynomial coefficient for the linear term in V/K, float c: polynomial coefficient for 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_temperature_coefficient(T, b, c): '''Compute the temperature coefficient of the standard cell potential. Inputs: T: temperature in Kelvin, float b: polynomial coefficient for the linear term in V/K, float c: polynomial coefficient for the quadratic term in V/K^2, float Outputs: d...
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_standard_entropy(dE_dT, nu): '''Compute the standard reaction entropy. Inputs: dE_dT: temperature coefficient of the cell potential in V/K, float nu: number of electrons transferred, int Outputs: delta_S: standard reaction entropy in J/(K mol), float ''' F = 96485 delta_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_standard_enthalpy(delta_G, delta_S, T): '''Compute the standard reaction enthalpy. Inputs: delta_G: standard Gibbs energy in J/mol, float delta_S: standard reaction entropy in J/(K mol), float T: temperature in Kelvin, float Outputs: delta_H: standard reaction enthalpy in kJ/mol,...
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 evaluate_reaction_enthalpy(T, a, b, c, nu): '''Evaluate the standard reaction enthalpy of the cell at a given temperature. Inputs: T: temperature in Kelvin, float a: polynomial coefficient for the constant term in V, float b: polynomial coefficient for the linear term in V/K, float c: polyno...
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_range_factor(angle_deg, g): '''Compute the range factor for a given launch angle and gravity. Inputs: angle_deg: launch angle in degrees, float g: acceleration due to gravity in m/s^2, float Output: range_factor: the calculated range factor in s^2/m, float ''' import math ...
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_initial_speed(distance, range_factor): '''Calculate the initial speed given the distance and range factor. Inputs: distance: horizontal distance in meters, float range_factor: the range factor in s^2/m, float Output: initial_speed: the initial speed in m/s, float ''' import 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 solve_projectile_speed(angle_deg, distance, g): '''Solve for the initial speed of the projectile. Inputs: angle_deg: launch angle in degrees, float distance: horizontal distance in meters, float g: acceleration due to gravity in m/s^2, float Output: initial_speed: the initial speed in 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: NEXT STEP - PROBLEM ...
def compute_partial_derivatives(length, width): '''Compute the partial derivatives of the area with respect to length and width. Inputs: length: measured length of the rectangle, float width: measured width of the rectangle, float Outputs: partial_L: partial derivative of area with respect to le...
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_area_differential(partial_L, partial_W, error_length, error_width): '''Compute the maximum error in the area using the total differential. Inputs: partial_L: partial derivative of area with respect to length, float partial_W: partial derivative of area with respect to width, float error_...
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 estimate_maximum_area_error(length, width, error_length, error_width): '''Estimate the maximum error in the calculated area of a rectangle. Inputs: length: measured length of the rectangle, float width: measured width of the rectangle, float error_length: maximum error in the length measurement,...
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 ellipse_x_bound(c_x, c_y, c): '''Compute the maximum x-coordinate of the ellipse. Inputs: c_x: coefficient of x^2, float c_y: coefficient of y^2, float c: constant term, float Output: x_max: maximum x-coordinate, float ''' return float((c / c_x) ** 0.5)
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 hypotenuse_length(x, c_x, c_y, c): '''Calculate the length of the hypotenuse at a given x. Inputs: x: x-coordinate, float c_x: coefficient of x^2, float c_y: coefficient of y^2, float c: constant term, float Output: h: length of the hypotenuse, float ''' val = (c - c_x * x**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 co...
def cross_section_area(h): '''Compute the area of an isosceles right triangle given its hypotenuse. Inputs: h: length of the hypotenuse, float Output: area: area of the triangle, float ''' area = (h ** 2) / 4.0 return area
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 solid_volume(c_x, c_y, c): '''Compute the total volume of the solid. Inputs: c_x: coefficient of x^2, float c_y: coefficient of y^2, float c: constant term, float Output: volume: total volume of the solid, float ''' x_max = ellipse_x_bound(c_x, c_y, c) integrand = lambda x: 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 cone_volume(h, r_h_ratio): '''Calculate the volume of a cone given its height and radius-to-height ratio. Inputs: h: height of the cone, float r_h_ratio: ratio of the base radius to the height, float Output: volume: volume of the cone, float ''' volume = (1.0 / 3.0) * math.pi * (r_h_...
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 volume_difference(h_initial, h_final, r_h_ratio): '''Compute the volume difference between two cone heights. Inputs: h_initial: initial height of the cone, float h_final: final height of the cone, float r_h_ratio: ratio of the base radius to the height, float Output: vol_diff: difference...
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 time_to_fill(vol_diff, rate): '''Calculate the time required to deliver a given volume at a constant rate. Inputs: vol_diff: volume of material to be added, float rate: volumetric flow rate, float Output: time_required: time duration, float ''' if vol_diff == 0.0: return 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 ca...
def silo_fill_time(h_silo, r_silo, rate, r_h_ratio, h_current): '''Calculate the time required for the ore pile to reach the top of the silo. Inputs: h_silo: height of the silo in ft, float r_silo: radius of the silo in ft, float rate: volumetric flow rate of the ore in ft^3/h, float r_h_ratio: ...
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 mass_flux_field(rho, x, y, z): '''Compute the mass flux vector field at a given point. Inputs: rho: fluid density, float x: x-coordinate, float y: y-coordinate, float z: z-coordinate, float Output: tuple of (F_x, F_y, F_z), floats ''' F_x = float(rho * z) F_y = float(rho * (y...
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 cylinder_normal_vector(R, theta): '''Compute the outward normal vector element for a cylinder. Inputs: R: cylinder radius, float theta: azimuthal angle in radians, float Output: tuple of (dS_x, dS_y, dS_z), floats ''' dS_x = float(R * math.cos(theta)) dS_y = float(R * math.sin(theta)...
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 flux_integrand(theta, z, rho, R): '''Compute the scalar integrand for the flux surface integral. Inputs: theta: azimuthal angle in radians, float z: height coordinate, float rho: fluid density, float R: cylinder radius, float Output: scalar value of the dot product F dot dS, 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 total_outward_flow(rho, R, z_min, z_max): '''Compute the total outward mass flow rate through the cylinder. Inputs: rho: fluid density, float R: cylinder radius, float z_min: lower bound of z, float z_max: upper bound of z, float Output: total mass flux, float ''' total_flux, _ =...
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_semi_major_axis(d_min, e): '''Compute the semi-major axis of an elliptical orbit. Inputs: d_min: minimum distance from the focus, float e: eccentricity of the orbit, float Output: a: semi-major axis of the orbit, float ''' a = d_min / (1 - e) return 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_max_distance(a, e): '''Compute the maximum distance of an elliptical orbit from its focus. Inputs: a: semi-major axis of the orbit, float e: eccentricity of the orbit, float Output: d_max: maximum distance from the focus, float ''' d_max = a * (1 + e) return d_max
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 mercury_orbit(d_min, e): '''Compute the maximum distance of Mercury from the sun given its minimum distance and orbital eccentricity. Inputs: d_min: minimum distance from the sun, float e: eccentricity of the orbit, float Output: d_max: maximum distance from the sun, float ''' a = 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: NEXT STEP - PROBLEM ...
def convert_angle(angle_degrees): '''Convert an angle from degrees to radians. Inputs: angle_degrees: angle in degrees, float Outputs: angle_radians: angle in radians, float ''' import math angle_radians = angle_degrees * math.pi / 180.0 return angle_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 co...
def compute_horizontal_force(force_magnitude, angle_radians): '''Compute the horizontal component of a force. Inputs: force_magnitude: magnitude of the force, float angle_radians: angle of the force in radians, float Outputs: horizontal_force: horizontal component of the force, 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_work(horizontal_force, distance): '''Calculate the work done by a horizontal force over a distance. Inputs: horizontal_force: horizontal component of the force, float distance: displacement distance, float Outputs: work: work done, float ''' work = horizontal_force * distance...
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_work_done(force_magnitude, angle_degrees, distance): '''Compute the total work done by a force applied at an angle over a distance. Inputs: force_magnitude: magnitude of the applied force in lb, float angle_degrees: angle of the force above the horizontal in degrees, float distance: distan...
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 extract_midpoint_areas(areas): '''Extract the areas corresponding to the midpoints of the subintervals. Inputs: areas: list of cross-sectional areas, list of floats Output: midpoint_areas: list of areas at the midpoints, list of floats ''' n = len(areas) num_subintervals = (n - 1) //...
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 calculate_subinterval_width(spacing): '''Calculate the width of the subintervals for the Midpoint Rule. Inputs: spacing: distance between adjacent cross-sections, float Output: delta_x: width of the subintervals, float ''' delta_x = 2.0 * spacing return delta_x
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 estimate_volume(areas, spacing): '''Estimate the volume using the Midpoint Rule. Inputs: areas: list of cross-sectional areas, list of floats spacing: distance between adjacent cross-sections, float Output: volume: estimated volume, float ''' midpoint_areas = extract_midpoint_areas(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: NEXT STEP - PROBLEM ...
def work_constant_weight(weight, distance): '''Compute the work done to lift a constant weight. Inputs: weight: the constant weight of the object, float distance: the distance the object is lifted, float Output: work: the work done, float ''' work = float(weight * distance) return wo...
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 work_cable(linear_weight, distance): '''Compute the work done to lift a cable with uniform linear weight. Inputs: linear_weight: the weight per unit length of the cable, float distance: the total length of the cable to be lifted, float Output: work: the work done to lift the cable, 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 total_work(coal_weight, cable_linear_weight, depth): '''Compute the total work done to lift the coal and the cable. Inputs: coal_weight: the weight of the coal in lb, float cable_linear_weight: the linear weight density of the cable in lb/ft, float depth: the depth of the mine shaft in ft, 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 profile_derivative(x, amplitude, period): '''Compute the derivative of the sine wave profile. Inputs: x: position along the width, float amplitude: amplitude of the sine wave, float period: spatial period of the sine wave, float Output: derivative: dy/dx at position x, 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 arc_length_integrand(x, amplitude, period): '''Compute the integrand for the arc length integral. Inputs: x: position along the width, float amplitude: amplitude of the sine wave, float period: spatial period of the sine wave, float Output: integrand: value of sqrt(1 + (dy/dx)^2), 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_flat_sheet_width(panel_width, amplitude, period): '''Compute the total flat sheet width by integrating the arc length. Inputs: panel_width: final width of the corrugated panel, float amplitude: amplitude of the sine wave, float period: spatial period of the sine wave, 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 co...
def roofing_sheet_width(panel_width, thickness, period): '''Solve for the required flat sheet width given panel dimensions. Inputs: panel_width: final width of the corrugated panel, float thickness: peak-to-peak thickness of the panel, float period: spatial period of the sine wave, 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: NEXT STEP - PROBLEM ...
def compute_partial_derivatives(radius, height): '''Compute the partial derivatives of the volume of a cylinder. Inputs: radius: radius of the cylinder, float height: height of the cylinder, float Outputs: dV_dr: partial derivative of volume with respect to radius, float dV_dh: partial deriv...
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_differentials(thickness): '''Compute the differentials dr and dh for a closed tin can. Inputs: thickness: thickness of the tin material, float Outputs: dr: differential change in radius, float dh: differential change in height, float ''' dr = float(thickness) dh = 2.0 * 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 estimate_tin_volume(dV_dr, dV_dh, dr, dh): '''Estimate the volume of the tin using the total differential. Inputs: dV_dr: partial derivative of volume with respect to radius, float dV_dh: partial derivative of volume with respect to height, float dr: differential change in radius, float dh: ...
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_tin_can_problem(diameter, height, thickness): '''Estimate the amount of tin in a closed tin can. Inputs: diameter: diameter of the tin can in cm, float height: interior height of the tin can in cm, float thickness: thickness of the tin in cm, float Outputs: estimated_tin_volume: es...
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_displacement_and_velocity(y_initial, y_final, time): '''Compute the displacement and average velocity. Inputs: y_initial: initial height in ft, float y_final: final height in ft, float time: time taken in seconds, float Outputs: displacement: vertical displacement in ft, 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_work_and_power(weight, displacement, time): '''Compute the work done and average power. Inputs: weight: weight of the gorilla in lb, float displacement: vertical displacement in ft, float time: time taken in seconds, float Outputs: work: work done in ft-lb, float power: avera...
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 gorilla_climb_work(weight, y_initial, y_final, time): '''Solve for the work done by the gorilla. Inputs: weight: weight of the gorilla in lb, float y_initial: initial height in ft, float y_final: final height in ft, float time: time taken in seconds, float Outputs: work: work done in...
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 integrate_concentration(A, k, T): '''Compute the integral of the concentration function c(t) = A * t * exp(-k * t) from 0 to T. Inputs: A: coefficient of the concentration function, float k: exponential decay constant, float T: total measurement time, float Output: integral_c: area under...
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_cardiac_output_ls(dye_amount, integral_c): '''Compute the cardiac output in L/s. Inputs: dye_amount: amount of dye injected in mg, float integral_c: area under the concentration curve in (mg/L)*s, float Output: cardiac_output_ls: cardiac output in L/s, float ''' if integral_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 convert_flow_rate(cardiac_output_ls): '''Convert cardiac output from L/s to L/min. Inputs: cardiac_output_ls: cardiac output in L/s, float Output: cardiac_output_lmin: cardiac output in L/min, float ''' cardiac_output_lmin = float(cardiac_output_ls) * 60.0 return cardiac_output_lmin
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 cardiac_output_dye_dilution(dye_amount, A, k, T): '''Compute the cardiac output in L/min using the dye dilution method. Inputs: dye_amount: amount of dye injected in mg, float A: coefficient of the concentration function in mg/(L*s), float k: exponential decay constant in 1/s, float T: total...
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 curve_difference(x): '''Compute the absolute difference between cos(x) and cos^2(x). Inputs: x: a single value or a numpy array of x coordinates, float or numpy.ndarray Output: diff: the absolute difference |cos(x) - cos^2(x)|, float or numpy.ndarray ''' c = np.cos(x) diff = np.abs(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 trapezoidal_rule(x_array, y_array): '''Numerically integrate using the trapezoidal rule. Inputs: x_array: array of x coordinates, numpy.ndarray y_array: array of corresponding y values, numpy.ndarray Output: integral_approx: the approximated integral, float ''' x = np.asarray(x_array...
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_area_bounded(a, b, num_points): '''Compute the area bounded by the curves over [a, b] using numerical integration. Inputs: a: lower bound of the interval, float b: upper bound of the interval, float num_points: number of points for discretization, int Output: area: the computed b...
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_area_problem(): '''Solve for the area bounded by y=cos(x) and y=cos^2(x) between x=0 and x=pi. Inputs: None Output: final_area: the total bounded area, float ''' final_area = compute_area_bounded(0, np.pi, 10000) return final_area
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_angle_to_radians(angle_degrees): '''Convert an angle from degrees to radians. Inputs: angle_degrees: angle in degrees, float Output: angle_radians: angle in radians, float ''' angle_radians = angle_degrees * (math.pi / 180) return angle_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 co...
def compute_triangle_area(side1, side2, angle_radians): '''Calculate the area of a triangle given two sides and the included angle in radians. Inputs: side1: length of the first side, float side2: length of the second side, float angle_radians: included angle in radians, float Output: area: ...
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 triangle_area_from_degrees(side_ab, side_bc, angle_abc_degrees): '''Compute the area of a triangle given two sides and the included angle in degrees. Inputs: side_ab: length of side AB, float side_bc: length of side BC, float angle_abc_degrees: included angle ABC in degrees, 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: NEXT STEP - PROBLEM ...
def compute_quadratic_coefficients(width_km, upstream_km, current_speed, boat_speed): '''Compute the coefficients A, B, C for the quadratic time equation. Inputs: width_km: width of the canal in km, float upstream_km: distance upstream in km, float current_speed: speed of the current in km/h, 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_time_hours(A, B, C): '''Solve the quadratic equation for the positive time root. Inputs: A: quadratic coefficient, float B: linear coefficient, float C: constant coefficient, float Outputs: t_hours: positive travel time in hours, float ''' import math discriminant = B**...
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_hours_to_minutes(t_hours): '''Convert time from hours to minutes. Inputs: t_hours: time in hours, float Outputs: t_minutes: time in minutes, float ''' t_minutes = float(t_hours) * 60.0 return t_minutes
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 boat_trip_time(width_km, upstream_km, current_speed, boat_speed): '''Compute the total trip time in minutes for the boat to cross the canal. Inputs: width_km: width of the canal in km, float upstream_km: distance upstream in km, float current_speed: speed of the current in km/h, float boat_s...