"""Lab to Code — Arrhenius: why heat speeds up reactions.

k = A * exp(-Ea / (R * T)). The ratio between two temperatures doesn't need A:
k2 / k1 = exp(Ea / R * (1/T1 - 1/T2))
"""
from math import exp

R = 8.314          # J/(mol*K)
Ea = 50_000        # J/mol, a typical activation energy


def rate_ratio(T1_C, T2_C, Ea=Ea):
    T1, T2 = T1_C + 273.15, T2_C + 273.15   # always use kelvin
    return exp(Ea / R * (1 / T1 - 1 / T2))


print(f"25 -> 35 C: {rate_ratio(25, 35):.2f}x faster")
print(f"25 -> 45 C: {rate_ratio(25, 45):.2f}x faster")
print(f"25 ->  5 C: {rate_ratio(25, 5):.2f}x (slower)")
