Resistivity RA/L = p

This commit is contained in:
2025-10-26 13:00:59 +00:00
parent 47a92d5060
commit 8048d536d1
2 changed files with 24 additions and 0 deletions

View File

@@ -135,4 +135,5 @@ gen_list = [
("binary_addition", "computer_science"),
("kinetic_energy", "physics"),
("potential_dividers", "physics"),
("resistivity", "physics"),
]

View File

@@ -40,3 +40,26 @@ def potential_dividers(max_vin=50, max_resistance=500):
problem = f"In a Potential Divider, if resistors R1 and R2 have resistances of ${r1} Ω$ and ${r2} Ω$ respectively, and the cell has ${vin} V$ What is the output potential difference across R2?"
solution = f"${vout} V$"
return problem, solution
def resistivity(max_diameter_mm=5, max_length_cm=100, max_resistance=0.1):
r"""Calculate the Resistivity using the equation R = (pL)/A, where R = Resistance, L = length of wire, p = resistivity and A = cross sectional area of wire
| Ex. Problem | Ex. Solution |
| --- | --- |
| A wire has resistance $17 mΩ$ when it is $43 cm$ long with a diameter of $1.33 mm$. Calculate the resistivity of the wire |
"""
# This question requires a lot of unit conversions and calculating the area of a circle from diameter
diameter_mm = round(random.uniform(0, max_diameter_mm),2) # Random diameter in mm
cross_sectional_area = math.pi * (diameter_mm / 2000)**2 # Calculate the cross sectional area using pi r²
length_cm = round(random.uniform(0, max_length_cm),2) # Random wire length in cm
resistance = round(random.uniform(0, max_resistance),2) # Random reistance in ohms
resistivity = (resistance * cross_sectional_area) / (length_cm / 100)
problem = f"A wire has resistance ${resistance*1000} mΩ$ when it is ${length_cm} cm$ long with a diameter of ${diameter_mm} mm$. Calculate the resistivity of the wire"
solution = f"${resistivity:.2e} Ωm$"
return problem, solution