You will write two fitting functions: one that finds the doubling time of exponential counts with a straight line through , and one that finds and of logistic counts with curve_fit.
The idea. For exponential counts, the slope of against is , and the doubling time is . For logistic counts, curve_fit searches for the and that make the sum of squared misses smallest.
Your tasks.
doubling_time, fit a straight line to np.log(N) against t and return the doubling time.fit_logistic, use curve_fit to find r and K, with the start fixed at N[0]. Return them both.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…