Saturday, June 22, 2024

Learn Python codes for the rate of decay of atoms in radioactivity

 import math


def compute_quantity(N0, lambda_, T):

    N = N0 * math.exp(-lambda_ * T)

    return N


# Example usage:

N0 = 100  # Initial quantity

lambda_ = 0.1  # Decay constant

T = 5  # Time


result = compute_quantity(N0, lambda_, T)

print(f"N = {N0} * exp(-{lambda_} * {T}) = {result}")

No comments: