(* Get input from user *) n = Input["Enter initial number of nuclei: "] tau = Input["Enter decay time constant tau: "] dt = Input["Enter time step dt: "] tMax = Input["Enter time to end simulation: "] (* Initialize variables and output list *) t = 0 result = {{t, n}} (* Calculate results and store in list *) While[t < tMax, n -= n / tau * dt; t += dt; result = Append[result, {t, n}] ] (* Plot output and exact solution *) euler = ListPlot[result, DisplayFunction->Identity] exact = Plot[100 Exp[-t], {t, 0, 5}, DisplayFunction->Identity] Show[euler, exact, DisplayFunction->$DisplayFunction]