Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
773 B
0
Indexable
Never
from sympy import symbols, Eq, solve

# Define the symbols
T_final = symbols('T_final')

# Given values
m_copper = 0.265  # kg
c_copper = 390  # J/kg·C
T_initial_copper = 245  # °C

m_water = 0.825  # kg
c_water = 4186  # J/kg·C
T_initial_water = 16.0  # °C

m_aluminum = 0.135  # kg
c_aluminum = 900  # J/kg·C

# Heat lost by copper = Heat gained by water + Heat gained by aluminum
Q_copper = m_copper * c_copper * (T_final - T_initial_copper)
Q_water = m_water * c_water * (T_final - T_initial_water)
Q_aluminum = m_aluminum * c_aluminum * (T_final - T_initial_water)

# Conservation of energy equation
energy_eq = Eq(Q_copper, Q_water + Q_aluminum)

# Solve for T_final
T_final_solution = solve(energy_eq, T_final)[0]
T_final_solution

Leave a Comment